Skip to content

Commit f0280eb

Browse files
committed
v1.2.4 changed moment of writing to RING-files
1 parent 20122af commit f0280eb

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

DSMRloggerAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ String pTimestamp;
230230
DECLARE_TIMER_SEC(updateSeconds, 1, CATCH_UP_MISSED_TICKS);
231231
DECLARE_TIMER_SEC(updateDisplay, 5);
232232
DECLARE_TIMER_MIN(reconnectWiFi, 30);
233-
DECLARE_TIMER_SEC(synchrNTP, 30);
233+
DECLARE_TIMER_MIN(synchrNTP, 10, SKIP_MISSED_TICKS);
234234
DECLARE_TIMER_SEC(nextTelegram, 10);
235235
DECLARE_TIMER_MIN(reconnectMQTTtimer, 2); // try reconnecting cyclus timer
236236
DECLARE_TIMER_SEC(publishMQTTtimer, 60, SKIP_MISSED_TICKS); // interval time between MQTT messages

DSMRloggerAPI.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
***************************************************************************
33
** Program : DSMRloggerAPI (restAPI)
44
*/
5-
#define _FW_VERSION "v1.2.4 (11-04-2020)"
5+
#define _FW_VERSION "v1.2.4 (16-04-2020)"
66
/*
77
** Copyright (c) 2020 Willem Aandewiel
88
**
@@ -12,6 +12,7 @@
1212
Arduino-IDE settings for DSMR-logger Version 4 (ESP-12):
1313
1414
- Board: "Generic ESP8266 Module"
15+
- Builtin Led: "2"
1516
- Flash mode: "DOUT" | "DIO" // change only after power-off and on again!
1617
- Flash size: "4MB (FS: 2MB OAT:~1019KB)" << LET OP! 2MB SPIFFS
1718
- DebugT port: "Disabled"
@@ -21,7 +22,7 @@
2122
- Crystal Frequency: "26 MHz"
2223
- VTables: "Flash"
2324
- Flash Frequency: "40MHz"
24-
- CPU Frequency: "80 MHz"
25+
- CPU Frequency: "80 MHz" (or 160MHz)
2526
- Buildin Led: "2" // GPIO02 for Wemos and ESP-12
2627
- Upload Speed: "115200"
2728
- Erase Flash: "Only Sketch"
@@ -604,12 +605,12 @@ void loop ()
604605
#if defined(USE_NTP_TIME) //USE_NTP
605606
if DUE(synchrNTP) //USE_NTP
606607
{
607-
if (timeStatus() == timeNeedsSync || prevNtpHour != hour()) //USE_NTP
608-
{
609-
prevNtpHour = hour(); //USE_NTP
608+
//if (timeStatus() == timeNeedsSync || prevNtpHour != hour()) //USE_NTP
609+
//{
610+
//prevNtpHour = hour(); //USE_NTP
610611
setSyncProvider(getNtpTime); //USE_NTP
611612
setSyncInterval(600); //USE_NTP
612-
}
613+
//}
613614
}
614615
#endif //USE_NTP
615616

SPIFFSstuff.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ void writeDataToFiles()
209209
recSlot = timestampToHourSlot(actTimestamp, strlen(actTimestamp));
210210
if (Verbose1) DebugTf("HOURS: Write to slot[%02d] in %s\r\n", recSlot, HOURS_FILE);
211211
writeDataToFile(HOURS_FILE, record, recSlot, HOURS);
212-
212+
writeToSysLog("HOURS: actTimestamp[%s], recSlot[%d]", actTimestamp, recSlot);
213+
213214
// update DAYS
214215
recSlot = timestampToDaySlot(actTimestamp, strlen(actTimestamp));
215216
if (Verbose1) DebugTf("DAYS: Write to slot[%02d] in %s\r\n", recSlot, DAYS_FILE);

processTelegram.ino

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,22 @@ void processTelegram()
2929

3030
strcpy(newTimestamp, DSMRdata.timestamp.c_str());
3131

32-
newT = epoch(newTimestamp, strlen(newTimestamp), true); // update system time
32+
newT = epoch(newTimestamp, strlen(newTimestamp), false); // do NOT update system time
3333
actT = epoch(actTimestamp, strlen(actTimestamp), false);
3434

3535
// Skip first 3 telegrams .. just to settle down a bit ;-)
3636

3737
if ((int32_t)(telegramCount - telegramErrors) < 3)
3838
{
39+
strCopy(actTimestamp, sizeof(actTimestamp), newTimestamp);
40+
actT = epoch(actTimestamp, strlen(actTimestamp), true); // update system time
3941
return;
4042
}
4143

42-
strCopy(actTimestamp, sizeof(actTimestamp), newTimestamp); // maar nog NIET actT!!!
4344
DebugTf("actHour[%02d] -- newHour[%02d]\r\n", hour(actT), hour(newT));
44-
45+
if (hour(actT) != hour(newT)) {
46+
writeToSysLog("actHour[%02d] -- newHour[%02d]", hour(actT), hour(newT));
47+
}
4548
// has the hour changed (or the day or month)
4649
// in production testing on hour only would
4750
// suffice, but in testing I need all three
@@ -59,6 +62,9 @@ void processTelegram()
5962
sendMQTTData();
6063
}
6164

65+
strCopy(actTimestamp, sizeof(actTimestamp), newTimestamp);
66+
actT = epoch(actTimestamp, strlen(actTimestamp), true); // update system time
67+
6268
} // processTelegram()
6369

6470

0 commit comments

Comments
 (0)