Skip to content

Commit f043012

Browse files
committed
Print date in log
Fix for #440
1 parent 37b9da2 commit f043012

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Firmware/RTK_Surveyor/menuMessages.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,15 @@ void beginLogging(const char *customFileName)
539539
createNMEASentence(CUSTOM_NMEA_TYPE_DEVICE_BT_ID, nmeaMessage, sizeof(nmeaMessage), macAddress); //textID, buffer, sizeOfBuffer, text
540540
ubxFile->println(nmeaMessage);
541541

542+
//Record today's time/date into log. This is incase a log is restarted. See issue 440: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/440
543+
char currentDate[sizeof("230101,120101")];
544+
snprintf(currentDate, sizeof(currentDate), "%02d%02d%02d,%02d%02d%02d",
545+
rtc.getYear() - 2000, rtc.getMonth() + 1, rtc.getDay(), //ESP32Time returns month:0-11
546+
rtc.getHour(true), rtc.getMinute(), rtc.getSecond() //ESP32Time getHour(true) returns hour:0-23
547+
);
548+
createNMEASentence(CUSTOM_NMEA_TYPE_CURRENT_DATE, nmeaMessage, sizeof(nmeaMessage), currentDate); //textID, buffer, sizeOfBuffer, text
549+
ubxFile->println(nmeaMessage);
550+
542551
if (reuseLastLog == true)
543552
{
544553
systemPrintln("Appending last available log");

Firmware/RTK_Surveyor/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ typedef enum
131131
CUSTOM_NMEA_TYPE_LOGTEST_STATUS,
132132
CUSTOM_NMEA_TYPE_DEVICE_BT_ID,
133133
CUSTOM_NMEA_TYPE_PARSER_STATS,
134+
CUSTOM_NMEA_TYPE_CURRENT_DATE,
134135
} customNmeaType_e;
135136

136137
//Freeze and blink LEDs if we hit a bad error

0 commit comments

Comments
 (0)