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
04062b05
Commit
04062b05
authored
Feb 17, 2022
by
Eric Duminil
Browse files
Allow commands during startup
parent
02e6f0b0
Pipeline
#5870
passed with stage
in 2 minutes and 28 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.h
View file @
04062b05
...
...
@@ -25,6 +25,5 @@ void wifiConnected();
void
wifiFailed
();
void
keepServicesAlive
();
void
checkFlashButton
();
void
checkSerialInput
();
#endif
ampel-firmware/ampel-firmware.ino
View file @
04062b05
...
...
@@ -128,7 +128,7 @@ void loop() {
// Short press for night mode, Long press for calibration.
checkFlashButton
();
checkSerialInput
();
sensor_console
::
checkSerialInput
();
if
(
sensor
::
processData
())
{
if
(
config
::
is_csv_active
())
{
...
...
@@ -188,12 +188,6 @@ void wifiFailed() {
* Helper functions *
*****************************************************************/
void
checkSerialInput
()
{
while
(
Serial
.
available
()
>
0
)
{
sensor_console
::
processSerialInput
(
Serial
.
read
());
}
}
/**
* Checks if flash button has been pressed:
* If not, do nothing.
...
...
ampel-firmware/sensor_console.cpp
View file @
04062b05
...
...
@@ -149,6 +149,12 @@ namespace sensor_console {
}
}
void
checkSerialInput
()
{
while
(
Serial
.
available
()
>
0
)
{
sensor_console
::
processSerialInput
(
Serial
.
read
());
}
}
/*
* Tries to find the corresponding callback for a given command. Name and parameter type should fit.
*/
...
...
ampel-firmware/sensor_console.h
View file @
04062b05
...
...
@@ -12,7 +12,7 @@ namespace sensor_console {
void
defineIntCommand
(
const
char
*
name
,
void
(
*
function
)(
int32_t
),
const
__FlashStringHelper
*
doc_fstring
);
void
defineStringCommand
(
const
char
*
name
,
void
(
*
function
)(
char
*
),
const
__FlashStringHelper
*
doc_fstring
);
void
process
SerialInput
(
const
uint8_t
in_byte
);
void
check
SerialInput
();
void
execute
(
const
char
*
command_line
);
}
...
...
ampel-firmware/wifi_util.cpp
View file @
04062b05
...
...
@@ -35,6 +35,7 @@ namespace wifi {
void
tryConnection
()
{
for
(
int
i
=
0
;
i
<=
config
::
wifi_timeout
+
5
;
i
++
)
{
web_config
::
update
();
sensor_console
::
checkSerialInput
();
// To allow reset or ssid ... during startup
if
(
isAccessPoint
())
{
led_effects
::
alert
(
0x1cff68
);
}
else
if
(
connected
())
{
...
...
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