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
847f7b2e
Commit
847f7b2e
authored
May 14, 2021
by
Eric Duminil
Browse files
Works (Password 12345678) but still blocking
parent
80a71660
Pipeline
#5894
failed with stage
in 1 minute and 24 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
847f7b2e
...
@@ -84,29 +84,14 @@ void setup() {
...
@@ -84,29 +84,14 @@ void setup() {
#endif
#endif
#ifdef AMPEL_WIFI
#ifdef AMPEL_WIFI
wifi
::
connect
(
ampel
.
sensorId
);
//
wifi::connect(ampel.sensorId);
Serial
.
print
(
F
(
"WiFi - Status: "
));
//
Serial.print(F("WiFi - Status: "));
Serial
.
println
(
WiFi
.
status
());
//
Serial.println(WiFi.status());
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
# ifdef AMPEL_HTTP
# ifdef AMPEL_HTTP
web_server
::
initialize
();
web_server
::
initialize
();
# endif
# endif
ntp
::
initialize
();
if
(
MDNS
.
begin
(
ampel
.
sensorId
))
{
// Start the mDNS responder for SENSOR_ID.local
MDNS
.
addService
(
"http"
,
"tcp"
,
80
);
Serial
.
println
(
F
(
"mDNS responder started"
));
}
else
{
Serial
.
println
(
F
(
"Error setting up MDNS responder!"
));
}
# ifdef AMPEL_MQTT
mqtt
::
initialize
(
ampel
.
sensorId
);
# endif
}
#endif
#endif
#if defined(AMPEL_LORAWAN) && defined(ESP32)
#if defined(AMPEL_LORAWAN) && defined(ESP32)
...
@@ -199,19 +184,8 @@ void checkFlashButton() {
...
@@ -199,19 +184,8 @@ void checkFlashButton() {
void
keepServicesAlive
()
{
void
keepServicesAlive
()
{
#ifdef AMPEL_WIFI
#ifdef AMPEL_WIFI
if
(
WiFi
.
status
()
==
WL_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.
MDNS
.
update
();
# endif
ntp
::
update
();
// NTP client has its own timer. It will connect to NTP server every 60s.
# ifdef AMPEL_HTTP
# ifdef AMPEL_HTTP
web_server
::
update
();
web_server
::
update
();
# endif
# endif
# ifdef AMPEL_MQTT
mqtt
::
keepConnection
();
// MQTT client has its own timer. It will keep alive every 15s.
# endif
}
#endif
#endif
}
}
ampel-firmware/web_server.cpp
View file @
847f7b2e
...
@@ -35,8 +35,11 @@ namespace web_server {
...
@@ -35,8 +35,11 @@ namespace web_server {
WebServer
http
(
80
);
WebServer
http
(
80
);
#endif
#endif
AutoConnect
PORTAL
(
http
);
void
update
()
{
void
update
()
{
http
.
handleClient
();
// Listen for HTTP requests from clients
PORTAL
.
handleClient
();
// http.handleClient(); // Listen for HTTP requests from clients
}
}
void
initialize
()
{
void
initialize
()
{
...
@@ -183,7 +186,8 @@ namespace web_server {
...
@@ -183,7 +186,8 @@ namespace web_server {
http
.
on
(
"/delete_csv"
,
HTTP_POST
,
handleDeleteCSV
);
http
.
on
(
"/delete_csv"
,
HTTP_POST
,
handleDeleteCSV
);
#endif
#endif
http
.
onNotFound
(
handlePageNotFound
);
http
.
onNotFound
(
handlePageNotFound
);
http
.
begin
();
// http.begin();
PORTAL
.
begin
();
Serial
.
print
(
F
(
"You can access this sensor via http://"
));
Serial
.
print
(
F
(
"You can access this sensor via http://"
));
Serial
.
print
(
ampel
.
sensorId
);
Serial
.
print
(
ampel
.
sensorId
);
...
...
ampel-firmware/web_server.h
View file @
847f7b2e
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
# include <WebServer.h>
# include <WebServer.h>
#endif
#endif
#include
"src/lib/AutoConnect/AutoConnect.h"
#include
"config.h"
#include
"config.h"
#include
"util.h"
#include
"util.h"
#include
"wifi_util.h"
#include
"wifi_util.h"
...
...
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