Commit 6625ade7 authored by Eric Duminil's avatar Eric Duminil
Browse files

Small changes

parent 22d98cc2
Pipeline #5760 passed with stage
in 2 minutes and 8 seconds
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include "ampel-firmware.h" #include "ampel-firmware.h"
//TODO: Move as many includes into cpp as possible
/***************************************************************** /*****************************************************************
* GPL License * * GPL License *
...@@ -96,8 +95,6 @@ void setup() { ...@@ -96,8 +95,6 @@ void setup() {
}); });
#endif #endif
void setWifiConnectionFailedCallback(void (*function)());
pinMode(0, INPUT); // Flash button (used for forced calibration) pinMode(0, INPUT); // Flash button (used for forced calibration)
Serial.println(); Serial.println();
...@@ -221,7 +218,7 @@ void checkFlashButton() { ...@@ -221,7 +218,7 @@ void checkFlashButton() {
void keepServicesAlive() { void keepServicesAlive() {
#ifdef AMPEL_WIFI #ifdef AMPEL_WIFI
web_config::update(); web_config::update();
if (WiFi.status() == WL_CONNECTED) { if (wifi::connected()) {
ntp::update(); // NTP client has its own timer. It will connect to NTP server every 60s. ntp::update(); // NTP client has its own timer. It will connect to NTP server every 60s.
# ifdef AMPEL_MQTT # ifdef AMPEL_MQTT
mqtt::keepConnection(); // MQTT client has its own timer. It will keep alive every 15s. mqtt::keepConnection(); // MQTT client has its own timer. It will keep alive every 15s.
......
...@@ -27,6 +27,10 @@ namespace config { ...@@ -27,6 +27,10 @@ namespace config {
namespace wifi { namespace wifi {
char local_ip[16]; // "255.255.255.255\0" char local_ip[16]; // "255.255.255.255\0"
bool connected() {
return WiFi.status() == WL_CONNECTED;
}
void scanNetworks() { void scanNetworks() {
Serial.println(); Serial.println();
Serial.println(F("WiFi - Scanning...")); Serial.println(F("WiFi - Scanning..."));
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace wifi { namespace wifi {
extern char local_ip[16]; extern char local_ip[16];
void defineCommands(); void defineCommands();
bool connected();
} }
#endif #endif
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