Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
b1475814
Commit
b1475814
authored
Feb 07, 2022
by
Eric Duminil
Browse files
wifi::connected
parent
6c4ef5bf
Pipeline
#5744
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
b1475814
...
...
@@ -88,10 +88,7 @@ void setup() {
#ifdef AMPEL_WIFI
wifi
::
connect
(
ampel
.
sensorId
);
Serial
.
print
(
F
(
"WiFi - Status: "
));
Serial
.
println
(
WiFi
.
status
());
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
if
(
wifi
::
connected
())
{
# ifdef AMPEL_HTTP
web_server
::
initialize
();
# endif
...
...
@@ -203,7 +200,7 @@ void checkFlashButton() {
void
keepServicesAlive
()
{
#ifdef AMPEL_WIFI
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
if
(
wifi
::
connected
()
)
{
# if defined(ESP8266)
//NOTE: Sadly, there seems to be a bug in the current MDNS implementation.
// It stops working after 2 minutes. And forcing a restart leads to a memory leak.
...
...
ampel-firmware/wifi_util.cpp
View file @
b1475814
...
...
@@ -51,6 +51,10 @@ namespace wifi {
Serial
.
println
(
WIFI_SSID
);
}
bool
connected
()
{
return
WiFi
.
status
()
==
WL_CONNECTED
;
}
// Initialize Wi-Fi
void
connect
(
const
char
*
hostname
)
{
...
...
@@ -75,7 +79,7 @@ namespace wifi {
led_effects
::
showRainbowWheel
();
Serial
.
print
(
"."
);
}
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
if
(
connected
()
)
{
led_effects
::
showKITTWheel
(
color
::
green
);
Serial
.
println
();
Serial
.
print
(
F
(
"WiFi - Connected! IP address: "
));
...
...
@@ -85,7 +89,8 @@ namespace wifi {
}
else
{
//TODO: Allow sensor to work as an Access Point, in order to define SSID & password?
led_effects
::
showKITTWheel
(
color
::
red
);
Serial
.
println
(
F
(
"Connection to WiFi failed"
));
Serial
.
print
(
F
(
"Connection to WiFi failed! Status : "
));
Serial
.
println
(
WiFi
.
status
());
}
}
}
ampel-firmware/wifi_util.h
View file @
b1475814
...
...
@@ -4,6 +4,7 @@
namespace
wifi
{
extern
char
local_ip
[];
void
connect
(
const
char
*
hostname
);
bool
connected
();
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment