Timer re-interability fix

This commit is contained in:
2021-07-31 22:01:35 +03:00
parent c2815a2d00
commit 64a2bb7eea
4 changed files with 10 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1609,7 +1609,7 @@ void postTransmission() {
#endif #endif
} }
#define TIMER_INTERVAL_MS 200 // 0.1s = 100ms
volatile unsigned long timerCount=0; volatile unsigned long timerCount=0;
volatile int16_t timerNumber=-1; volatile int16_t timerNumber=-1;
@@ -2074,8 +2074,10 @@ void modbusIdle(void) {
#endif #endif
} }
volatile bool inputLoopBusy = false;
void inputLoop(short cause) { void inputLoop(short cause) {
if (!inputs) return; if (!inputs || inputLoopBusy) return;
inputLoopBusy = true;
configLocked++; configLocked++;
//if (millis() > timerInputCheck) //if (millis() > timerInputCheck)
@@ -2129,6 +2131,7 @@ configLocked++;
timerSensorCheck = millis();// + INTERVAL_CHECK_SENSOR; timerSensorCheck = millis();// + INTERVAL_CHECK_SENSOR;
} }
configLocked--; configLocked--;
inputLoopBusy= false;
} }
@@ -2145,7 +2148,7 @@ configLocked++;
input = input->next; input = input->next;
} }
// Interval in microsecs // Interval in microsecs
attachTimer(TIMER_INTERVAL_MS * 1000, TimerHandler, "ITimer"); attachTimer(TIMER_CHECK_INPUT * 1000, TimerHandler, "ITimer");
#endif #endif
configLocked--; configLocked--;
} }

View File

@@ -100,9 +100,12 @@
*/ */
#ifndef INTERVAL_CHECK_INPUT #ifndef INTERVAL_CHECK_INPUT
#define INTERVAL_CHECK_INPUT 15 #define INTERVAL_CHECK_INPUT 11
#endif #endif
#ifndef TIMER_CHECK_INPUT
#define TIMER_CHECK_INPUT 15
#endif
#ifndef INTERVAL_CHECK_SENSOR #ifndef INTERVAL_CHECK_SENSOR
#define INTERVAL_CHECK_SENSOR 5000 #define INTERVAL_CHECK_SENSOR 5000
#endif #endif