Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
35dc8c16
Commit
35dc8c16
authored
Feb 14, 2022
by
Eric Duminil
Browse files
Config timeout
parent
96dbe3d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/web_config.cpp
View file @
35dc8c16
...
...
@@ -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
();
}
...
...
ampel-firmware/web_config.h
View file @
35dc8c16
...
...
@@ -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).
...
...
ampel-firmware/wifi_util.cpp
View file @
35dc8c16
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment