From 96c573931d40b6b191614c96299d66ca6217d1d8 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Tue, 3 Dec 2024 00:27:57 +0000 Subject: New upstream version 6.0.24.53+repack --- cMain.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'cMain.c') diff --git a/cMain.c b/cMain.c index b63a69c..0238d3b 100644 --- a/cMain.c +++ b/cMain.c @@ -50,6 +50,7 @@ VOID SendSmartID(struct PORTCONTROL * PORT); int CanPortDigi(int Port); int KissEncode(UCHAR * inbuff, UCHAR * outbuff, int len); void MQTTTimer(); +void SaveMH(); #include "configstructs.h" @@ -911,7 +912,7 @@ BOOL Start() PORT->PROTOCOL = (char)PortRec->PROTOCOL; PORT->IOBASE = PortRec->IOADDR; - if (PortRec->SerialPortName[0]) + if (PortRec->SerialPortName && PortRec->SerialPortName[0]) PORT->SerialPortName = _strdup(PortRec->SerialPortName); else { @@ -1507,7 +1508,7 @@ BOOL Start() upnpInit(); - CurrentSecs = lastSlowSecs = time(NULL); + lastSaveSecs = CurrentSecs = lastSlowSecs = time(NULL); return 0; } @@ -2105,7 +2106,19 @@ VOID TIMERINTERRUPT() } */ } - + + // Check Autosave Nodes and MH timer + + if (CurrentSecs - lastSaveSecs >= 3600) // 1 per hour + { + lastSaveSecs = CurrentSecs; + + if (AUTOSAVE == 1) + SaveNodes(); + if (AUTOSAVEMH == 1) + SaveMH(); + } + if (L4TIMERFLAG >= 10) // 1 PER SEC { L4TIMERFLAG -= 10; -- cgit v1.2.3