Commit 66e24e75 authored by Eric Duminil's avatar Eric Duminil
Browse files

A bit cleaner

parent 7b2a157a
Pipeline #5782 passed with stage
in 2 minutes and 11 seconds
...@@ -56,10 +56,9 @@ ...@@ -56,10 +56,9 @@
* and define your credentials and parameters in 'config.h'. * and define your credentials and parameters in 'config.h'.
*/ */
iotwebconf::WifiAuthInfo* failedConnection() { void failedConnection() {
Serial.println("Seriously. What???"); Serial.println("Seriously. What???");
led_effects::showKITTWheel(color::red); led_effects::showKITTWheel(color::red);
return nullptr;
} }
/***************************************************************** /*****************************************************************
......
...@@ -158,12 +158,16 @@ namespace web_config { ...@@ -158,12 +158,16 @@ namespace web_config {
iotWebConf->doLoop(); // Listen for HTTP requests from clients iotWebConf->doLoop(); // Listen for HTTP requests from clients
} }
void setWifiConnectionCallback(void (*function)()) { void setWifiConnectionCallback(void (*success_function)()) {
iotWebConf->setWifiConnectionCallback(function); iotWebConf->setWifiConnectionCallback(success_function);
} }
void setWifiFailCallback(WifiAuthInfo* (*function)()) { void setWifiFailCallback(void (*fail_function)()) {
iotWebConf->setWifiConnectionFailedHandler(function); std::function<WifiAuthInfo* ()> fail_and_return_null = [fail_function]() {
fail_function();
return nullptr;
};
iotWebConf->setWifiConnectionFailedHandler(fail_and_return_null);
} }
void initialize() { void initialize() {
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#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,8 +50,8 @@ namespace config { ...@@ -51,8 +50,8 @@ namespace config {
namespace web_config { namespace web_config {
void initialize(); void initialize();
void setWifiConnectionCallback(void (*function)()); void setWifiConnectionCallback(void (*success_function)());
void setWifiFailCallback(iotwebconf::WifiAuthInfo* (*function)()); void setWifiFailCallback(void (*fail_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