diff --git a/src/main.cpp b/src/main.cpp index 1875045..438ba11 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -122,6 +122,8 @@ char msg[50]; float pv_v = 0, pv_w = 0, pv_i = 0, pv_kwh = 0, inv_p = 0, inv_i = 0, batt_v = 0, batt_i = 0, batt_p = 0, batt_c_min = 0, batt_c_max = 0, grid_p = 0, batt_soc = 0, load_ph1 = 0, load_ph2 = 0, load_ph3 = 0; bool lastButtonRotationState = HIGH, lastButtonSetupState = HIGH; bool currentButtonRotationState, currentButtonSetupState; +static unsigned long lastDispRefreshTime = 0; +static unsigned long lastScreenChangeTime = 0; int display_screen = 0; //MQTT topics @@ -597,12 +599,11 @@ void setup() { delay(3000); display_text_fullscreen((char*)"Configuration summary", (char*)"Disp. Refresh:", disp_refresh_interval, (char*)"Disp. rotation:", disp_screen_interval, (char*)" 2/2"); delay(3000); + lastDispRefreshTime = millis(); + lastScreenChangeTime = millis(); } -void loop() { - static unsigned long lastDispRefreshTime = 0; - static unsigned long lastScreenChangeTime = 0; - +void loop() { //Refresh display values if(millis() - lastDispRefreshTime >= DISPLAY_REFRESH_INTERVAL) {