Skip to content

Commit 6ee2be7

Browse files
committed
Add logMicroseconds
1 parent 1afaa12 commit 6ee2be7

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
(done) Add support for the SN-GCJA5 particle sensor
7373
(done) Add IMU accelerometer and gyro full scale and digital low pass filter settings to menuIMU
7474
(done) Add a fix to make sure the MS8607 is detected correctly: https://github.com/sparkfun/OpenLog_Artemis/issues/54
75+
(done) Add logMicroseconds: https://github.com/sparkfun/OpenLog_Artemis/issues/49
7576
*/
7677

7778
const int FIRMWARE_VERSION_MAJOR = 1;

Firmware/OpenLog_Artemis/Sensors.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ void getData()
3535
sprintf(rtcTime, "%02d:%02d:%02d.%02d,", adjustedHour, myRTC.minute, myRTC.seconds, myRTC.hundredths);
3636
strcat(outputData, rtcTime);
3737
}
38+
39+
if (settings.logMicroseconds)
40+
{
41+
char microseconds[11]; //
42+
sprintf(microseconds, "%d,", micros());
43+
strcat(outputData, microseconds);
44+
}
3845
} //end if use RTC for timestamp
3946
else //Use GPS for timestamp
4047
{
@@ -821,6 +828,8 @@ void printHelperText(bool terminalOnly)
821828
strcat(helperText, "rtcDate,");
822829
if (settings.logTime)
823830
strcat(helperText, "rtcTime,");
831+
if (settings.logMicroseconds)
832+
strcat(helperText, "micros,");
824833
}
825834
} //end if use RTC for timestamp
826835
else //Use GPS for timestamp

Firmware/OpenLog_Artemis/menuTimeStamp.ino

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ void menuTimeStamp()
6464
}
6565
Serial.print(F("9) Local offset from UTC: "));
6666
Serial.println(settings.localUTCOffset);
67-
67+
6868
}
6969

70+
Serial.print(F("10) Log Microseconds: "));
71+
if (settings.logMicroseconds == true) Serial.println(F("Enabled"));
72+
else Serial.println(F("Disabled"));
73+
7074
Serial.println(F("x) Exit"));
7175

7276
int incoming = getNumber(menuTimeout); //Timeout after x seconds
@@ -75,12 +79,14 @@ void menuTimeStamp()
7579
settings.logDate ^= 1;
7680
else if (incoming == 2)
7781
settings.logTime ^= 1;
82+
else if (incoming == 10)
83+
settings.logMicroseconds ^= 1;
7884
else if (incoming == STATUS_PRESSED_X)
7985
return;
8086
else if (incoming == STATUS_GETNUMBER_TIMEOUT)
8187
return;
8288

83-
if (settings.logDate == true || settings.logTime == true)
89+
if ((settings.logDate == true) || (settings.logTime == true))
8490
{
8591
//Options 3, 8, 9
8692
if (incoming == 3)

Firmware/OpenLog_Artemis/nvm.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ void recordSystemSettingsToFile()
154154
settingsFile.println("imuAccDLPFBW=" + (String)settings.imuAccDLPFBW);
155155
settingsFile.println("imuGyroFSS=" + (String)settings.imuGyroFSS);
156156
settingsFile.println("imuGyroDLPFBW=" + (String)settings.imuGyroDLPFBW);
157+
settingsFile.println("logMicroseconds=" + (String)settings.logMicroseconds);
157158
updateDataFileAccess(&settingsFile); // Update the file access time & date
158159
settingsFile.close();
159160
}
@@ -394,6 +395,8 @@ bool parseLine(char* str) {
394395
settings.imuGyroFSS = d;
395396
else if (strcmp(settingName, "imuGyroDLPFBW") == 0)
396397
settings.imuGyroDLPFBW = d;
398+
else if (strcmp(settingName, "logMicroseconds") == 0)
399+
settings.logMicroseconds = d;
397400
else
398401
Serial.printf("Unknown setting %s on line: %s\r\n", settingName, str);
399402

Firmware/OpenLog_Artemis/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ struct struct_settings {
349349
int imuAccDLPFBW = 7; // IMU accelerometer DLPF bandwidth - default to acc_d473bw_n499bw (ICM_20948_ACCEL_CONFIG_DLPCFG_e)
350350
int imuGyroFSS = 0; // IMU gyro full scale - default to 250 degrees per second (ICM_20948_GYRO_CONFIG_1_FS_SEL_e)
351351
int imuGyroDLPFBW = 7; // IMU gyro DLPF bandwidth - default to gyr_d361bw4_n376bw5 (ICM_20948_GYRO_CONFIG_1_DLPCFG_e)
352+
bool logMicroseconds = false; // Log micros()
352353
} settings;
353354

354355
//These are the devices on board OpenLog that may be on or offline.

0 commit comments

Comments
 (0)