dashboard: show sensor node RS485 diagnostics

This commit is contained in:
2026-07-26 18:10:50 -06:00
parent 35c0721b47
commit f145730b14
10 changed files with 266 additions and 1 deletions
@@ -12,6 +12,7 @@
extern const lv_img_dsc_t gas_station;
extern const lv_img_dsc_t thermometer_water;
#include "dashboard_status_model.h"
#include "sensor_node_receiver.h"
using namespace esp_panel::drivers;
using namespace esp_panel::board;
@@ -668,6 +669,56 @@ static void update_diagnostics_overlay()
text += "\n Cargo API: ";
text += status_model.api_ok ? "OK" : "FAIL";
const SensorNodeDashboardStatus &sensor_node = getSensorNodeStatus();
text += "\n\nSensor Node RS485\n";
text += " Link: ";
text += sensorNodeRs485Connected() ? "connected" : "offline";
text += " @ 115200";
text += "\n Pins: RX GPIO43 / TX GPIO44";
text += "\n Version: ";
text += sensor_node.firmwareVersion.length() ? sensor_node.firmwareVersion : String("--");
text += "\n Boot/sequence: ";
text += sensor_node.frameReceived ? String(sensor_node.bootId, HEX) : String("--");
text += "/";
text += sensor_node.frameReceived ? String(sensor_node.frameSequence) : String("--");
text += "\n Frames/gaps/errors: ";
text += String(sensor_node.framesReceived);
text += "/";
text += String(sensor_node.framesDropped);
text += "/";
text += String(sensor_node.parseErrors + sensor_node.oversizedFrames);
text += "\n Frame age: ";
text += sensor_node.frameReceived
? String(millis() - sensor_node.lastFrameMs) + " ms"
: String("--");
text += "\n IMU: ";
text += sensor_node.imuOnline && sensor_node.imuValid ? "OK" : "offline";
text += " acc ";
text += String(sensor_node.imuAccuracy);
text += " ";
text += sensor_node.stability;
text += "\n Pitch/roll: ";
text += String(sensor_node.pitchDegrees, 1);
text += " / ";
text += String(sensor_node.rollDegrees, 1);
text += sensor_node.levelCalibrationValid ? " deg calibrated" : " deg raw";
text += "\n GPS: ";
text += sensor_node.gpsOnline ? (sensor_node.gpsFix ? "fix" : "no fix") : "offline";
text += " sats ";
text += String(sensor_node.satellites);
text += " HDOP ";
text += sensor_node.hdop > 0 ? String(sensor_node.hdop, 1) : String("--");
text += "\n Position: ";
if (sensor_node.gpsFix) {
text += String(sensor_node.latitude, 6);
text += ", ";
text += String(sensor_node.longitude, 6);
} else {
text += "--";
}
text += "\n Speed: ";
text += sensor_node.gpsFix ? String(sensor_node.speedKph, 1) + " km/h" : String("--");
text += "\n\nCargo ESP\n";
text += " Version: ";
text += status_model.firmware_version;
@@ -2624,6 +2675,7 @@ void setup()
Serial.println("Target: Waveshare ESP32-S3 Touch LCD 5B");
Serial.println("Display: 1024x600");
Serial.println("API Base: /api/v1");
initSensorNodeRs485();
load_dashboard_connection_config();
@@ -2659,6 +2711,7 @@ void loop()
process_pending_relay_command();
poll_status_api();
process_obd_can();
processSensorNodeRs485();
process_dashboard_page_switch();