Skip to content

Commit

Permalink
Little fs log file
Browse files Browse the repository at this point in the history
  • Loading branch information
gemi254 committed Dec 15, 2024
1 parent 755096c commit 2fda146
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ void setup()
Serial.begin(115200);
Serial.print("\n\n\n\n");
Serial.flush();
LOG_I("* * * * Starting v%s * * * * * \n", APP_VER);

// Measure bat with no wifi enabled
adcVolt = readBatteryADC();

// Enable configAssist logPrint to file?
logToFile = conf("logFile").toInt();

LOG_I("* * * * Starting v%s * * * * * \n", APP_VER);
// Measure bat with no wifi enabled
adcVolt = readBatteryADC();

// Check free space and delete old files if needed
checkLogRotate();

Expand Down Expand Up @@ -366,7 +366,11 @@ void _log_printf(const char *format, ...){
//size_t msgLen = strlen(outBuf);
Serial.print(outBuf);
if (logToFile){
#ifdef CA_USE_LITTLEFS
if(!logFile) logFile = STORAGE.open(LOGGER_LOG_FILENAME, "a+", true);
#else
if(!logFile) logFile = STORAGE.open(LOGGER_LOG_FILENAME, "a+");
#endif
if(!logFile){
Serial.printf("Failed to open log file: %s\n", LOGGER_LOG_FILENAME);
logToFile = false;
Expand Down

0 comments on commit 2fda146

Please sign in to comment.