Commit 7b2a157a authored by Eric Duminil's avatar Eric Duminil
Browse files

Ugly, but seems to work

parent f5b118ba
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
* and define your credentials and parameters in 'config.h'. * and define your credentials and parameters in 'config.h'.
*/ */
iotwebconf::WifiAuthInfo* failedConnection() {
Serial.println("Seriously. What???");
led_effects::showKITTWheel(color::red);
return nullptr;
}
/***************************************************************** /*****************************************************************
* Setup * * Setup *
*****************************************************************/ *****************************************************************/
...@@ -89,10 +95,12 @@ void setup() { ...@@ -89,10 +95,12 @@ void setup() {
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
}); });
web_config::setWifiConnectionFailedCallback([]() { web_config::setWifiFailCallback(failedConnection);
led_effects::showKITTWheel(color::red);
Serial.println(F("Connection to WiFi failed")); // web_config::setWifiConnectionFailedCallback([]() {
}); // led_effects::showKITTWheel(color::red);
// Serial.println(F("Connection to WiFi failed"));
// });
#endif #endif
pinMode(0, INPUT); // Flash button (used for forced calibration) pinMode(0, INPUT); // Flash button (used for forced calibration)
......
...@@ -162,11 +162,8 @@ namespace web_config { ...@@ -162,11 +162,8 @@ namespace web_config {
iotWebConf->setWifiConnectionCallback(function); iotWebConf->setWifiConnectionCallback(function);
} }
void setWifiConnectionFailedCallback(void (*function)()) { void setWifiFailCallback(WifiAuthInfo* (*function)()) {
iotWebConf->setWifiConnectionFailedHandler([&function]() -> WifiAuthInfo* { iotWebConf->setWifiConnectionFailedHandler(function);
function();
return NULL;
});
} }
void initialize() { void initialize() {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define AMPEL_WEB_CONFIG_H_ #define AMPEL_WEB_CONFIG_H_
#define STRING_LEN 64 #define STRING_LEN 64
#include <IotWebConf.h>
#if defined(ESP8266) #if defined(ESP8266)
# include <ESP8266WebServer.h> # include <ESP8266WebServer.h>
...@@ -51,7 +52,7 @@ namespace config { ...@@ -51,7 +52,7 @@ namespace config {
namespace web_config { namespace web_config {
void initialize(); void initialize();
void setWifiConnectionCallback(void (*function)()); void setWifiConnectionCallback(void (*function)());
void setWifiConnectionFailedCallback(void (*function)()); void setWifiFailCallback(iotwebconf::WifiAuthInfo* (*function)());
void update(); void update();
//TODO: Add saveConfig(), for e.g. after custom setters. Or simply reset after each configchange? //TODO: Add saveConfig(), for e.g. after custom setters. Or simply reset after each configchange?
......
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