diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml index 9d2a0c3..43222d0 100644 --- a/.github/workflows/tagging.yml +++ b/.github/workflows/tagging.yml @@ -37,7 +37,12 @@ jobs: chip: - name: lolin_s3_mini version: esp32s3 + - name: btclock_rev_b + version: esp32s3 epd_variant: [213epd, 29epd] + exclude: + - chip: btclock_rev_b + epd_variant: 29epd steps: - uses: actions/download-artifact@v4 with: diff --git a/dependencies.lock b/dependencies.lock index c645bdf..27f0397 100644 --- a/dependencies.lock +++ b/dependencies.lock @@ -4,6 +4,6 @@ dependencies: source: type: idf version: 4.4.6 -manifest_hash: f4c10dfb616cf7e24f85cb263b8c89ef7d6d8eee64860fd27097b1a83ba56960 +manifest_hash: c799a313787fb26f19e5716786e23d7a9f10f1cd0bbd7bc379c518bb5e67be3e target: esp32s3 version: 1.0.0 diff --git a/platformio.ini b/platformio.ini index 9ec55c0..e693e8a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,7 +15,7 @@ default_envs = lolin_s3_mini_213epd, lolin_s3_mini_29epd, btclock_rev_b_213epd [btclock_base] -platform = espressif32 @ ^6.5.0 +platform = espressif32 @ ^6.6.0 framework = arduino, espidf monitor_speed = 115200 monitor_filters = esp32_exception_decoder, colorize @@ -32,15 +32,15 @@ build_unflags = -fno-exceptions lib_deps = https://github.com/joltwallet/esp_littlefs.git - bblanchon/ArduinoJson@^7.0.3 + bblanchon/ArduinoJson@^7.0.4 esphome/Improv@^1.2.3 mathieucarbou/ESP Async WebServer - adafruit/Adafruit BusIO@^1.15.0 + adafruit/Adafruit BusIO@^1.16.0 adafruit/Adafruit MCP23017 Arduino Library@^2.3.2 adafruit/Adafruit NeoPixel@^1.12.0 https://github.com/dsbaars/universal_pin https://github.com/dsbaars/GxEPD2#universal_pin - https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2 + https://github.com/tzapu/WiFiManager.git#v2.0.17 [env:lolin_s3_mini] extends = btclock_base @@ -104,6 +104,14 @@ build_flags = -D USE_QR -D VERSION_EPD_2_9 +[env:btclock_rev_b_29epd] +extends = env:btclock_rev_b +test_framework = unity +build_flags = + ${env:btclock_rev_b.build_flags} + -D USE_QR + -D VERSION_EPD_2_9 + [env:btclock_s3] extends = btclock_base board = btclock diff --git a/src/lib/webserver.cpp b/src/lib/webserver.cpp index 74e8db1..230fae3 100644 --- a/src/lib/webserver.cpp +++ b/src/lib/webserver.cpp @@ -54,6 +54,13 @@ void setupWebserver() { server.on("/api/lights/color", HTTP_GET, onApiLightsSetColor); server.on("/api/lights", HTTP_GET, onApiLightsStatus); + + #ifdef HAS_FRONTLIGHT + server.on("/api/frontlight/on", HTTP_GET, onApiFrontlightOn); + server.on("/api/frontlight/status", HTTP_GET, onApiFrontlightStatus); + server.on("/api/frontlight/off", HTTP_GET, onApiFrontlightOff); + #endif + // server.on("^\\/api\\/lights\\/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", HTTP_GET, // onApiLightsSetColor); @@ -867,4 +874,37 @@ void eventSourceTask(void *pvParameters) { ulTaskNotifyTake(pdTRUE, portMAX_DELAY); eventSourceUpdate(); } -} \ No newline at end of file +} + +#ifdef HAS_FRONTLIGHT +void onApiFrontlightOn(AsyncWebServerRequest *request) { + frontlightFadeInAll(); + + request->send(200); +} + +void onApiFrontlightStatus(AsyncWebServerRequest *request) { + AsyncResponseStream *response = + request->beginResponseStream("application/json"); + + JsonDocument root; + JsonArray ledStates = root["data"].to(); + + for (int ledPin = 0; ledPin < NUM_SCREENS; ledPin++) { + uint16_t onTime, offTime; + flArray.getPWM(ledPin, &onTime, &offTime); + + ledStates.add(onTime); + } + + serializeJson(ledStates, *response); + + request->send(response); +} + +void onApiFrontlightOff(AsyncWebServerRequest *request) { + frontlightFadeOutAll(); + + request->send(200); +} +#endif \ No newline at end of file diff --git a/src/lib/webserver.hpp b/src/lib/webserver.hpp index c910c3e..95fcda2 100644 --- a/src/lib/webserver.hpp +++ b/src/lib/webserver.hpp @@ -52,4 +52,10 @@ void eventSourceUpdate(); void eventSourceTask(void *pvParameters); void onApiStopDataSources(AsyncWebServerRequest *request); -void onApiRestartDataSources(AsyncWebServerRequest *request); \ No newline at end of file +void onApiRestartDataSources(AsyncWebServerRequest *request); + +#ifdef HAS_FRONTLIGHT +void onApiFrontlightOn(AsyncWebServerRequest *request); +void onApiFrontlightStatus(AsyncWebServerRequest *request); +void onApiFrontlightOff(AsyncWebServerRequest *request); +#endif \ No newline at end of file