Speedup sreen update delay

Speedup sreen update delay
and correct a comment.

A module division by 10 is slooooow. (powers of 2 are fast - but then you can AND a bitmask with the same result)
This commit is contained in:
AnHardt 2016-05-19 15:41:09 +02:00
parent b422e39016
commit 0c4d885d5b

View file

@ -282,7 +282,6 @@ menuPosition menu_history[10];
uint8_t menu_history_depth = 0; uint8_t menu_history_depth = 0;
millis_t next_lcd_update_ms; millis_t next_lcd_update_ms;
uint8_t lcd_status_update_delay;
bool ignore_click = false; bool ignore_click = false;
bool wait_for_unclick; bool wait_for_unclick;
bool defer_return_to_status = false; bool defer_return_to_status = false;
@ -2248,9 +2247,13 @@ void lcd_update() {
} }
#endif //ULTIPANEL #endif //ULTIPANEL
// Simply redraw the Info Screen 10 times a second // Here we arrive every ~100ms when ideling often enough.
if (currentMenu == lcd_status_screen && !(++lcd_status_update_delay % 10)) // Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
static int8_t lcd_status_update_delay = 1; // first update one loop delayed
if (currentMenu == lcd_status_screen && !lcd_status_update_delay--) {
lcd_status_update_delay = 9;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
if (lcdDrawUpdate) { if (lcdDrawUpdate) {