Commit 04062b05 authored by Eric Duminil's avatar Eric Duminil
Browse files

Allow commands during startup

parent 02e6f0b0
Pipeline #5870 passed with stage
in 2 minutes and 28 seconds
......@@ -25,6 +25,5 @@ void wifiConnected();
void wifiFailed();
void keepServicesAlive();
void checkFlashButton();
void checkSerialInput();
#endif
......@@ -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.
......
......@@ -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.
*/
......
......@@ -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 processSerialInput(const uint8_t in_byte);
void checkSerialInput();
void execute(const char *command_line);
}
......
......@@ -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()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment