Commit c4c4d856 authored by Eric Duminil's avatar Eric Duminil
Browse files

More callbacks

parent 033bdec3
......@@ -84,9 +84,13 @@ namespace web_server {
IPAddress address = WiFi.localIP();
snprintf(wifi::local_ip, sizeof(wifi::local_ip), "%d.%d.%d.%d", address[0], address[1], address[2], address[3]);
Serial.println(wifi::local_ip);
Serial.print(F("You can access this sensor via http://"));
Serial.print(ampel.sensorId);
Serial.print(F(".local (might be unstable) or http://"));
Serial.println(WiFi.localIP());
});
iotWebConf->setWifiConnectionFailedHandler([]() {
iotWebConf->setWifiConnectionFailedHandler([]() -> iotwebconf::WifiAuthInfo* {
led_effects::showKITTWheel(color::red);
Serial.println(F("Connection to WiFi failed"));
return NULL;
......@@ -97,6 +101,8 @@ namespace web_server {
//TODO: Add LED effects
//TODO: Add other params
//TODO: Use HTTP_USER / HTTP_PASSWORD for config
//TODO: Move to own class
//TODO: Remove AP Password config?
iotWebConf->init();
sensor_console::defineCommand("reset_config", []() {
......@@ -259,10 +265,6 @@ namespace web_server {
});
//TODO: Only once wifi connected
Serial.print(F("You can access this sensor via http://"));
Serial.print(ampel.sensorId);
Serial.print(F(".local (might be unstable) or http://"));
Serial.println(WiFi.localIP());
}
// Allow access if http_user or http_password are empty, or if provided credentials match
......
......@@ -2,7 +2,7 @@
#define WIFI_UTIL_H_INCLUDED
namespace wifi {
extern char local_ip[];
extern char local_ip[16];
void connect(const char *hostname);
bool connected();
}
......
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