feat: Fix the serial command manager preventing the boards from connecting to wi-fi (#60)

* Fix the serial command manager preventing the

* Make serial.flush() in command manager optional for devs only
This commit is contained in:
Zdzislaw Goik 2024-03-11 17:26:16 +01:00 committed by GitHub
parent bfcc63f19a
commit 09f0b25377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View File

@ -42,6 +42,7 @@ build_flags =
'-DWIFI_AP_SSID=${wifi.ap_ssid}'
'-DWIFI_AP_PASSWORD=${wifi.ap_password}'
'-DWIFI_AP_CHANNEL=${wifi.adhocchannel}'
'-DSERIAL_FLUSH_ENABLED=${development.serial_flush_enabled}'
'-DOTA_PASSWORD=${ota.otapassword}' ; Set the OTA password
'-DOTA_LOGIN=${ota.otalogin}'

View File

@ -14,4 +14,7 @@ adhocchannel = 1
[ota]
otalogin = "openiris"
otapassword = "12345678"
otapassword = "12345678"
[development]
serial_flush_enabled = 0

View File

@ -54,13 +54,12 @@ void SerialManager::send_frame() {
void SerialManager::init() {
Serial.begin(3000000);
Serial.flush();
if (SERIAL_FLUSH_ENABLED){
Serial.flush();
}
}
void SerialManager::run() {
while (true) {
// we're getting a command, read it whole and process.
// otherwise, send a frame if we're supposed to
if (Serial.available()) {
JsonDocument doc;
DeserializationError deserializationError = deserializeJson(doc, Serial);
@ -68,7 +67,6 @@ void SerialManager::run() {
if (deserializationError) {
log_e("Command deserialization failed: %s",
deserializationError.c_str());
continue;
}
Command command = {doc};
@ -79,5 +77,4 @@ void SerialManager::run() {
this->send_frame();
}
#endif
}
}