Always limit blink to ~1 second intervals

This commit is contained in:
Scott Lahteine 2016-04-01 14:20:47 -07:00
parent 0d6609c3c5
commit 0b4f65dca8

View File

@ -1822,9 +1822,10 @@ int lcd_strlen_P(const char* s) {
bool lcd_blink() {
static uint8_t blink = 0;
static millis_t next_blink_ms = 0;
if (millis() >= next_blink_ms) {
millis_t ms = millis();
if (ms >= next_blink_ms) {
blink ^= 0xFF;
next_blink_ms = millis() + LCD_UPDATE_INTERVAL - 50;
next_blink_ms = ms + 1000 - LCD_UPDATE_INTERVAL / 2;
}
return blink != 0;
}