diff --git a/SiFli-SDK b/SiFli-SDK index a78a5c3..81f96e1 160000 --- a/SiFli-SDK +++ b/SiFli-SDK @@ -1 +1 @@ -Subproject commit a78a5c39be9559571369a14c6aaa7802fbe3296a +Subproject commit 81f96e1f99c4629eebb166a05424cff548926859 diff --git a/epdiy-epub/README.md b/epdiy-epub/README.md index e8ca766..e985f3d 100644 --- a/epdiy-epub/README.md +++ b/epdiy-epub/README.md @@ -277,6 +277,7 @@ uint32_t epd_wave_table_get_frames(int temperature, EpdDrawMode mode) return wave_table[i].frame_count; } } + // 默认回退到第一组 p_current_wave_from = (const uint8_t *)(*wave_table[0].wave_table); return wave_table[0].frame_count; } diff --git a/epdiy-epub/lib/Epub/EpubList/EpubReader.cpp b/epdiy-epub/lib/Epub/EpubList/EpubReader.cpp index 8e00bf7..8fa08f4 100644 --- a/epdiy-epub/lib/Epub/EpubList/EpubReader.cpp +++ b/epdiy-epub/lib/Epub/EpubList/EpubReader.cpp @@ -411,12 +411,20 @@ void EpubReader::render_overlay() // 三行布局:3, 5, 4(第三行加了"设置"按钮) const int rows = 3; const int cols[rows] = {3, 5, 4}; - const int gap_h = 20; const int gap_w = 10; - const int row_h = 80; + + // 动态计算 row_h 和 gap_h,确保三行按钮自适应填满 overlay 区域 + const int min_gap = 6; + int avail_for_rows = area_h - (rows + 1) * min_gap; + int row_h = avail_for_rows / rows; + if (row_h > 80) row_h = 80; // 上限,按钮不要太大 + if (row_h < 40) row_h = 40; // 下限,保证可点击 + int gap_h = (area_h - rows * row_h) / (rows + 1); + if (gap_h < 2) gap_h = 2; + int content_h = rows * row_h + (rows + 1) * gap_h; int y0 = area_y + (area_h - content_h) / 2; - if (y0 < area_y + 4) y0 = area_y + 4; + if (y0 < area_y + 2) y0 = area_y + 2; int index = 0; auto fill_label = [&](int idx, char *label, size_t cap) { diff --git a/epdiy-epub/lib/Epub/EpubList/EpubToc.cpp b/epdiy-epub/lib/Epub/EpubList/EpubToc.cpp index d3eb34c..dda43cc 100644 --- a/epdiy-epub/lib/Epub/EpubList/EpubToc.cpp +++ b/epdiy-epub/lib/Epub/EpubList/EpubToc.cpp @@ -196,6 +196,11 @@ void EpubToc::render() draw_button(btn_x0, "上一页", m_bottom_mode && m_bottom_idx == 0); draw_button(btn_x1, "书库", m_bottom_mode && m_bottom_idx == 1); draw_button(btn_x2, "下一页", m_bottom_mode && m_bottom_idx == 2); + + // 注册底部三按钮的触控区域(对应 g_area_array[6,7,8]) + static_add_area(btn_x0, btn_y, btn_w, btn_h, 6); + static_add_area(btn_x1, btn_y, btn_w, btn_h, 7); + static_add_area(btn_x2, btn_y, btn_w, btn_h, 8); } uint16_t EpubToc::get_selected_toc() diff --git a/epdiy-epub/src/epub_mem.c b/epdiy-epub/src/epub_mem.c index 5f150a4..6a1947c 100644 --- a/epdiy-epub/src/epub_mem.c +++ b/epdiy-epub/src/epub_mem.c @@ -84,7 +84,7 @@ rt_uint32_t heap_free_size(void) /*========================================================================== - * FreeType 内存分配适配 + * FreeType ڴ *========================================================================*/ #ifdef PKG_FREETYPE #include diff --git a/epdiy-epub/src/epub_screen.cpp b/epdiy-epub/src/epub_screen.cpp index 1158651..9a31dd4 100644 --- a/epdiy-epub/src/epub_screen.cpp +++ b/epdiy-epub/src/epub_screen.cpp @@ -450,4 +450,4 @@ int handleSettingsPage(Renderer *renderer, UIAction action, bool needs_redraw) break; } return 0; -} \ No newline at end of file +} diff --git a/epdiy-epub/src/reading_settings.cpp b/epdiy-epub/src/reading_settings.cpp index 4136d99..c6ce143 100644 --- a/epdiy-epub/src/reading_settings.cpp +++ b/epdiy-epub/src/reading_settings.cpp @@ -247,7 +247,17 @@ void reading_settings_draw(Renderer *renderer) int page_w = renderer->get_page_width(); int page_h = renderer->get_page_height(); + /* + * 自适应行高:取实际字体行高,但封顶保证 6 个设置项 + 标题 + 提示区都能放进页面。 + * 布局公式:20(top) + line_h*2(title) + 10(sep) + 6*line_h*2(items) + line_h*3(hints) + * = 30 + 17 * line_h ≤ page_h + * => max_line_h = (page_h - 30) / 17 + */ int line_h = renderer->get_line_height(); + int max_lh = (page_h - 30) / 17; + if (max_lh < 20) max_lh = 20; + if (line_h > max_lh) line_h = max_lh; + int y = 20; int x_label = 30; int x_value = page_w * 2 / 5; diff --git a/epdiy-epub/src/type.h b/epdiy-epub/src/type.h index 8c51640..133b121 100644 --- a/epdiy-epub/src/type.h +++ b/epdiy-epub/src/type.h @@ -22,4 +22,4 @@ typedef enum { CHARGING_PAGE, // 充电页面 SHUTDOWN_PAGE // 关机页面 } AppUIState; -#endif \ No newline at end of file +#endif