firmware: mirror sensor telemetry to USB

This commit is contained in:
2026-07-17 02:01:53 -06:00
parent a1a2f399d1
commit 07559da6c0
4 changed files with 10 additions and 1 deletions
@@ -14,3 +14,5 @@ Power both sensors from 3.3V with shared ground. Required Arduino libraries are
At startup the firmware scans D7/D8 and accepts either valid BNO08x address, `0x4A` or `0x4B`. If neither appears in the scan, verify 3.3V/GND, swap-check SDA and SCL, and confirm the breakout's PS0/PS1 jumpers are configured for I2C.
The node sends `sensor_status` at 115200 baud every 200 ms. See `docs/SENSOR_NODE_PROTOCOL.md`. The initial firmware is transmit-only; add a dashboard receiver after bench-testing the node, RS485 polarity, and sensor axes.
During bring-up, `USB_TELEMETRY_ENABLED` mirrors each RS485 JSON frame to the Arduino Serial Monitor at 115200 baud. Set it to `0` in `sensor_node_config.h` when continuous USB output is no longer wanted.
@@ -26,5 +26,9 @@ void publishSensorStatus(HardwareSerial& serial, const ImuState& imu, const GpsS
digitalWrite(RS485_DE_PIN, HIGH); delayMicroseconds(20);
serializeJson(doc, serial); serial.write('\n'); serial.flush();
digitalWrite(RS485_DE_PIN, LOW);
}
#if USB_TELEMETRY_ENABLED
serializeJson(doc, Serial);
Serial.println();
#endif
}
@@ -19,3 +19,4 @@
#define IMU_REPORT_INTERVAL_US 20000
#define TELEMETRY_INTERVAL_MS 200
#define SENSOR_STALE_MS 2000
#define USB_TELEMETRY_ENABLED 1