firmware: discard partial RS485 echoes

This commit is contained in:
nick committed 2026-07-17 02:47:13 -06:00
1 parent 75845a18e3
commit d5578ce796
3 files changed
+5 -1

No files matched your search

@@ -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;