web_config.h 1.11 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 {
13
  extern uint16_t &csv_interval; // [s]
Eric Duminil's avatar
Eric Duminil committed
14
15

  // Sensor
16
17
18
19
20
  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

  // LED
23
24
25
  extern uint8_t &max_brightness;
  extern uint8_t &min_brightness;
  extern uint16_t &led_count;
Eric Duminil's avatar
Eric Duminil committed
26
27
28

  extern char *ntp_server;
  extern int16_t &time_zone;
Eric Duminil's avatar
Eric Duminil committed
29
30
}

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

#if defined(ESP8266)
  extern ESP8266WebServer http;
#elif defined(ESP32)
  extern WebServer http;
#endif
43
44
}
#endif