implement more
This commit is contained in:
1 parent
7d82dace58
commit
afff934e77
4 files changed
+129
-32
No files matched your search
+33
-8
@@ -46,10 +46,21 @@ WebServerManager webServer(zoneManager);
|
||||
|
||||
void printDiagnostics(const RadarFrame &frame, const LD2453Stats &stats) {
|
||||
Serial.println();
|
||||
Serial.println(F("LD2453 connected"));
|
||||
Serial.print(F("UART: "));
|
||||
Serial.println(F("========================================"));
|
||||
Serial.print(F("LD2453 Status: "));
|
||||
if (radar.isConnected()) {
|
||||
Serial.println(F("CONNECTED ✓"));
|
||||
} else {
|
||||
Serial.println(F("DISCONNECTED ✗"));
|
||||
}
|
||||
Serial.println(F("========================================"));
|
||||
Serial.print(F("UART Baud: "));
|
||||
Serial.println(RADAR_BAUD_RATE);
|
||||
Serial.print(F("Frame length (last): "));
|
||||
Serial.print(F("Bytes received: "));
|
||||
Serial.println(stats.bytesReceived);
|
||||
Serial.print(F("Frames parsed: "));
|
||||
Serial.println(stats.framesParsed);
|
||||
Serial.print(F("Frame length: "));
|
||||
Serial.println(stats.lastFrameLength);
|
||||
Serial.print(F("Parse errors: "));
|
||||
Serial.println(stats.parseErrors);
|
||||
@@ -66,18 +77,26 @@ void printDiagnostics(const RadarFrame &frame, const LD2453Stats &stats) {
|
||||
|
||||
const RadarTarget &t = frame.targets[i];
|
||||
if (!t.valid) {
|
||||
Serial.println(F("INVALID"));
|
||||
Serial.println(F(" INVALID"));
|
||||
continue;
|
||||
}
|
||||
Serial.print(F("X: "));
|
||||
Serial.print(F(" X: "));
|
||||
Serial.print(t.x_mm);
|
||||
Serial.println(F(" mm"));
|
||||
Serial.print(F("Y: "));
|
||||
Serial.print(F(" Y: "));
|
||||
Serial.print(t.y_mm);
|
||||
Serial.println(F(" mm"));
|
||||
Serial.print(F("Speed: "));
|
||||
Serial.println(t.speed);
|
||||
Serial.print(F(" Speed: "));
|
||||
Serial.print(t.speed);
|
||||
Serial.println(F(" cm/s"));
|
||||
Serial.print(F(" Distance: "));
|
||||
Serial.print(t.distance_mm, 1);
|
||||
Serial.println(F(" mm"));
|
||||
Serial.print(F(" Angle: "));
|
||||
Serial.print(t.angle_deg, 1);
|
||||
Serial.println(F(" deg"));
|
||||
}
|
||||
Serial.println(F("========================================"));
|
||||
}
|
||||
|
||||
void setup() {
|
||||
@@ -166,6 +185,12 @@ void loop() {
|
||||
if (now - lastStatsReport >= 5000) { // every 5 seconds
|
||||
const LD2453Stats &stats = radar.getStats();
|
||||
Serial.println(F("\n--- Periodic Status ---"));
|
||||
Serial.print(F("LD2453 Connection: "));
|
||||
if (radar.isConnected()) {
|
||||
Serial.println(F("OK ✓"));
|
||||
} else {
|
||||
Serial.println(F("LOST ✗"));
|
||||
}
|
||||
Serial.print(F("Bytes received: "));
|
||||
Serial.println(stats.bytesReceived);
|
||||
Serial.print(F("Frames parsed: "));
|
||||
|
||||
Reference in new issue
Block a user