csv_writer.h 780 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef CSV_WRITER_H_
#define CSV_WRITER_H_

#if defined(ESP8266)
#  include <LittleFS.h>
#  define FS_LIB LittleFS
#elif defined(ESP32)
#  include <SPIFFS.h>
#  define FS_LIB SPIFFS
#else
#  error Board should be either ESP8266 or ESP832
#endif

#include "config.h"
Eric Duminil's avatar
Eric Duminil committed
15
16
#include "util.h"
#include "led_effects.h"
17
#include "sensor_console.h"
Eric Duminil's avatar
Eric Duminil committed
18

19
namespace config {
Eric Duminil's avatar
Eric Duminil committed
20
  extern uint16_t csv_interval; // [s]
21
22
}
namespace csv_writer {
Eric Duminil's avatar
Eric Duminil committed
23
24
25
  extern char last_successful_write[];
  void initialize(const char *sensorId);
  void logIfTimeHasCome(const char *timestamp, const int16_t &co2, const float &temperature, const float &humidity);
26
  int getAvailableSpace();
Eric Duminil's avatar
Eric Duminil committed
27
  extern char filename[];
28
29

  void setCSVinterval(int32_t csv_interval);
Eric Duminil's avatar
Eric Duminil committed
30
  void showCSVContent();
31
  void formatFilesystem();
32
33
34
}

#endif