diff --git a/Tactility/Source/mcp/McpSystem.cpp b/Tactility/Source/mcp/McpSystem.cpp index 552f7e80..8710f589 100644 --- a/Tactility/Source/mcp/McpSystem.cpp +++ b/Tactility/Source/mcp/McpSystem.cpp @@ -1701,10 +1701,11 @@ static void mcp_video_stream_task(void* pvParameters) { } // Yield: longer delay when no client connected to save CPU + // RLCD ST7305 SPI is slow and shared - don't hog LVGL lock (fix freeze) if (mono_client_fd < 0 && color_client_fd < 0) { - vTaskDelay(pdMS_TO_TICKS(50)); + vTaskDelay(pdMS_TO_TICKS(100)); } else { - vTaskDelay(pdMS_TO_TICKS(5)); + vTaskDelay(pdMS_TO_TICKS(30)); } } diff --git a/Tactility/Source/service/displayidle/DisplayIdle.cpp b/Tactility/Source/service/displayidle/DisplayIdle.cpp index 511ca5e7..8f16b307 100644 --- a/Tactility/Source/service/displayidle/DisplayIdle.cpp +++ b/Tactility/Source/service/displayidle/DisplayIdle.cpp @@ -214,7 +214,8 @@ void DisplayIdleService::tick() { } displayDimmed = false; } - } else { + } else if (supportsBacklight) { + // For backlight-capable displays: full idle handling bool charging_blocks = cachedDisplaySettings.disableScreensaverWhenCharging && isDeviceCharging(); if (!displayDimmed && inactive_ms >= cachedDisplaySettings.backlightTimeoutMs) { @@ -227,7 +228,7 @@ void DisplayIdleService::tick() { activateScreensaver(); lvgl::unlock(); if (cachedDisplaySettings.screensaverType == settings::display::ScreensaverType::None) { - if (supportsBacklight && display != nullptr) { + if (display != nullptr) { display->setBacklightDuty(0); } } @@ -240,6 +241,14 @@ void DisplayIdleService::tick() { stopScreensaver(); } } + } else { + // For monochrome/RLCD (no backlight): don't auto-enter screensaver (heavy full_refresh SPI causes freeze) + // Only handle wake if we are somehow dimmed (e.g. MCP left it) + if (displayDimmed && !isMcpActive) { + if (inactive_ms < kWakeActivityThresholdMs) { + stopScreensaver(); + } + } } } diff --git a/Tactility/Source/service/screenshot/ScreenshotTask.cpp b/Tactility/Source/service/screenshot/ScreenshotTask.cpp index 0f9cbdbc..ae924903 100644 --- a/Tactility/Source/service/screenshot/ScreenshotTask.cpp +++ b/Tactility/Source/service/screenshot/ScreenshotTask.cpp @@ -49,7 +49,7 @@ void ScreenshotTask::setFinished() { } static void makeScreenshot(const std::string& filename) { - if (lvgl::lock(50 / portTICK_PERIOD_MS)) { + if (lvgl::lock(300 / portTICK_PERIOD_MS)) { if (lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, filename.c_str())) { LOGGER.info("Screenshot saved to {}", filename); } else { diff --git a/Tactility/Source/service/webserver/WebServerService.cpp b/Tactility/Source/service/webserver/WebServerService.cpp index 32f30916..cdff8449 100644 --- a/Tactility/Source/service/webserver/WebServerService.cpp +++ b/Tactility/Source/service/webserver/WebServerService.cpp @@ -1506,8 +1506,8 @@ esp_err_t WebServerService::handleApiScreenshot(httpd_req_t* request) { // LVGL's lodepng uses lv_fs which requires the "A:" prefix std::string lvgl_screenshot_path = lvgl::PATH_PREFIX + screenshot_path; - // Capture screenshot using LVGL - if (lvgl::lock(pdMS_TO_TICKS(100))) { + // Capture screenshot using LVGL — increased timeout for RLCD monochrome (SPI slow) + if (lvgl::lock(pdMS_TO_TICKS(500))) { bool success = lv_screenshot_create(lv_scr_act(), LV_100ASK_SCREENSHOT_SV_PNG, lvgl_screenshot_path.c_str()); lvgl::unlock(); @@ -1518,7 +1518,7 @@ esp_err_t WebServerService::handleApiScreenshot(httpd_req_t* request) { } LOGGER.info("Screenshot captured successfully"); } else { - LOGGER.error("Could not acquire LVGL lock within 100ms"); + LOGGER.error("Could not acquire LVGL lock within 500ms"); httpd_resp_send_err(request, HTTPD_500_INTERNAL_SERVER_ERROR, "could not acquire LVGL lock"); return ESP_FAIL; }