Skip to content

Commit 6d2a730

Browse files
authored
Merge pull request #135 from kirk-sfe/main
minor refactor of header output logic, added header output token for …
2 parents 0968f4c + 00043b1 commit 6d2a730

File tree

4 files changed

+273
-227
lines changed

4 files changed

+273
-227
lines changed

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ const int FIRMWARE_VERSION_MINOR = 3;
154154

155155
//#define noPowerLossProtection // Uncomment this line to disable the sleep-on-power-loss functionality
156156

157+
#include "Sensors.h"
158+
157159
#include "settings.h"
158160

159161
//Define the pin functions
@@ -545,7 +547,13 @@ void setup() {
545547
else
546548
SerialPrintln(F("No Qwiic devices detected"));
547549

548-
if (settings.showHelperText == true) printHelperText(false); //printHelperText to terminal and sensor file
550+
// KDB add
551+
// If we are streaming to Serial, start the stream with a Mime Type marker, followed by CR
552+
SerialPrintln(F("Content-Type: text/csv"));
553+
SerialPrintln("");
554+
555+
if (settings.showHelperText == true)
556+
printHelperText(OL_OUTPUT_SERIAL | OL_OUTPUT_SDCARD); //printHelperText to terminal and sensor file
549557

550558
//If we are sleeping between readings then we cannot rely on millis() as it is powered down
551559
//Use RTC instead
@@ -705,7 +713,7 @@ void loop() {
705713
}
706714
#endif
707715

708-
getData(); //Query all enabled sensors for data
716+
getData(outputData, sizeof(outputData)); //Query all enabled sensors for data
709717

710718
//Print to terminal
711719
if (settings.enableTerminalOutput == true)
@@ -750,7 +758,8 @@ void loop() {
750758
sensorDataFile.close();
751759
strcpy(sensorDataFileName, findNextAvailableLog(settings.nextDataLogNumber, "dataLog"));
752760
beginDataLogging(); //180ms
753-
if (settings.showHelperText == true) printHelperText(false); //printHelperText to terminal and sensor file
761+
if (settings.showHelperText == true)
762+
printHelperText(OL_OUTPUT_SDCARD); //printHelperText to the sensor file
754763
}
755764
if (online.serialLogging == true)
756765
{

Firmware/OpenLog_Artemis/Sensors.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
3+
#pragma once
4+
5+
// Flags for output destinations
6+
7+
#define OL_OUTPUT_SERIAL 0x1
8+
#define OL_OUTPUT_SDCARD 0x2
9+
10+
void printHelperText(uint8_t);
11+
void getData(char *buffer, size_t lenBuffer);
12+

0 commit comments

Comments
 (0)