Commit 985e9560 authored by Eric Duminil's avatar Eric Duminil
Browse files

Reordering params a bit

No related merge requests found
Pipeline #5770 passed with stage
in 2 minutes and 18 seconds
Showing with 20 additions and 15 deletions
+20 -15
...@@ -30,13 +30,13 @@ namespace web_config { ...@@ -30,13 +30,13 @@ namespace web_config {
IotWebConf *iotWebConf; IotWebConf *iotWebConf;
const char config_version[IOTWEBCONF_CONFIG_VERSION_LENGTH] = "a07"; // -- Configuration specific key. The value should be modified if config structure was changed. const char config_version[IOTWEBCONF_CONFIG_VERSION_LENGTH] = "a08"; // -- Configuration specific key. The value should be modified if config structure was changed.
using namespace iotwebconf; using namespace iotwebconf;
/** /**
* WiFi params * WiFi params
*/ */
CheckboxTParameter ampelWifiParam = Builder<CheckboxTParameter>("WiFi").label("WiFi").defaultValue(true).build(); CheckboxTParameter ampelWifiParam = Builder<CheckboxTParameter>("WiFi").label("WiFi?").defaultValue(true).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();
...@@ -63,7 +63,7 @@ namespace web_config { ...@@ -63,7 +63,7 @@ namespace web_config {
"Atmospheric CO2 concentration").defaultValue( "Atmospheric CO2 concentration").defaultValue(
ATMOSPHERIC_CO2_CONCENTRATION).min(400).max(2000).step(1).placeholder("ppm").build(); ATMOSPHERIC_CO2_CONCENTRATION).min(400).max(2000).step(1).placeholder("ppm").build();
CheckboxTParameter autoCalibrateParam = Builder<CheckboxTParameter>("asc").label("Auto-calibration").defaultValue( CheckboxTParameter autoCalibrateParam = Builder<CheckboxTParameter>("asc").label("Auto-calibration?").defaultValue(
AUTO_CALIBRATE_SENSOR).build(); AUTO_CALIBRATE_SENSOR).build();
/** /**
...@@ -105,8 +105,11 @@ namespace web_config { ...@@ -105,8 +105,11 @@ namespace web_config {
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();
CheckboxTParameter mqttEncryptionParam =
Builder<CheckboxTParameter>("mqtt_encryption").label("Encrypt MQTT?").defaultValue(MQTT_ENCRYPTED).build();
CheckboxTParameter mqttCommandsParam = CheckboxTParameter mqttCommandsParam =
Builder<CheckboxTParameter>("mqtt_commands").label("MQTT commands").defaultValue(ALLOW_MQTT_COMMANDS).build(); Builder<CheckboxTParameter>("mqtt_commands").label("Allow MQTT commands?").defaultValue(ALLOW_MQTT_COMMANDS).build();
TextTParameter<STRING_LEN> mqttServerParam = TextTParameter<STRING_LEN> mqttServerParam =
Builder<TextTParameter<STRING_LEN>>("mqtt_server").label("MQTT Server").defaultValue(MQTT_SERVER).build(); Builder<TextTParameter<STRING_LEN>>("mqtt_server").label("MQTT Server").defaultValue(MQTT_SERVER).build();
...@@ -131,7 +134,7 @@ namespace web_config { ...@@ -131,7 +134,7 @@ namespace web_config {
IntTParameter<int16_t> timeOffsetParam = Builder<IntTParameter<int16_t>>("timezone").label("Timezone").defaultValue( IntTParameter<int16_t> timeOffsetParam = Builder<IntTParameter<int16_t>>("timezone").label("Timezone").defaultValue(
(UTC_OFFSET_IN_SECONDS) / 3600).min(-23).max(23).step(1).placeholder("[h]").build(); (UTC_OFFSET_IN_SECONDS) / 3600).min(-23).max(23).step(1).placeholder("[h]").build();
CheckboxTParameter dstParam = CheckboxTParameter dstParam =
Builder<CheckboxTParameter>("dst").label("Daylight Saving Time").defaultValue(false).build(); Builder<CheckboxTParameter>("dst").label("Daylight Saving Time?").defaultValue(false).build();
/** /**
* LED * LED
...@@ -183,8 +186,8 @@ namespace web_config { ...@@ -183,8 +186,8 @@ namespace web_config {
co2Params.addItem(&atmosphericCO2Param); co2Params.addItem(&atmosphericCO2Param);
co2Params.addItem(&autoCalibrateParam); co2Params.addItem(&autoCalibrateParam);
ledParams.addItem(&maxBrightnessParam);
ledParams.addItem(&minBrightnessParam); ledParams.addItem(&minBrightnessParam);
ledParams.addItem(&maxBrightnessParam);
ledParams.addItem(&ledCountParam); ledParams.addItem(&ledCountParam);
timeParams.addItem(&ntpServerParam); timeParams.addItem(&ntpServerParam);
...@@ -194,11 +197,12 @@ namespace web_config { ...@@ -194,11 +197,12 @@ namespace web_config {
csvParams.addItem(&csvTimestepParam); csvParams.addItem(&csvTimestepParam);
mqttParams.addItem(&mqttTimestepParam); mqttParams.addItem(&mqttTimestepParam);
mqttParams.addItem(&mqttCommandsParam);
mqttParams.addItem(&mqttServerParam); mqttParams.addItem(&mqttServerParam);
mqttParams.addItem(&mqttPortParam); mqttParams.addItem(&mqttPortParam);
mqttParams.addItem(&mqttUserParam); mqttParams.addItem(&mqttUserParam);
mqttParams.addItem(&mqttPasswordParam); mqttParams.addItem(&mqttPasswordParam);
mqttParams.addItem(&mqttEncryptionParam);
mqttParams.addItem(&mqttCommandsParam);
//TODO: Only for ESP32 //TODO: Only for ESP32
loraParams.addItem(&loraTimestepParam); loraParams.addItem(&loraTimestepParam);
...@@ -270,9 +274,6 @@ namespace web_config { ...@@ -270,9 +274,6 @@ namespace web_config {
* Define all the corresponding config values as reference, so that they can be updated. * Define all the corresponding config values as reference, so that they can be updated.
*/ */
namespace config { namespace config {
// CSV
uint16_t &csv_interval = web_config::csvTimestepParam.value();
// Sensor // Sensor
uint16_t &measurement_timestep = web_config::timestepParam.value(); // [s] Value between 2 and 1800 (range for SCD30 sensor). uint16_t &measurement_timestep = web_config::timestepParam.value(); // [s] Value between 2 and 1800 (range for SCD30 sensor).
uint16_t &altitude_above_sea_level = web_config::altitudeParam.value(); // [m] uint16_t &altitude_above_sea_level = web_config::altitudeParam.value(); // [m]
...@@ -290,12 +291,15 @@ namespace config { ...@@ -290,12 +291,15 @@ namespace config {
int16_t &time_zone = web_config::timeOffsetParam.value(); int16_t &time_zone = web_config::timeOffsetParam.value();
bool &daylight_saving_time = web_config::dstParam.value(); bool &daylight_saving_time = web_config::dstParam.value();
// CSV
uint16_t &csv_interval = web_config::csvTimestepParam.value();
// MQTT // MQTT
char *mqtt_server = web_config::mqttServerParam.value(); char *mqtt_server = web_config::mqttServerParam.value();
char *mqtt_user = web_config::mqttUserParam.value(); char *mqtt_user = web_config::mqttUserParam.value();
char *mqtt_password = web_config::mqttPasswordParam.value(); char *mqtt_password = web_config::mqttPasswordParam.value();
uint16_t &mqtt_port = web_config::mqttPortParam.value(); uint16_t &mqtt_port = web_config::mqttPortParam.value();
uint16_t &mqtt_sending_interval = web_config::mqttTimestepParam.value(); uint16_t &mqtt_sending_interval = web_config::mqttTimestepParam.value();
bool &mqtt_encryption = web_config::mqttEncryptionParam.value();
bool &allow_mqtt_commands = web_config::mqttCommandsParam.value(); bool &allow_mqtt_commands = web_config::mqttCommandsParam.value();
} }
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
#endif #endif
namespace config { namespace config {
//CSV
//TODO: Add use_csv
extern uint16_t &csv_interval; // [s]
// Sensor // Sensor
extern uint16_t &measurement_timestep; // [s] Value between 2 and 1800 (range for SCD30 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 &altitude_above_sea_level; // [m]
...@@ -31,6 +27,10 @@ namespace config { ...@@ -31,6 +27,10 @@ namespace config {
extern int16_t &time_zone; // [h] extern int16_t &time_zone; // [h]
extern bool &daylight_saving_time; // [true / false] extern bool &daylight_saving_time; // [true / false]
//CSV
//TODO: Add use_csv
extern uint16_t &csv_interval; // [s]
// MQTT // MQTT
//TODO: Add use_mqtt //TODO: Add use_mqtt
extern char *mqtt_server; extern char *mqtt_server;
...@@ -38,6 +38,7 @@ namespace config { ...@@ -38,6 +38,7 @@ namespace config {
extern char *mqtt_password; extern char *mqtt_password;
extern uint16_t &mqtt_port; extern uint16_t &mqtt_port;
extern uint16_t &mqtt_sending_interval; // [s] extern uint16_t &mqtt_sending_interval; // [s]
extern bool &mqtt_encryption; // [true / false]
extern bool &allow_mqtt_commands; // [true / false] extern bool &allow_mqtt_commands; // [true / false]
} }
......
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