|
|
@@ -419,38 +419,34 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
|
|
|
if (_display != NULL) {
|
|
|
if (!_display->isOn()) _display->turnOn();
|
|
|
_auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer
|
|
|
- _next_refresh = 0; // trigger refresh
|
|
|
+ _next_refresh = 100; // trigger refresh
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void UITask::userLedHandler() {
|
|
|
#ifdef PIN_STATUS_LED
|
|
|
- static int state = 0;
|
|
|
- static int next_change = 0;
|
|
|
- static int last_increment = 0;
|
|
|
-
|
|
|
int cur_time = millis();
|
|
|
- if (cur_time > next_change) {
|
|
|
- if (state == 0) {
|
|
|
- state = 1;
|
|
|
+ if (cur_time > next_led_change) {
|
|
|
+ if (led_state == 0) {
|
|
|
+ led_state = 1;
|
|
|
if (_msgcount > 0) {
|
|
|
- last_increment = LED_ON_MSG_MILLIS;
|
|
|
+ last_led_increment = LED_ON_MSG_MILLIS;
|
|
|
} else {
|
|
|
- last_increment = LED_ON_MILLIS;
|
|
|
+ last_led_increment = LED_ON_MILLIS;
|
|
|
}
|
|
|
- next_change = cur_time + last_increment;
|
|
|
+ next_led_change = cur_time + last_led_increment;
|
|
|
} else {
|
|
|
- state = 0;
|
|
|
- next_change = cur_time + LED_CYCLE_MILLIS - last_increment;
|
|
|
+ led_state = 0;
|
|
|
+ next_led_change = cur_time + LED_CYCLE_MILLIS - last_led_increment;
|
|
|
}
|
|
|
- digitalWrite(PIN_STATUS_LED, state);
|
|
|
+ digitalWrite(PIN_STATUS_LED, led_state);
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
void UITask::setCurrScreen(UIScreen* c) {
|
|
|
curr = c;
|
|
|
- _next_refresh = 0;
|
|
|
+ _next_refresh = 100;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -520,18 +516,17 @@ void UITask::loop() {
|
|
|
}
|
|
|
#endif
|
|
|
#if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN)
|
|
|
- static int next_btn_check = 0;
|
|
|
- if (millis() > next_btn_check) {
|
|
|
+ if (millis() > next_backlight_btn_check) {
|
|
|
bool touch_state = digitalRead(PIN_BUTTON2);
|
|
|
digitalWrite(DISP_BACKLIGHT, !touch_state);
|
|
|
- next_btn_check = millis() + 300;
|
|
|
+ next_backlight_btn_check = millis() + 300;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
if (c != 0 && curr) {
|
|
|
curr->handleInput(c);
|
|
|
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
|
|
- _next_refresh = 0; // trigger refresh
|
|
|
+ _next_refresh = 100; // trigger refresh
|
|
|
}
|
|
|
|
|
|
userLedHandler();
|