Skip to content

Commit 1718b55

Browse files
committed
Correct save of localUTCOffset
1 parent 265ce38 commit 1718b55

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,12 @@
112112
v2.2:
113113
Use Apollo3 v2.2.0 with changes by paulvha to fix Issue 117 (Thank you Paul!)
114114
https://github.com/sparkfun/OpenLog_Artemis/issues/117#issuecomment-1034973065
115+
Also includes Paul's SPI.end fix
116+
https://github.com/sparkfun/Arduino_Apollo3/issues/442
115117
Use SdFat v2.1.2
116118
Compensate for missing / not-populated IMU
117119
Add support for yyyy/mm/dd and ISO 8601 date style (Issue 118)
120+
Add support for fractional time zone offsets
118121
*/
119122

120123
const int FIRMWARE_VERSION_MAJOR = 2;
@@ -195,7 +198,7 @@ TwoWire qwiic(PIN_QWIIC_SDA,PIN_QWIIC_SCL); //Will use pads 8/9
195198
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
196199
#include <SPI.h>
197200

198-
#include <SdFat.h> //SdFat v2.0.7 by Bill Greiman: http://librarymanager/All#SdFat_exFAT
201+
#include <SdFat.h> //SdFat by Bill Greiman: http://librarymanager/All#SdFat_exFAT
199202

200203
#define SD_FAT_TYPE 3 // SD_FAT_TYPE = 0 for SdFat/File, 1 for FAT16/FAT32, 2 for exFAT, 3 for FAT16/FAT32 and exFAT.
201204
#define SD_CONFIG SdSpiConfig(PIN_MICROSD_CHIP_SELECT, SHARED_SPI, SD_SCK_MHZ(24)) // 24MHz
@@ -375,6 +378,8 @@ void setup() {
375378

376379
enableCIPOpullUp(); // Enable CIPO pull-up _after_ beginSD
377380

381+
beginIMU(); //61ms
382+
378383
loadSettings(); //50 - 250ms
379384

380385
if (settings.useTxRxPinsForTerminal == true)
@@ -439,8 +444,6 @@ void setup() {
439444
beginSerialOutput(); // Begin serial data output on the TX pin
440445
}
441446

442-
beginIMU(); //61ms
443-
444447
if (online.microSD == true) SerialPrintln(F("SD card online"));
445448
else SerialPrintln(F("SD card offline"));
446449

@@ -1236,6 +1239,7 @@ void beginDataLogging()
12361239
}
12371240

12381241
updateDataFileCreate(&sensorDataFile); // Update the file create time & date
1242+
sensorDataFile.sync();
12391243

12401244
online.dataLogging = true;
12411245
}
@@ -1260,6 +1264,7 @@ void beginSerialLogging()
12601264
}
12611265

12621266
updateDataFileCreate(&serialDataFile); // Update the file create time & date
1267+
serialDataFile.sync();
12631268

12641269
//We need to manually restore the Serial1 TX and RX pins
12651270
configureSerial1TxRx();

Firmware/OpenLog_Artemis/nvm.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void recordSystemSettingsToFile()
135135
settingsFile.println("logA13=" + (String)settings.logA13);
136136
settingsFile.println("logA32=" + (String)settings.logA32);
137137
settingsFile.println("logAnalogVoltages=" + (String)settings.logAnalogVoltages);
138-
settingsFile.println("localUTCOffset=" + (String)settings.localUTCOffset);
138+
settingsFile.print("localUTCOffset="); settingsFile.println(settings.localUTCOffset);
139139
settingsFile.println("printDebugMessages=" + (String)settings.printDebugMessages);
140140
settingsFile.println("powerDownQwiicBusBetweenReads=" + (String)settings.powerDownQwiicBusBetweenReads);
141141
settingsFile.println("qwiicBusMaxSpeed=" + (String)settings.qwiicBusMaxSpeed);
@@ -217,6 +217,7 @@ bool loadSystemSettingsFromFile()
217217
{
218218
//If we can't read the first line of the settings file, give up
219219
SerialPrintln(F("Giving up on settings file"));
220+
settingsFile.close();
220221
return (false);
221222
}
222223
}
@@ -226,6 +227,7 @@ bool loadSystemSettingsFromFile()
226227
{
227228
//If we can't read the first line of the settings file, give up
228229
SerialPrintln(F("Giving up on settings file"));
230+
settingsFile.close();
229231
return (false);
230232
}
231233
}
@@ -836,7 +838,7 @@ bool loadDeviceSettingsFromFile()
836838
}
837839

838840
//SerialPrintln(F("Device config file read complete"));
839-
updateDataFileAccess(&settingsFile); // Update the file access time & date
841+
//updateDataFileAccess(&settingsFile); // Update the file access time & date
840842
settingsFile.close();
841843
return (true);
842844
}

0 commit comments

Comments
 (0)