Commit 07ebc466 authored by Eric Duminil's avatar Eric Duminil
Browse files

Expect services to be set to true/false in config

No related merge requests found
Pipeline #5776 passed with stage
in 2 minutes and 11 seconds
Showing with 11 additions and 14 deletions
+11 -14
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
* SERVICES * SERVICES
*/ */
// Comment or remove those lines if you want to disable the corresponding services // Define the default for corresponding services. They can be enabled/disabled later in the web-config.
# define AMPEL_WIFI // Should ESP connect to WiFi? It allows the Ampel to get time from an NTP server. # define AMPEL_WIFI true // Should ESP connect to WiFi? It allows the Ampel to get time from an NTP server.
# define AMPEL_HTTP // Should HTTP web server be started? (AMPEL_WIFI should be enabled too) # define AMPEL_HTTP true // Should HTTP web server be started? (AMPEL_WIFI should be enabled too)
# define AMPEL_MQTT // Should data be sent over MQTT? (AMPEL_WIFI should be enabled too) # define AMPEL_MQTT true // Should data be sent over MQTT? (AMPEL_WIFI should be enabled too)
# define AMPEL_CSV // Should data be logged as CSV, on the ESP flash memory? # define AMPEL_CSV true // Should data be logged as CSV, on the ESP flash memory?
// # define AMPEL_LORAWAN // Should data be sent over LoRaWAN? (Requires ESP32 + LoRa modem, and "MCCI LoRaWAN LMIC library") # define AMPEL_LORAWAN false // Should data be sent over LoRaWAN? (Requires ESP32 + LoRa modem, and "MCCI LoRaWAN LMIC library")
/** /**
* WIFI * WIFI
......
...@@ -34,7 +34,8 @@ namespace web_config { ...@@ -34,7 +34,8 @@ namespace web_config {
/** /**
* WiFi params * WiFi params
*/ */
CheckboxTParameter ampelWifiParam = Builder<CheckboxTParameter>("WiFi").label("WiFi?").defaultValue(true).build(); CheckboxTParameter ampelWifiParam =
Builder<CheckboxTParameter>("WiFi").label("WiFi?").defaultValue(AMPEL_WIFI).build();
IntTParameter<uint16_t> wifiTimeoutParam = IntTParameter<uint16_t> wifiTimeoutParam =
Builder<IntTParameter<uint16_t>>("wifi_timeout").label("WiFi timeout").defaultValue(WIFI_TIMEOUT).min(0).placeholder( Builder<IntTParameter<uint16_t>>("wifi_timeout").label("WiFi timeout").defaultValue(WIFI_TIMEOUT).min(0).placeholder(
"[s]").build(); "[s]").build();
...@@ -87,7 +88,7 @@ namespace web_config { ...@@ -87,7 +88,7 @@ namespace web_config {
/** /**
* CSV * CSV
*/ */
OptionalParameterGroup csvParams = OptionalParameterGroup("CSV", "CSV", true); OptionalParameterGroup csvParams = OptionalParameterGroup("CSV", "CSV", AMPEL_CSV);
IntTParameter<uint16_t> csvTimestepParam = IntTParameter<uint16_t> csvTimestepParam =
Builder<IntTParameter<uint16_t>>("csv_timestep").label("CSV timestep").defaultValue(CSV_INTERVAL).min(0).step(1).placeholder( Builder<IntTParameter<uint16_t>>("csv_timestep").label("CSV timestep").defaultValue(CSV_INTERVAL).min(0).step(1).placeholder(
...@@ -96,16 +97,12 @@ namespace web_config { ...@@ -96,16 +97,12 @@ namespace web_config {
/** /**
* MQTT * MQTT
*/ */
OptionalParameterGroup mqttParams = OptionalParameterGroup("MQTT", "MQTT", true); OptionalParameterGroup mqttParams = OptionalParameterGroup("MQTT", "MQTT", AMPEL_MQTT);
IntTParameter<uint16_t> mqttTimestepParam = IntTParameter<uint16_t> mqttTimestepParam =
Builder<IntTParameter<uint16_t>>("mqtt_timestep").label("MQTT timestep").defaultValue( Builder<IntTParameter<uint16_t>>("mqtt_timestep").label("MQTT timestep").defaultValue(
MQTT_SENDING_INTERVAL).min(0).step(1).defaultValue(300).placeholder("[s]").build(); MQTT_SENDING_INTERVAL).min(0).step(1).defaultValue(300).placeholder("[s]").build();
#if !defined(MQTT_ENCRYPTED)
# define MQTT_ENCRYPTED true // Old config files might not define it, and encryption was on by default.
#endif
CheckboxTParameter mqttEncryptionParam = CheckboxTParameter mqttEncryptionParam =
Builder<CheckboxTParameter>("mqtt_encryption").label("Encrypt MQTT?").defaultValue(MQTT_ENCRYPTED).build(); Builder<CheckboxTParameter>("mqtt_encryption").label("Encrypt MQTT?").defaultValue(MQTT_ENCRYPTED).build();
...@@ -144,7 +141,7 @@ namespace web_config { ...@@ -144,7 +141,7 @@ namespace web_config {
/** /**
* LoRa & Stuff * LoRa & Stuff
*/ */
OptionalParameterGroup loraParams = OptionalParameterGroup("LoRaWan", "LoRaWan", false); OptionalParameterGroup loraParams = OptionalParameterGroup("LoRaWan", "LoRaWan", AMPEL_LORAWAN);
IntTParameter<uint16_t> loraTimestepParam = IntTParameter<uint16_t> loraTimestepParam =
Builder<IntTParameter<uint16_t>>("lora_timestep").label("LoRa timestep").defaultValue( Builder<IntTParameter<uint16_t>>("lora_timestep").label("LoRa timestep").defaultValue(
LORAWAN_SENDING_INTERVAL).min(0).step(1).defaultValue(300).placeholder("[s]").build(); LORAWAN_SENDING_INTERVAL).min(0).step(1).defaultValue(300).placeholder("[s]").build();
......
Supports Markdown
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