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

Ugly, but seems to work

parent f5b118ba
......@@ -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)
......
......@@ -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() {
......
......@@ -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 setWifiConnectionFailedCallback(void (*function)());
void setWifiFailCallback(iotwebconf::WifiAuthInfo* (*function)());
void update();
//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