mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
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:
parent
bfcc63f19a
commit
09f0b25377
@ -42,6 +42,7 @@ build_flags =
|
|||||||
'-DWIFI_AP_SSID=${wifi.ap_ssid}'
|
'-DWIFI_AP_SSID=${wifi.ap_ssid}'
|
||||||
'-DWIFI_AP_PASSWORD=${wifi.ap_password}'
|
'-DWIFI_AP_PASSWORD=${wifi.ap_password}'
|
||||||
'-DWIFI_AP_CHANNEL=${wifi.adhocchannel}'
|
'-DWIFI_AP_CHANNEL=${wifi.adhocchannel}'
|
||||||
|
'-DSERIAL_FLUSH_ENABLED=${development.serial_flush_enabled}'
|
||||||
|
|
||||||
'-DOTA_PASSWORD=${ota.otapassword}' ; Set the OTA password
|
'-DOTA_PASSWORD=${ota.otapassword}' ; Set the OTA password
|
||||||
'-DOTA_LOGIN=${ota.otalogin}'
|
'-DOTA_LOGIN=${ota.otalogin}'
|
||||||
|
|||||||
@ -14,4 +14,7 @@ adhocchannel = 1
|
|||||||
|
|
||||||
[ota]
|
[ota]
|
||||||
otalogin = "openiris"
|
otalogin = "openiris"
|
||||||
otapassword = "12345678"
|
otapassword = "12345678"
|
||||||
|
|
||||||
|
[development]
|
||||||
|
serial_flush_enabled = 0
|
||||||
|
|||||||
@ -54,13 +54,12 @@ void SerialManager::send_frame() {
|
|||||||
|
|
||||||
void SerialManager::init() {
|
void SerialManager::init() {
|
||||||
Serial.begin(3000000);
|
Serial.begin(3000000);
|
||||||
Serial.flush();
|
if (SERIAL_FLUSH_ENABLED){
|
||||||
|
Serial.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialManager::run() {
|
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()) {
|
if (Serial.available()) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
DeserializationError deserializationError = deserializeJson(doc, Serial);
|
DeserializationError deserializationError = deserializeJson(doc, Serial);
|
||||||
@ -68,7 +67,6 @@ void SerialManager::run() {
|
|||||||
if (deserializationError) {
|
if (deserializationError) {
|
||||||
log_e("Command deserialization failed: %s",
|
log_e("Command deserialization failed: %s",
|
||||||
deserializationError.c_str());
|
deserializationError.c_str());
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command command = {doc};
|
Command command = {doc};
|
||||||
@ -79,5 +77,4 @@ void SerialManager::run() {
|
|||||||
this->send_frame();
|
this->send_frame();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user