firmware: discard partial RS485 echoes
This commit is contained in:
@@ -89,7 +89,9 @@ void pollRs485Commands(HardwareSerial& serial, const ImuState& imu) {
|
||||
StaticJsonDocument<192> request;
|
||||
DeserializationError error = deserializeJson(request, commandBuffer);
|
||||
commandBuffer = "";
|
||||
if (error) { publishCalibrationResult(serial, "invalid_json"); continue; }
|
||||
// Partial self-echoes and line noise are not commands. Dropping them
|
||||
// silently avoids turning one bad fragment into a response/echo loop.
|
||||
if (error) continue;
|
||||
String type = request["type"] | "";
|
||||
// Some RS485 boards echo transmitted frames into RX. Ignore our own output.
|
||||
if (type == "sensor_status" || type == "calibration_response") continue;
|
||||
|
||||
Reference in New Issue
Block a user