Skip to content

Commit c8f196a

Browse files
committed
minor refactor of header output logic, added header output token for serial output, removed print of header to serial on file change, moved strcat to strlcat
1 parent 6801bbe commit c8f196a

File tree

4 files changed

+272
-227
lines changed

4 files changed

+272
-227
lines changed

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ const int FIRMWARE_VERSION_MINOR = 3;
152152
// the minor firmware version
153153
#define OLA_IDENTIFIER 0x123 // Stored as 291 decimal in OLA_settings.txt
154154

155+
#include "Sensors.h"
155156
#include "settings.h"
156157

157158
//Define the pin functions
@@ -505,7 +506,13 @@ void setup() {
505506
else
506507
SerialPrintln(F("No Qwiic devices detected"));
507508

508-
if (settings.showHelperText == true) printHelperText(false); //printHelperText to terminal and sensor file
509+
// KDB add
510+
// If we are streaming to Serial, start the stream with a Mime Type marker, followed by CR
511+
SerialPrintln(F("Content-Type: text/csv"));
512+
SerialPrintln("");
513+
514+
if (settings.showHelperText == true)
515+
printHelperText(OL_OUTPUT_SERIAL | OL_OUTPUT_SDCARD); //printHelperText to terminal and sensor file
509516

510517
//If we are sleeping between readings then we cannot rely on millis() as it is powered down
511518
//Use RTC instead
@@ -665,7 +672,7 @@ void loop() {
665672
}
666673
#endif
667674

668-
getData(); //Query all enabled sensors for data
675+
getData(outputData, sizeof(outputData)); //Query all enabled sensors for data
669676

670677
//Print to terminal
671678
if (settings.enableTerminalOutput == true)
@@ -710,7 +717,8 @@ void loop() {
710717
sensorDataFile.close();
711718
strcpy(sensorDataFileName, findNextAvailableLog(settings.nextDataLogNumber, "dataLog"));
712719
beginDataLogging(); //180ms
713-
if (settings.showHelperText == true) printHelperText(false); //printHelperText to terminal and sensor file
720+
if (settings.showHelperText == true)
721+
printHelperText(OL_OUTPUT_SDCARD); //printHelperText to the sensor file
714722
}
715723
if (online.serialLogging == true)
716724
{

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)