web_config.h 1.06 KB
Newer Older
1
2
3
#ifndef AMPEL_WEB_CONFIG_H_
#define AMPEL_WEB_CONFIG_H_

Eric Duminil's avatar
Eric Duminil committed
4
5
#define STRING_LEN 64

6
7
8
9
10
11
#if defined(ESP8266)
#  include <ESP8266WebServer.h>
#elif defined(ESP32)
#  include <WebServer.h>
#endif

Eric Duminil's avatar
Eric Duminil committed
12
namespace config {
Eric Duminil's avatar
Eric Duminil committed
13
  extern uint16_t *csv_interval; // [s]
Eric Duminil's avatar
Eric Duminil committed
14
15
16
17
18
19
20

  // Sensor
  extern uint16_t *measurement_timestep; // [s] Value between 2 and 1800 (range for SCD30 sensor).
  extern uint16_t *altitude_above_sea_level; // [m]
  extern uint16_t *co2_calibration_level; // [ppm]
  extern bool *auto_calibrate_sensor; // [true / false]
  extern float *temperature_offset; // [K] Sign isn't relevant.
Eric Duminil's avatar
Eric Duminil committed
21
22
23
24

  // LED
  extern uint8_t *max_brightness;
  extern uint8_t *min_brightness;
25
  extern uint16_t *led_count;
Eric Duminil's avatar
Eric Duminil committed
26
27
}

28
29
namespace web_config {
  void initialize();
Eric Duminil's avatar
Eric Duminil committed
30
31
  void setWifiConnectionCallback(void (*function)());
  void setWifiConnectionFailedCallback(void (*function)());
32
  void update();
Eric Duminil's avatar
Eric Duminil committed
33
  //TODO: Add saveConfig(), for e.g. after custom setters. Or simply reset after each configchange?
Eric Duminil's avatar
Eric Duminil committed
34
35
36
37
38
39

#if defined(ESP8266)
  extern ESP8266WebServer http;
#elif defined(ESP32)
  extern WebServer http;
#endif
40
41
}
#endif