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

Config timeout

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