performance_optimization
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
performance_optimization [2018/12/10 12:00] – [Pause] emozolyak | performance_optimization [2021/01/16 09:47] – [Pause] emozolyak | ||
---|---|---|---|
Line 109: | Line 109: | ||
-Increase the speed of exchange on the RS-485, RS-232 buses. The speed of 9600 is too slow for a lot of data. We recommend selecting a speed of 115200 and higher. | -Increase the speed of exchange on the RS-485, RS-232 buses. The speed of 9600 is too slow for a lot of data. We recommend selecting a speed of 115200 and higher. | ||
-If there are a lot of registers and not all need to be polled in each cycle, then you can specify a larger poll interval for less important registers. This will offload the system and data buses. | -If there are a lot of registers and not all need to be polled in each cycle, then you can specify a larger poll interval for less important registers. This will offload the system and data buses. | ||
+ | |||
+ | ===== General rules for optimizing your projects ===== | ||
+ | <code lua> | ||
+ | function UpdReg(reg, new_value) | ||
+ | local cur_value = R(reg) | ||
+ | | ||
+ | if (not cur_value) or (cur_value == new_value) then | ||
+ | return | ||
+ | else | ||
+ | W(reg, new_value) | ||
+ | end | ||
+ | end | ||
+ | </ | ||
performance_optimization.txt · Last modified: 2023/05/03 08:54 by emozolyak