Commit 35dc8c16 authored by Eric Duminil's avatar Eric Duminil
Browse files

Config timeout

parent 96dbe3d5
...@@ -226,6 +226,7 @@ namespace web_config { ...@@ -226,6 +226,7 @@ namespace web_config {
iotWebConf->addParameterGroup(&loraParams); iotWebConf->addParameterGroup(&loraParams);
#endif #endif
//TODO: Add "ap" command?
sensor_console::defineCommand("reset_config", []() { sensor_console::defineCommand("reset_config", []() {
Serial.println(F("Resetting config...")); Serial.println(F("Resetting config..."));
iotWebConf->getRootParameterGroup()->applyDefaultValue(); iotWebConf->getRootParameterGroup()->applyDefaultValue();
...@@ -253,7 +254,8 @@ namespace web_config { ...@@ -253,7 +254,8 @@ namespace web_config {
# else # else
iotWebConf->setStatusPin(ONBOARD_LED_PIN, HIGH); iotWebConf->setStatusPin(ONBOARD_LED_PIN, HIGH);
# endif # endif
iotWebConf->setWifiConnectionTimeoutMs(1000UL * WIFI_TIMEOUT);
iotWebConf->setWifiConnectionTimeoutMs(1000UL * config::wifi_timeout);
iotWebConf->skipApStartup(); iotWebConf->skipApStartup();
//TODO: Add callbacks //TODO: Add callbacks
...@@ -301,6 +303,7 @@ namespace config { ...@@ -301,6 +303,7 @@ namespace config {
float &temperature_offset = web_config::temperatureOffsetParam.value(); // [K] Sign isn't relevant. float &temperature_offset = web_config::temperatureOffsetParam.value(); // [K] Sign isn't relevant.
bool &wifi_active = web_config::ampelWifiParam.value(); bool &wifi_active = web_config::ampelWifiParam.value();
uint16_t &wifi_timeout = web_config::wifiTimeoutParam.value();
void save() { void save() {
web_config::iotWebConf->saveConfig(); web_config::iotWebConf->saveConfig();
} }
......
...@@ -14,6 +14,7 @@ namespace config { ...@@ -14,6 +14,7 @@ namespace config {
char* selected_ssid(); char* selected_ssid();
char* ap_password(); char* ap_password();
extern bool &wifi_active; // [true / false] extern bool &wifi_active; // [true / false]
extern uint16_t &wifi_timeout; // [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).
......
...@@ -20,8 +20,7 @@ namespace wifi { ...@@ -20,8 +20,7 @@ namespace wifi {
} }
void tryConnection() { void tryConnection() {
//TODO: configurable timeout for (int i = 0; i <= config::wifi_timeout + 10; i++) {
for (int i = 0; i <= 30; i++) {
web_config::update(); web_config::update();
if (WiFi.getMode() == WIFI_AP){ if (WiFi.getMode() == WIFI_AP){
led_effects::alert(0x1cff68); led_effects::alert(0x1cff68);
......
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