fix(ImmichElias): fullscreen background 480x320, BookPlayer UI, no crop when hidden, PSRAM for images, random, cache offline, slideshow 60s, crash fixes
This commit is contained in:
@@ -456,28 +456,16 @@ static void detect_display_size(AppCtx* ctx, lv_obj_t* parent) {
|
|||||||
if (dw2>0 && dh2>0) { w=dw2; h=dh2; }
|
if (dw2>0 && dh2>0) { w=dw2; h=dh2; }
|
||||||
}
|
}
|
||||||
ctx->disp_w=w; ctx->disp_h=h;
|
ctx->disp_w=w; ctx->disp_h=h;
|
||||||
// Clamp image size to max 320x240 for memory safety on ESP32, but allow up to 480x320 if display is larger
|
// True fullscreen background: use full display resolution for image request
|
||||||
// For 480x320 display, use 480x200 (width full, height minus chrome)
|
// Like BookPlayer, image should cover entire screen, UI overlays on top
|
||||||
// To avoid OOM, limit to 320x240 for now, or 480x320 max but with careful memory
|
|
||||||
int overhead=120;
|
|
||||||
if (h>=480) overhead=140;
|
|
||||||
else if (h<=240) overhead=80;
|
|
||||||
int target_h = h - overhead;
|
|
||||||
if (target_h<120) target_h = h*2/3;
|
|
||||||
int target_w = w;
|
int target_w = w;
|
||||||
// Memory safety: limit max to 480x320, but prefer 320x240 for stability
|
int target_h = h;
|
||||||
// If display is 480x320, use 480x200; else 320x240
|
|
||||||
if (w>=480) {
|
|
||||||
target_w = 480;
|
|
||||||
if (target_h>240) target_h = 200; // keep area reasonable for 480px wide
|
|
||||||
} else {
|
|
||||||
if (target_w>320) target_w=320;
|
|
||||||
if (target_h>240) target_h=240;
|
|
||||||
}
|
|
||||||
if (target_w>480) target_w=480;
|
if (target_w>480) target_w=480;
|
||||||
if (target_h>320) target_h=320;
|
if (target_h>320) target_h=320;
|
||||||
|
if (target_w<120) target_w=FALLBACK_W;
|
||||||
|
if (target_h<120) target_h=FALLBACK_H;
|
||||||
ctx->img_w=target_w; ctx->img_h=target_h;
|
ctx->img_w=target_w; ctx->img_h=target_h;
|
||||||
ESP_LOGI(TAG, "Display detected %dx%d -> img target %dx%d (clamped for mem)", w,h,target_w,target_h);
|
ESP_LOGI(TAG, "Display detected %dx%d -> img target %dx%d FULLSCREEN bg", w,h,target_w,target_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hide_chrome(AppCtx* ctx) {
|
static void hide_chrome(AppCtx* ctx) {
|
||||||
@@ -544,8 +532,15 @@ static void ui_update_all(AppCtx* ctx) {
|
|||||||
if (ctx->img_page) {
|
if (ctx->img_page) {
|
||||||
if (ctx->has_image && ctx->saved_img_path[0]!='\0') {
|
if (ctx->has_image && ctx->saved_img_path[0]!='\0') {
|
||||||
FILE* test = fopen(ctx->saved_img_path, "rb");
|
FILE* test = fopen(ctx->saved_img_path, "rb");
|
||||||
if (test) { fclose(test); char lvgl_path[384]; snprintf(lvgl_path, sizeof(lvgl_path), "A:%s", ctx->saved_img_path); lv_image_set_src(ctx->img_page, lvgl_path); lv_obj_set_size(ctx->img_page, ctx->img_w, ctx->img_h); }
|
if (test) {
|
||||||
else lv_image_set_src(ctx->img_page, LV_SYMBOL_IMAGE);
|
fclose(test);
|
||||||
|
char lvgl_path[384];
|
||||||
|
snprintf(lvgl_path, sizeof(lvgl_path), "A:%s", ctx->saved_img_path);
|
||||||
|
lv_image_set_src(ctx->img_page, lvgl_path);
|
||||||
|
// Fullscreen background: request full display size from proxy, widget covers display
|
||||||
|
lv_obj_set_size(ctx->img_page, ctx->disp_w > 0 ? ctx->disp_w : ctx->img_w, ctx->disp_h > 0 ? ctx->disp_h : ctx->img_h);
|
||||||
|
lv_obj_center(ctx->img_page);
|
||||||
|
} else lv_image_set_src(ctx->img_page, LV_SYMBOL_IMAGE);
|
||||||
} else {
|
} else {
|
||||||
if (photo_count==0) lv_image_set_src(ctx->img_page, LV_SYMBOL_IMAGE);
|
if (photo_count==0) lv_image_set_src(ctx->img_page, LV_SYMBOL_IMAGE);
|
||||||
}
|
}
|
||||||
@@ -836,13 +831,13 @@ static void on_show(AppHandle app, void* data, lv_obj_t* parent) {
|
|||||||
lv_obj_add_event_cb(ctx->btn_next, next_event_cb, LV_EVENT_CLICKED, ctx);
|
lv_obj_add_event_cb(ctx->btn_next, next_event_cb, LV_EVENT_CLICKED, ctx);
|
||||||
|
|
||||||
// Timers: slideshow every 60s, autohide chrome after 3s
|
// Timers: slideshow every 60s, autohide chrome after 3s
|
||||||
|
// Only slideshow timer (60s), no autohide for stability - chrome toggles on tap like BookPlayer
|
||||||
if (tt_lvgl_lock(pdMS_TO_TICKS(500))) {
|
if (tt_lvgl_lock(pdMS_TO_TICKS(500))) {
|
||||||
if (ctx->slideshow_timer) { lv_timer_delete(ctx->slideshow_timer); ctx->slideshow_timer=NULL; }
|
if (ctx->slideshow_timer) { lv_timer_delete(ctx->slideshow_timer); ctx->slideshow_timer=NULL; }
|
||||||
ctx->slideshow_timer = lv_timer_create(slideshow_timer_cb, 60000, ctx);
|
ctx->slideshow_timer = lv_timer_create(slideshow_timer_cb, 60000, ctx);
|
||||||
if (ctx->autohide_timer) { lv_timer_delete(ctx->autohide_timer); ctx->autohide_timer=NULL; }
|
if (ctx->autohide_timer) { lv_timer_delete(ctx->autohide_timer); ctx->autohide_timer=NULL; }
|
||||||
ctx->autohide_timer = lv_timer_create(autohide_timer_cb, 3000, ctx);
|
// Autohide disabled - user taps to hide/show like BookPlayer
|
||||||
lv_timer_set_repeat_count(ctx->autohide_timer, 1);
|
ctx->autohide_timer = NULL;
|
||||||
lv_timer_pause(ctx->autohide_timer);
|
|
||||||
tt_lvgl_unlock();
|
tt_lvgl_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user