From d163397de480a872d4dc1f0acf9261ec2f5b690b Mon Sep 17 00:00:00 2001 From: Tony Tran Date: Fri, 11 Sep 2026 13:18:23 +0700 Subject: [PATCH] trae fix --- config.h | 2 +- esp32-s3-ld2453.ino | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index a9d4c23..ae2fd45 100644 --- a/config.h +++ b/config.h @@ -41,7 +41,7 @@ // 1 = print every raw UART frame candidate as hex on the Serial // Monitor (115200). Use this to capture real traffic from the // module so the frame format can be confirmed/reverse-engineered. -#define DEBUG_RADAR_RAW 0 +#define DEBUG_RADAR_RAW 1 // 1 = diagnostic mode only: Serial-only target printout, no Wi-Fi, // no web server, no WebSocket. This is the recommended first diff --git a/esp32-s3-ld2453.ino b/esp32-s3-ld2453.ino index d50c5cd..a470449 100644 --- a/esp32-s3-ld2453.ino +++ b/esp32-s3-ld2453.ino @@ -109,7 +109,24 @@ void loop() { #endif } -#if !DIAGNOSTIC_MODE +#if DIAGNOSTIC_MODE + // Print stats periodically even if no frame is parsed yet + static uint32_t lastStatsReport = 0; + uint32_t now = millis(); + if (now - lastStatsReport >= 5000) { // every 5 seconds + const LD2453Stats &stats = radar.getStats(); + Serial.println(F("\n--- Periodic Status ---")); + Serial.print(F("Bytes received: ")); + Serial.println(stats.bytesReceived); + Serial.print(F("Frames parsed: ")); + Serial.println(stats.framesParsed); + Serial.print(F("Parse errors: ")); + Serial.println(stats.parseErrors); + Serial.print(F("Packets/sec: ")); + Serial.println(stats.packetsPerSecond, 1); + lastStatsReport = now; + } +#else webServer.loop(); #endif }