From 30a317dcb6dd40d2eca64aa09fdbe9031c37996f Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Fri, 19 Jun 2026 19:31:23 -0500 Subject: firmware: build fixes — esp_app_format component + forward-declare s_last_painted_seq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two build breaks discovered when actually compiling the prior commits: - main/CMakeLists.txt missing esp_app_format requirement, so esp_app_desc.h couldn't be resolved when app_main.c included it for the boot-time git-hash log. - s_last_painted_seq is referenced inside state_post_handler (reset to 0 on /state wake) but the static was declared further down the file alongside the other /frame state. C requires declaration before use — forward declare it above state_post_handler and keep a stub comment at the original location. --- main/CMakeLists.txt | 6 +++--- main/http_api.c | 17 ++++++----------- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'main') diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 4cd3b9a..ee679a2 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,7 +1,7 @@ idf_component_register( SRC_DIRS "." INCLUDE_DIRS "." - REQUIRES driver esp_driver_i2c esp_driver_jpeg esp_eth esp_event - esp_http_client esp_http_server esp_hw_support esp_lcd - esp_netif esp_pm esp_timer hal json mdns nvs_flash + REQUIRES driver esp_app_format esp_driver_i2c esp_driver_jpeg esp_eth + esp_event esp_http_client esp_http_server esp_hw_support + esp_lcd esp_netif esp_pm esp_timer hal json mdns nvs_flash ) diff --git a/main/http_api.c b/main/http_api.c index 0192f7d..37446af 100644 --- a/main/http_api.c +++ b/main/http_api.c @@ -266,6 +266,10 @@ static esp_err_t config_post_handler(httpd_req_t *req) // ============================================================================ // POST /state // ============================================================================ +// Defined alongside other /frame static state further down — forward +// referenced here because state_post_handler resets it on wake. +static uint32_t s_last_painted_seq; + static esp_err_t state_post_handler(httpd_req_t *req) { char buf[64]; @@ -321,17 +325,8 @@ static esp_err_t respond_status(httpd_req_t *req, const char *status, const char // idle gap until the next request enters. Large idle = Scrypted/network // upstream is the bottleneck; small idle = we're saturating the link. static int64_t s_last_post_us; -// Highest X-Frame-Seq value we've actually painted. With two /frame -// POSTs pipelined over separate sockets the firmware's decoder mutex -// is the serialisation point, but FreeRTOS semaphore acquisition is -// not FIFO — under jitter task B can grab the lock for frame N+1 -// before task A grabs it for frame N. Without a sequence check, the -// later-arriving older frame would paint over the newer one and the -// panel would briefly travel backwards in time. Frames with seq <= -// s_last_painted_seq are acknowledged 200 OK but not painted. Reset -// to 0 on every device wake — Scrypted's counter starts fresh per -// stream so we don't drag a stale comparison forward. -static uint32_t s_last_painted_seq; +// (s_last_painted_seq is forward-declared above state_post_handler; +// description there.) static esp_err_t frame_post_handler(httpd_req_t *req) { -- cgit v1.2.3