chore: update dependencies and make eventsource use static jsondocument
This commit is contained in:
parent
678a4ba099
commit
3265eec308
2 changed files with 18 additions and 10 deletions
|
@ -30,17 +30,17 @@ build_flags =
|
|||
-DLAST_BUILD_TIME=$UNIX_TIME
|
||||
-DARDUINO_USB_CDC_ON_BOOT
|
||||
-DCORE_DEBUG_LEVEL=0
|
||||
-D DEFAULT_BOOT_TEXT=\"BTCLOCK\"
|
||||
-D CONFIG_ASYNC_TCP_STACK_SIZE=16384
|
||||
-fexceptions
|
||||
build_unflags =
|
||||
-Werror=all
|
||||
-fno-exceptions
|
||||
lib_deps =
|
||||
https://github.com/joltwallet/esp_littlefs.git
|
||||
bblanchon/ArduinoJson@^7.2.1
|
||||
mathieucarbou/ESPAsyncWebServer @ 3.4.5
|
||||
bblanchon/ArduinoJson@^7.3.0
|
||||
mathieucarbou/ESPAsyncWebServer @ 3.6.0
|
||||
robtillaart/MCP23017@^0.8.0
|
||||
adafruit/Adafruit NeoPixel@^1.12.3
|
||||
adafruit/Adafruit NeoPixel@^1.12.4
|
||||
https://github.com/dsbaars/universal_pin#feature/mcp23017_rt
|
||||
https://github.com/dsbaars/GxEPD2#universal_pin
|
||||
https://github.com/tzapu/WiFiManager.git#v2.0.17
|
||||
|
@ -79,9 +79,10 @@ build_flags =
|
|||
-D I2C_SDA_PIN=35
|
||||
-D I2C_SCK_PIN=36
|
||||
-D HAS_FRONTLIGHT
|
||||
-D PCA_OE_PIN=45
|
||||
-D PCA_OE_PIN=48
|
||||
-D PCA_I2C_ADDR=0x42
|
||||
-D IS_HW_REV_B
|
||||
|
||||
lib_deps =
|
||||
${btclock_base.lib_deps}
|
||||
robtillaart/PCA9685@^0.7.1
|
||||
|
@ -100,6 +101,7 @@ build_flags =
|
|||
-D USE_QR
|
||||
-D VERSION_EPD_2_13
|
||||
-D HW_REV=\"REV_A_EPD_2_13\"
|
||||
-D CONFIG_ARDUINO_MAIN_TASK_STACK_SIZE=16384
|
||||
platform_packages =
|
||||
platformio/tool-mklittlefs@^1.203.210628
|
||||
earlephilhower/tool-mklittlefs-rp2040-earlephilhower@^5.100300.230216
|
||||
|
@ -112,6 +114,7 @@ build_flags =
|
|||
-D USE_QR
|
||||
-D VERSION_EPD_2_13
|
||||
-D HW_REV=\"REV_B_EPD_2_13\"
|
||||
-D CONFIG_ARDUINO_MAIN_TASK_STACK_SIZE=16384
|
||||
platform_packages =
|
||||
platformio/tool-mklittlefs@^1.203.210628
|
||||
earlephilhower/tool-mklittlefs-rp2040-earlephilhower@^5.100300.230216
|
||||
|
|
|
@ -30,7 +30,8 @@ TaskHandle_t eventSourceTaskHandle;
|
|||
void setupWebserver()
|
||||
{
|
||||
events.onConnect([](AsyncEventSourceClient *client)
|
||||
{ client->send("welcome", NULL, millis(), 1000); });
|
||||
{ client->send("welcome", NULL, millis(), 1000);
|
||||
});
|
||||
server.addHandler(&events);
|
||||
|
||||
AsyncStaticWebHandler &staticHandler = server.serveStatic("/", LittleFS, "/").setDefaultFile("index.html");
|
||||
|
@ -306,14 +307,18 @@ JsonDocument getLedStatusObject()
|
|||
void eventSourceUpdate() {
|
||||
if (!events.count()) return;
|
||||
|
||||
JsonDocument doc = getStatusObject();
|
||||
doc["leds"] = getLedStatusObject()["data"];
|
||||
static JsonDocument doc;
|
||||
doc.clear();
|
||||
|
||||
JsonDocument root = getStatusObject();
|
||||
|
||||
root["leds"] = getLedStatusObject()["data"];
|
||||
|
||||
// Get current EPD content directly as array
|
||||
std::array<String, NUM_SCREENS> epdContent = EPDManager::getInstance().getCurrentContent();
|
||||
|
||||
// Add EPD content arrays
|
||||
JsonArray data = doc["data"].to<JsonArray>();
|
||||
JsonArray data = root["data"].to<JsonArray>();
|
||||
|
||||
// Copy array elements directly
|
||||
for(const auto& content : epdContent) {
|
||||
|
@ -321,7 +326,7 @@ void eventSourceUpdate() {
|
|||
}
|
||||
|
||||
String buffer;
|
||||
serializeJson(doc, buffer);
|
||||
serializeJson(root, buffer);
|
||||
events.send(buffer.c_str(), "status");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue