Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SiFli-SDK
Submodule SiFli-SDK updated 308 files
1 change: 1 addition & 0 deletions epdiy-epub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 11 additions & 3 deletions epdiy-epub/lib/Epub/EpubList/EpubReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions epdiy-epub/lib/Epub/EpubList/EpubToc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion epdiy-epub/src/epub_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ rt_uint32_t heap_free_size(void)


/*==========================================================================
* FreeType 内存分配适配
* FreeType �ڴ��������
*========================================================================*/
#ifdef PKG_FREETYPE
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion epdiy-epub/src/epub_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,4 @@ int handleSettingsPage(Renderer *renderer, UIAction action, bool needs_redraw)
break;
}
return 0;
}
}
10 changes: 10 additions & 0 deletions epdiy-epub/src/reading_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion epdiy-epub/src/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ typedef enum {
CHARGING_PAGE, // 充电页面
SHUTDOWN_PAGE // 关机页面
} AppUIState;
#endif
#endif
Loading