CUB-230: ESP32 offline status buffering and replay on reconnect
CI/CD / lint-and-typecheck (pull_request) Successful in 9m32s
CI/CD / test (pull_request) Successful in 9m27s
CI/CD / build (pull_request) Failing after 4m49s
CI/CD / deploy (pull_request) Has been skipped

- Add SPIFFS buffer for status entries when MQTT offline
- FIFO eviction when max_buffer_entries exceeded
- Replay buffer on MQTT reconnect
- Configurable buffer size in esp32-config.json
This commit is contained in:
Pip Bot
2026-05-23 07:35:53 +00:00
parent 1a8f67a392
commit 1efd48ed2e
312 changed files with 122258 additions and 56 deletions
@@ -0,0 +1,65 @@
// ArduinoJson - https://arduinojson.org
// Copyright © 2014-2026, Benoit BLANCHON
// MIT License
//
// This example shows how to deserialize a JSON document with ArduinoJson.
//
// https://arduinojson.org/v7/example/parser/
#include <ArduinoJson.h>
void setup() {
// Initialize serial port
Serial.begin(9600);
while (!Serial)
continue;
// Allocate the JSON document
JsonDocument doc;
// JSON input string.
const char* json =
"{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
// Deserialize the JSON document
DeserializationError error = deserializeJson(doc, json);
// Test if parsing succeeds
if (error) {
Serial.print(F("deserializeJson() failed: "));
Serial.println(error.f_str());
return;
}
// Fetch the values
//
// Most of the time, you can rely on the implicit casts.
// In other case, you can do doc["time"].as<long>();
const char* sensor = doc["sensor"];
long time = doc["time"];
double latitude = doc["data"][0];
double longitude = doc["data"][1];
// Print the values
Serial.println(sensor);
Serial.println(time);
Serial.println(latitude, 6);
Serial.println(longitude, 6);
}
void loop() {
// not used in this example
}
// See also
// --------
//
// https://arduinojson.org/ contains the documentation for all the functions
// used above. It also includes an FAQ that will help you solve any
// deserialization problem.
//
// The book "Mastering ArduinoJson" contains a tutorial on deserialization.
// It begins with a simple example, like the one above, and then adds more
// features like deserializing directly from a file or an HTTP request.
// Learn more at https://arduinojson.org/book/
// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤