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
7b2a157a
Commit
7b2a157a
authored
Feb 10, 2022
by
Eric Duminil
Browse files
Ugly, but seems to work
parent
f5b118ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
7b2a157a
...
...
@@ -56,6 +56,12 @@
* and define your credentials and parameters in 'config.h'.
*/
iotwebconf
::
WifiAuthInfo
*
failedConnection
()
{
Serial
.
println
(
"Seriously. What???"
);
led_effects
::
showKITTWheel
(
color
::
red
);
return
nullptr
;
}
/*****************************************************************
* Setup *
*****************************************************************/
...
...
@@ -89,10 +95,12 @@ void setup() {
Serial
.
println
(
WiFi
.
localIP
());
});
web_config
::
setWifiConnectionFailedCallback
([]()
{
led_effects
::
showKITTWheel
(
color
::
red
);
Serial
.
println
(
F
(
"Connection to WiFi failed"
));
});
web_config
::
setWifiFailCallback
(
failedConnection
);
// web_config::setWifiConnectionFailedCallback([]() {
// led_effects::showKITTWheel(color::red);
// Serial.println(F("Connection to WiFi failed"));
// });
#endif
pinMode
(
0
,
INPUT
);
// Flash button (used for forced calibration)
...
...
ampel-firmware/web_config.cpp
View file @
7b2a157a
...
...
@@ -162,11 +162,8 @@ namespace web_config {
iotWebConf
->
setWifiConnectionCallback
(
function
);
}
void
setWifiConnectionFailedCallback
(
void
(
*
function
)())
{
iotWebConf
->
setWifiConnectionFailedHandler
([
&
function
]()
->
WifiAuthInfo
*
{
function
();
return
NULL
;
});
void
setWifiFailCallback
(
WifiAuthInfo
*
(
*
function
)())
{
iotWebConf
->
setWifiConnectionFailedHandler
(
function
);
}
void
initialize
()
{
...
...
ampel-firmware/web_config.h
View file @
7b2a157a
...
...
@@ -2,6 +2,7 @@
#define AMPEL_WEB_CONFIG_H_
#define STRING_LEN 64
#include
<IotWebConf.h>
#if defined(ESP8266)
# include <ESP8266WebServer.h>
...
...
@@ -51,7 +52,7 @@ namespace config {
namespace
web_config
{
void
initialize
();
void
setWifiConnectionCallback
(
void
(
*
function
)());
void
setWifi
Connection
Fail
ed
Callback
(
void
(
*
function
)());
void
setWifiFailCallback
(
iotwebconf
::
WifiAuthInfo
*
(
*
function
)());
void
update
();
//TODO: Add saveConfig(), for e.g. after custom setters. Or simply reset after each configchange?
...
...
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