mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Fix statLoopCounter overflow
This commit is contained in:
parent
2e7a772668
commit
35975131b3
@ -29,7 +29,7 @@ uint8_t mainLoopCounter = 0;
|
|||||||
unsigned long mainLastLoopTime = 0;
|
unsigned long mainLastLoopTime = 0;
|
||||||
|
|
||||||
#ifdef HASP_USE_STAT_COUNTER
|
#ifdef HASP_USE_STAT_COUNTER
|
||||||
uint8_t statLoopCounter = 0; // measures the average looptime
|
uint16_t statLoopCounter = 0; // measures the average looptime
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
|
@ -46,6 +46,10 @@ bool isRunning = 1;
|
|||||||
uint8_t mainLoopCounter = 0;
|
uint8_t mainLoopCounter = 0;
|
||||||
unsigned long mainLastLoopTime = 0;
|
unsigned long mainLastLoopTime = 0;
|
||||||
|
|
||||||
|
#ifdef HASP_USE_STAT_COUNTER
|
||||||
|
uint16_t statLoopCounter = 0; // measures the average looptime
|
||||||
|
#endif
|
||||||
|
|
||||||
extern uint16_t tft_width;
|
extern uint16_t tft_width;
|
||||||
extern uint16_t tft_height;
|
extern uint16_t tft_height;
|
||||||
|
|
||||||
@ -168,6 +172,10 @@ void loop()
|
|||||||
custom_loop();
|
custom_loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HASP_USE_STAT_COUNTER
|
||||||
|
statLoopCounter++; // measures the average looptime
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Timer Loop */
|
/* Timer Loop */
|
||||||
if(millis() - mainLastLoopTime >= 1000) {
|
if(millis() - mainLastLoopTime >= 1000) {
|
||||||
/* Runs Every Second */
|
/* Runs Every Second */
|
||||||
@ -179,7 +187,7 @@ void loop()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HASP_USE_CUSTOM)
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_every_second();
|
custom_every_second();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Runs Every 5 Seconds */
|
/* Runs Every 5 Seconds */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user