You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ((millis() - oldTime > minSendIntervall) && AlarmMode_Enabled) //Debouncing/Entprellung Switch - The millis() function will overflow (go back to zero), after approximately 50 days. (Max value = 4.294.967.295)
23
+
if ((millis() - oldTime > minSendIntervall) && AlarmMode_Enabled) //Limit for sending Lora Packages - The millis() function will overflow (go back to zero), after approximately 50 days. (Max value = 4.294.967.295)
22
24
{
23
25
if (watchdog == 0) // Real Alarm?
24
26
{
25
-
LoRaWANDo(); // Run os_runloop_once() for LMIC OS
26
-
27
-
if (!os_queryTimeCriticalJobs(ms2osticks(500)))
27
+
if (!os_queryTimeCriticalJobs(ms2osticks(300)))
28
28
{
29
-
// Queue Lora Package
30
-
LoRaWANDo_send(&sendjob); // Send Alarm Message
29
+
os_clearCallback(&sendjob); // Clear the SendQueue
sended_AlarmPackages++; // Counter for sended Alarm Packages
34
37
35
-
oldTime = millis(); // Remember last run time.
36
-
minSendIntervall = 600000; // Intervall to Send Alarm Pakages in ms 600000=10min - From here on, an alarm message is only sent every x ms.
38
+
if (sended_AlarmPackages <= 2) // Send n AlarmPackages to TTN with fast Intervall
39
+
{
40
+
minSendIntervall = 30000; // Fast Intervall 30 Sek
41
+
}
42
+
else
43
+
{
44
+
minSendIntervall = 600000; // If the door remains permanently open: Intervall to Send Alarm Pakages in ms 600000=10min - From here on, an alarm message is only sent every x ms.
45
+
}
37
46
}
38
47
}
39
48
}
@@ -47,16 +56,15 @@ void CheckDoorStateForAlarm()
47
56
}
48
57
else// Door is closed
49
58
{
50
-
door_counter = -1;
51
-
door_state = 1;
52
-
minSendIntervall = 180000; //Intervall to Send Alarm Pakages in ms 180000=3min -> If door is closed reset to fast SendIntervall
59
+
resetToDefaultValues();
60
+
minSendIntervall = 180000; // Intervall to Send Alarm Pakages in ms 180000=3min -> If door is closed reset to normal SendIntervall
0 commit comments