diff --git a/ampel-firmware/config.public.h b/ampel-firmware/config.public.h index cf0325f388367658469cede1eb3b29874eca83bd..b91b23618e8041842ddaf6414ea9741786324aec 100644 --- a/ampel-firmware/config.public.h +++ b/ampel-firmware/config.public.h @@ -7,12 +7,12 @@ * SERVICES */ -// Comment or remove those lines if you want to disable the corresponding services -# define AMPEL_WIFI // 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_MQTT // 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_LORAWAN // Should data be sent over LoRaWAN? (Requires ESP32 + LoRa modem, and "MCCI LoRaWAN LMIC library") +// Define the default for corresponding services. They can be enabled/disabled later in the web-config. +# define AMPEL_WIFI true // Should ESP connect to WiFi? It allows the Ampel to get time from an NTP server. +# define AMPEL_HTTP true // Should HTTP web server be started? (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 true // Should data be logged as CSV, on the ESP flash memory? +# define AMPEL_LORAWAN false // Should data be sent over LoRaWAN? (Requires ESP32 + LoRa modem, and "MCCI LoRaWAN LMIC library") /** * WIFI diff --git a/ampel-firmware/web_config.cpp b/ampel-firmware/web_config.cpp index e3018e607d4694ae67ea1dff5612188fb43cd7c9..9a02186d697f324e99de2b78fdee7e6a6abf88aa 100644 --- a/ampel-firmware/web_config.cpp +++ b/ampel-firmware/web_config.cpp @@ -34,7 +34,8 @@ namespace web_config { /** * 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 = Builder<IntTParameter<uint16_t>>("wifi_timeout").label("WiFi timeout").defaultValue(WIFI_TIMEOUT).min(0).placeholder( "[s]").build(); @@ -87,7 +88,7 @@ namespace web_config { /** * CSV */ - OptionalParameterGroup csvParams = OptionalParameterGroup("CSV", "CSV", true); + OptionalParameterGroup csvParams = OptionalParameterGroup("CSV", "CSV", AMPEL_CSV); IntTParameter<uint16_t> csvTimestepParam = Builder<IntTParameter<uint16_t>>("csv_timestep").label("CSV timestep").defaultValue(CSV_INTERVAL).min(0).step(1).placeholder( @@ -96,16 +97,12 @@ namespace web_config { /** * MQTT */ - OptionalParameterGroup mqttParams = OptionalParameterGroup("MQTT", "MQTT", true); + OptionalParameterGroup mqttParams = OptionalParameterGroup("MQTT", "MQTT", AMPEL_MQTT); IntTParameter<uint16_t> mqttTimestepParam = Builder<IntTParameter<uint16_t>>("mqtt_timestep").label("MQTT timestep").defaultValue( 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 = Builder<CheckboxTParameter>("mqtt_encryption").label("Encrypt MQTT?").defaultValue(MQTT_ENCRYPTED).build(); @@ -144,7 +141,7 @@ namespace web_config { /** * LoRa & Stuff */ - OptionalParameterGroup loraParams = OptionalParameterGroup("LoRaWan", "LoRaWan", false); + OptionalParameterGroup loraParams = OptionalParameterGroup("LoRaWan", "LoRaWan", AMPEL_LORAWAN); IntTParameter<uint16_t> loraTimestepParam = Builder<IntTParameter<uint16_t>>("lora_timestep").label("LoRa timestep").defaultValue( LORAWAN_SENDING_INTERVAL).min(0).step(1).defaultValue(300).placeholder("[s]").build();