Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
c4c4d856
Commit
c4c4d856
authored
May 15, 2021
by
Eric Duminil
Browse files
More callbacks
parent
033bdec3
Changes
2
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/web_server.cpp
View file @
c4c4d856
...
...
@@ -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
...
...
ampel-firmware/wifi_util.h
View file @
c4c4d856
...
...
@@ -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
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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