Skip to content

Commit 9193f9d

Browse files
committed
Fix RTC month reporting (library reports months 0-11)
1 parent a3f8ab5 commit 9193f9d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const int FIRMWARE_VERSION_MINOR = 10;
5252

5353
#define COMPILE_WIFI //Comment out to remove all WiFi functionality
5454
#define COMPILE_BT //Comment out to disable all Bluetooth
55-
#define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
55+
//#define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
5656

5757
//Define the RTK board identifier:
5858
// This is an int which is unique to this variant of the RTK Surveyor hardware which allows us
@@ -623,7 +623,7 @@ void updateRTC()
623623
online.rtc = true;
624624

625625
Serial.print(F("System time set to: "));
626-
Serial.println(rtc.getTime("%B %d %Y %H:%M:%S")); //From ESP32Time library example
626+
Serial.println(rtc.getDateTime(true));
627627

628628
recordSystemSettingsToFile(); //This will re-record the setting file with current date/time.
629629
}

Firmware/RTK_Surveyor/menuMessages.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ void beginLogging()
320320
{
321321
sprintf(fileName, "%s_%02d%02d%02d_%02d%02d%02d.ubx", //SdFat library
322322
platformFilePrefix,
323-
rtc.getYear() - 2000, rtc.getMonth(), rtc.getDay(),
323+
rtc.getYear() - 2000, rtc.getMonth() + 1, rtc.getDay(), //ESP32Time returns month:0-11
324324
rtc.getHour(), rtc.getMinute(), rtc.getSecond()
325325
);
326326
}
@@ -401,16 +401,17 @@ void updateDataFileAccess(SdFile *dataFile)
401401
{
402402
if (online.rtc == true)
403403
{
404-
dataFile->timestamp(T_ACCESS, rtc.getYear(), rtc.getMonth(), rtc.getDay(), rtc.getHour(), rtc.getMinute(), rtc.getSecond());
405-
dataFile->timestamp(T_WRITE, rtc.getYear(), rtc.getMonth(), rtc.getDay(), rtc.getHour(), rtc.getMinute(), rtc.getSecond());
404+
//ESP32Time returns month:0-11
405+
dataFile->timestamp(T_ACCESS, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(), rtc.getMinute(), rtc.getSecond());
406+
dataFile->timestamp(T_WRITE, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(), rtc.getMinute(), rtc.getSecond());
406407
}
407408
}
408409

409410
//Update the file create time with date and time obtained from GNSS
410411
void updateDataFileCreate(SdFile *dataFile)
411412
{
412413
if (online.rtc == true)
413-
dataFile->timestamp(T_CREATE, rtc.getYear(), rtc.getMonth(), rtc.getDay(), rtc.getHour(), rtc.getMinute(), rtc.getSecond());
414+
dataFile->timestamp(T_CREATE, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(), rtc.getMinute(), rtc.getSecond()); //ESP32Time returns month:0-11
414415
}
415416

416417
//Finds last log

0 commit comments

Comments
 (0)