diff --git a/Dashboard/Dashboard.ino b/Dashboard/Dashboard.ino index 71deeb8c61c08e4b8725791ffa37f88c8e8a2f66..f03a8026d83471cb837c9fd04b6845264b6a258a 100644 --- a/Dashboard/Dashboard.ino +++ b/Dashboard/Dashboard.ino @@ -22,11 +22,11 @@ Service Desk: gitlab+egorguslyan-dashboard-851-issue-@edugit.org */ -#define DEBUG 0 +#define DEBUG 1 #if(DEBUG) #define START_DEBUGGING Serial.begin(9600) #define PRINT_DEBUG(x) Serial.print(x) - #define PRINTLN_DEBUG(x) Serial.print(x) + #define PRINTLN_DEBUG(x) Serial.println(x) #define STOP_DEBUGGING Serial.end() #define WAIT_DEBUGGER while(!Serial.available()) {} #else @@ -295,6 +295,7 @@ void loop() TIMER(timer_debug0, 5000) { timer_debug0 = millis(); + PRINTLN_DEBUG(F("Debugging stopped")); STOP_DEBUGGING; } @@ -304,15 +305,18 @@ void loop() TIMER(timer0, 5000) { timer0 = millis(); + PRINT_DEBUG(F("Measured CO2")); TIMER(timer1, 1800000) { timer1 = millis(); globalVars.freshPPM++; if(globalVars.freshPPM == WIDTH) globalVars.freshPPM = 0; + PRINT_DEBUG(F(" and shifted array")); } globalVars.ppm[globalVars.freshPPM] = co2.getPPM(); if(globalVars.ppm[globalVars.freshPPM] > globalVars.maxPPM) globalVars.maxPPM = globalVars.ppm; if(globalVars.ppm[globalVars.freshPPM] < globalVars.minPPM) globalVars.minPPM = globalVars.ppm; + PRINTLN_DEBUG(); } // Notify when ppm is high @@ -322,6 +326,7 @@ void loop() if(ppmFlag && (globalVars.ppm > globalVars.maxPPM - 100)) TIMER(timer2, HIGH_PPM_TIMEOUT) { globalVars.longBeep = true; + PRINTLN_DEBUG(F("Notified")); } // Update time every second @@ -329,6 +334,7 @@ void loop() static DateTime DTtmp; TIMER(timer3, 999) { + PRINTLN_DEBUG(F("Time updated")); DTtmp = rtc.getTime(); globalVars.hours = DTtmp.hour % TIME_FORMAT; #if(OVERFLOW_WITHOUT_ZERO) @@ -346,12 +352,15 @@ void loop() TIMER(timer4, 10) { timer4 = millis(); + PRINTLN_DEBUG(F("Buttons readed")); buttons(); } // Update pomodoro timer if(globalVars.pomodoroRunning) TIMER(globalVars.pomodoroTimer, 1000) { + globalVars.pomodoroTimer = millis(); + PRINTLN_DEBUG(F("Updated pomodoro")); if(globalVars.pomodoroSeconds == 0) { if(globalVars.pomodoroMinutes == 0) @@ -374,11 +383,14 @@ void loop() switch(globalVars.prepare) { case 1: + PRINTLN_DEBUG(F("Prepared")); screens[globalVars.currentScreen].funcPrepare(); case 2: + PRINTLN_DEBUG(F("Animated")); animate(50); break; case 0: + PRINTLN_DEBUG(F("Screen")); screens[globalVars.currentScreen].func(&screens[globalVars.currentScreen].arg); break; } @@ -387,6 +399,7 @@ void loop() // Monthly preventative safe reset of the millis() timer TIMER(0, 3456000000) { + PRINTLN_DEBUG(F("Timers reset")); noInterrupts(); timer0_millis = 0; timer0_overflow_count = 0;