Commit 3ae4adb6 authored by Eric Duminil's avatar Eric Duminil
Browse files

CSV interval

parent 0dad2457
......@@ -86,6 +86,14 @@ namespace csv_writer {
return getTotalSpace() - getUsedSpace();
}
void setCSVinterval(int32_t csv_interval) {
config::csv_interval = csv_interval;
Serial.print(F("Setting CSV Interval to : "));
Serial.print(config::csv_interval);
Serial.println("s.");
led_effects::showKITTWheel(color::green, 1);
}
void initialize() {
Serial.print(F("Initializing FS..."));
if (mountFS()) {
......@@ -116,6 +124,8 @@ namespace csv_writer {
Serial.println("Filesystem content:");
showFilesystemContent();
Serial.println();
sensor_commands::defineCallback("csv", setCSVinterval);
}
File openOrCreate() {
......
......@@ -14,6 +14,7 @@
#include "config.h"
#include "util.h"
#include "led_effects.h"
#include "sensor_commands.h"
namespace config {
extern uint16_t csv_interval; // [s]
......
......@@ -64,17 +64,6 @@ namespace mqtt {
led_effects::showKITTWheel(color::green, 1);
}
#ifdef AMPEL_CSV
void setCSVinterval(String messageString) {
messageString.replace("csv ", "");
config::csv_interval = messageString.toInt();
Serial.print(F("Setting CSV Interval to : "));
Serial.print(config::csv_interval);
Serial.println("s.");
led_effects::showKITTWheel(color::green, 1);
}
#endif
void calibrateSensorToSpecificPPM(String messageString) {
messageString.replace("calibrate ", "");
long int calibrationLevel = messageString.toInt();
......@@ -135,8 +124,6 @@ namespace mqtt {
Serial.println(F("Forcing MQTT publish now."));
publish(sensor::timestamp, sensor::co2, sensor::temperature, sensor::humidity);
#ifdef AMPEL_CSV
} else if (messageString.startsWith("csv ")) {
setCSVinterval(messageString);
} else if (messageString == "format_filesystem") {
FS_LIB.format();
led_effects::showKITTWheel(color::blue, 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment