@@ -419,38 +419,34 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
419419 if (_display != NULL ) {
420420 if (!_display->isOn ()) _display->turnOn ();
421421 _auto_off = millis () + AUTO_OFF_MILLIS; // extend the auto-off timer
422- _next_refresh = 0 ; // trigger refresh
422+ _next_refresh = 100 ; // trigger refresh
423423 }
424424}
425425
426426void UITask::userLedHandler () {
427427#ifdef PIN_STATUS_LED
428- static int state = 0 ;
429- static int next_change = 0 ;
430- static int last_increment = 0 ;
431-
432428 int cur_time = millis ();
433- if (cur_time > next_change ) {
434- if (state == 0 ) {
435- state = 1 ;
429+ if (cur_time > next_led_change ) {
430+ if (led_state == 0 ) {
431+ led_state = 1 ;
436432 if (_msgcount > 0 ) {
437- last_increment = LED_ON_MSG_MILLIS;
433+ last_led_increment = LED_ON_MSG_MILLIS;
438434 } else {
439- last_increment = LED_ON_MILLIS;
435+ last_led_increment = LED_ON_MILLIS;
440436 }
441- next_change = cur_time + last_increment ;
437+ next_led_change = cur_time + last_led_increment ;
442438 } else {
443- state = 0 ;
444- next_change = cur_time + LED_CYCLE_MILLIS - last_increment ;
439+ led_state = 0 ;
440+ next_led_change = cur_time + LED_CYCLE_MILLIS - last_led_increment ;
445441 }
446- digitalWrite (PIN_STATUS_LED, state );
442+ digitalWrite (PIN_STATUS_LED, led_state );
447443 }
448444#endif
449445}
450446
451447void UITask::setCurrScreen (UIScreen* c) {
452448 curr = c;
453- _next_refresh = 0 ;
449+ _next_refresh = 100 ;
454450}
455451
456452/*
@@ -520,18 +516,17 @@ void UITask::loop() {
520516 }
521517#endif
522518#if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN)
523- static int next_btn_check = 0 ;
524- if (millis () > next_btn_check) {
519+ if (millis () > next_backlight_btn_check) {
525520 bool touch_state = digitalRead (PIN_BUTTON2);
526521 digitalWrite (DISP_BACKLIGHT, !touch_state);
527- next_btn_check = millis () + 300 ;
522+ next_backlight_btn_check = millis () + 300 ;
528523 }
529524#endif
530525
531526 if (c != 0 && curr) {
532527 curr->handleInput (c);
533528 _auto_off = millis () + AUTO_OFF_MILLIS; // extend auto-off timer
534- _next_refresh = 0 ; // trigger refresh
529+ _next_refresh = 100 ; // trigger refresh
535530 }
536531
537532 userLedHandler ();
0 commit comments