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
98427bcf
Commit
98427bcf
authored
Feb 21, 2022
by
Eric Duminil
Browse files
Webpage small refactor
parent
d6310634
Pipeline
#5887
passed with stage
in 2 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ntp.h
View file @
98427bcf
...
...
@@ -2,6 +2,7 @@
#define AMPEL_TIME_H_INCLUDED
namespace
ntp
{
extern
bool
connected_at_least_once
;
void
initialize
();
void
connect
();
void
update
();
...
...
ampel-firmware/web_server.cpp
View file @
98427bcf
...
...
@@ -29,6 +29,14 @@ namespace web_server {
void
handleDeleteCSV
();
void
handleWebServerCSV
();
const
__FlashStringHelper
*
showHTMLIf
(
bool
is_active
){
return
is_active
?
F
(
""
)
:
F
(
"hidden"
);
}
const
__FlashStringHelper
*
yesOrNo
(
bool
is_active
){
return
is_active
?
F
(
"Yes"
)
:
F
(
"No"
);
}
void
definePages
()
{
header_template
=
PSTR
(
"<!doctype html><html lang=en>"
...
...
@@ -224,11 +232,11 @@ namespace web_server {
// Body
snprintf_P
(
content
,
sizeof
(
content
),
body1_template
,
csv_writer
::
filename
,
config
::
ampel_name
(),
sensor
::
co2
,
sensor
::
temperature
,
sensor
::
humidity
,
sensor
::
timestamp
,
config
::
measurement_timestep
,
config
::
is_csv_active
()
?
""
:
"hidden"
,
csv_writer
::
last_successful_write
,
config
::
csv_interval
,
csv_writer
::
getAvailableSpace
()
/
1024
,
config
::
is_mqtt_active
()
?
""
:
"hidden"
,
mqtt
::
connected
?
"Yes"
:
"No"
,
mqtt
::
last_successful_publish
,
config
::
mqtt_sending_interval
showHTMLIf
(
config
::
is_csv_active
()
)
,
csv_writer
::
last_successful_write
,
config
::
csv_interval
,
csv_writer
::
getAvailableSpace
()
/
1024
,
showHTMLIf
(
config
::
is_mqtt_active
()
)
,
yesOrNo
(
mqtt
::
connected
)
,
mqtt
::
last_successful_publish
,
config
::
mqtt_sending_interval
#if defined(ESP32)
,
config
::
is_lorawan_active
()
?
""
:
"hidden"
,
lorawan
::
connected
?
"Yes"
:
"No"
,
,
showHTMLIf
(
config
::
is_lorawan_active
()
),
yesOrNo
(
lorawan
::
connected
)
,
config
::
lorawan_frequency_plan
,
lorawan
::
last_transmission
,
config
::
lorawan_sending_interval
#endif
);
...
...
@@ -238,10 +246,10 @@ namespace web_server {
web_config
::
http
.
sendContent
(
content
);
snprintf_P
(
content
,
sizeof
(
content
),
body2_template
,
config
::
temperature_offset
,
config
::
auto_calibrate_sensor
?
"Yes"
:
"No"
,
config
::
ampel_name
(),
config
::
ampel_name
(),
wifi
::
local_ip
,
yesOrNo
(
config
::
auto_calibrate_sensor
)
,
config
::
ampel_name
(),
config
::
ampel_name
(),
wifi
::
local_ip
,
wifi
::
local_ip
,
ampel
.
macAddress
,
ESP
.
getFreeHeap
(),
esp_get_max_free_block_size
(),
esp_get_heap_fragmentation
(),
ampel
.
max_loop_duration
,
ampel
.
board
,
ampel
.
sensorId
,
ampel
.
version
,
dd
,
hh
,
mm
,
ss
,
wifi
::
isAccessPoint
()
?
""
:
"hidden"
);
//TODO: When time is not yet set
ss
,
showHTMLIf
(
!
ntp
::
connected_at_least_once
));
Serial
.
print
(
F
(
" - Body2 size : "
));
Serial
.
print
(
strlen
(
content
));
...
...
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