This commit is contained in:
admin committed 2026-09-11 12:20:25 +07:00
1 parent e76a9c1e9b
commit ad4002ecfb
3 files changed
+12 -9

No files matched your search

+5 -2
View File
@@ -65,13 +65,16 @@ Install via Library Manager (exact names to search for):
| Library | Used for | Notes |
|---|---|---|
| `ArduinoJson` (by Benoit Blanchon) | REST API + WebSocket JSON | v7.x |
| `ESP Async WebServer` (by me-no-dev / ESP32Async fork) | HTTP + WebSocket server | Only needed for stage 2 (`DIAGNOSTIC_MODE 0`). Check current ESP32-S3/Arduino-core-3.x compatibility for whichever fork you install — this ecosystem has had breaking forks; if it doesn't build, the `ESP32Async/ESPAsyncWebServer` fork is the actively maintained one as of this writing. |
| `ArduinoJson` (by Benoit Blanchon) | REST API + WebSocket JSON | v7.x — code uses the current `JsonDocument` API (not the deprecated `StaticJsonDocument`) |
| `ESP Async WebServer` (ESP32Async fork) | HTTP + WebSocket server | Only needed for stage 2 (`DIAGNOSTIC_MODE 0`) |
| `AsyncTCP` | dependency of ESP Async WebServer | matching fork/version to the WebServer library above |
Board package: **esp32 by Espressif Systems**, board = your specific
ESP32-S3 dev board.
Confirmed building clean (no warnings) with: esp32 core 3.3.11,
ArduinoJson (JsonDocument API), ESP_Async_WebServer + Async_TCP.
## Project layout
```
+4 -4
View File
@@ -45,7 +45,7 @@ void WebServerManager::setupRoutes() {
// Basic health check, handy when bringing up a new node in the
// future multi-radar setup.
_server.on("/status", HTTP_GET, [](AsyncWebServerRequest *request) {
StaticJsonDocument<128> doc;
JsonDocument doc;
doc["status"] = "ok";
doc["uptime_ms"] = millis();
String out;
@@ -96,16 +96,16 @@ void WebServerManager::loop() {
void WebServerManager::broadcastFrame(const RadarFrame &frame) {
if (_ws.count() == 0) return; // skip serialization work if nobody's listening
StaticJsonDocument<512> doc;
JsonDocument doc;
doc["sensor"] = "LD2453";
doc["node_id"] = frame.node_id;
doc["sequence"] = frame.sequence_number;
doc["timestamp"] = frame.timestamp_ms;
JsonArray targets = doc.createNestedArray("targets");
JsonArray targets = doc["targets"].to<JsonArray>();
for (uint8_t i = 0; i < frame.targetCount && i < 3; i++) {
const RadarTarget &t = frame.targets[i];
JsonObject jt = targets.createNestedObject();
JsonObject jt = targets.add<JsonObject>();
jt["id"] = i + 1; // radar slot index, NOT a persistent person ID
jt["valid"] = t.valid;
jt["x"] = t.x_mm;
+3 -3
View File
@@ -51,10 +51,10 @@ void ZoneManager::setZone(uint8_t zoneIndex, const Zone &zone) {
}
String ZoneManager::zonesToJson() const {
StaticJsonDocument<512> doc;
JsonDocument doc;
JsonArray arr = doc.to<JsonArray>();
for (uint8_t i = 0; i < MAX_ZONES; i++) {
JsonObject z = arr.createNestedObject();
JsonObject z = arr.add<JsonObject>();
z["id"] = i + 1;
z["x1"] = _zones[i].x1;
z["y1"] = _zones[i].y1;
@@ -68,7 +68,7 @@ String ZoneManager::zonesToJson() const {
}
bool ZoneManager::zonesFromJson(const uint8_t *data, size_t len) {
StaticJsonDocument<512> doc;
JsonDocument doc;
DeserializationError err = deserializeJson(doc, data, len);
if (err) return false;