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
188a0bf3
Commit
188a0bf3
authored
Apr 20, 2021
by
Eric Duminil
Browse files
ampel.max_loop_duration
parent
9a47750c
Changes
4
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
188a0bf3
...
...
@@ -162,10 +162,10 @@ void loop() {
}
uint32_t
duration
=
millis
()
-
t0
;
if
(
duration
>
max_loop_duration
)
{
max_loop_duration
=
duration
;
if
(
duration
>
ampel
.
max_loop_duration
)
{
ampel
.
max_loop_duration
=
duration
;
Serial
.
print
(
F
(
"Debug - Max loop duration : "
));
Serial
.
print
(
max_loop_duration
);
Serial
.
print
(
ampel
.
max_loop_duration
);
Serial
.
println
(
F
(
" ms."
));
}
}
...
...
ampel-firmware/util.cpp
View file @
188a0bf3
...
...
@@ -51,10 +51,8 @@ namespace ntp {
}
}
uint32_t
max_loop_duration
=
0
;
Ampel
::
Ampel
()
:
sensorId
(
"ESP"
+
macToID
())
{
sensorId
(
"ESP"
+
macToID
())
,
max_loop_duration
(
0
)
{
sensor_console
::
defineIntCommand
(
"set_time"
,
ntp
::
setLocalTime
,
" 1618829570 (Sets time to the given UNIX time)"
);
sensor_console
::
defineCommand
(
"free"
,
[]()
{
Serial
.
print
(
F
(
"Free heap space : "
));
...
...
@@ -63,4 +61,4 @@ Ampel::Ampel() :
},
" (Displays available heap space)"
);
}
const
Ampel
ampel
;
Ampel
ampel
;
ampel-firmware/util.h
View file @
188a0bf3
...
...
@@ -39,12 +39,12 @@ namespace util {
class
Ampel
{
public:
const
String
sensorId
;
uint32_t
max_loop_duration
;
Ampel
();
};
//NOTE: Only use seconds() for duration comparison, not timestamps comparison. Otherwise, problems happen when millis roll over.
#define seconds() (millis() / 1000UL)
extern
uint32_t
max_loop_duration
;
extern
const
Ampel
ampel
;
extern
Ampel
ampel
;
#endif
ampel-firmware/web_server.cpp
View file @
188a0bf3
...
...
@@ -239,7 +239,7 @@ namespace web_server {
#endif
config
::
temperature_offset
,
config
::
auto_calibrate_sensor
?
"Yes"
:
"No"
,
ampel
.
sensorId
.
c_str
(),
ampel
.
sensorId
.
c_str
(),
WiFi
.
localIP
().
toString
().
c_str
(),
WiFi
.
localIP
().
toString
().
c_str
(),
get_free_heap_size
(),
max_loop_duration
,
BOARD
,
dd
,
hh
,
mm
,
ss
);
get_free_heap_size
(),
ampel
.
max_loop_duration
,
BOARD
,
dd
,
hh
,
mm
,
ss
);
Serial
.
print
(
F
(
" - Body size : "
));
http
.
sendContent
(
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