feat(ui): show real weekday/day/month on HOME screen instead of placeholder

UI_ShowClockPage()/UI_ShowSetTimePage() now take weekday/day/month(/year)
and build the date bar dynamically via Build_DateString() instead of
the fixed placeholder string. app_home.c reads the full date from RTC
via PCF8563_ReadDateTime() and recalculates weekday since the RTC's
stored date may differ from the software clock's. config.h exposes
current_day/month/year/weekday alongside the existing time fields so
main.c's debug commands don't need a separate include.
This commit is contained in:
edisondeng
2026-07-31 19:43:43 +08:00
parent 81ebf7e302
commit 6baf93c550
5 changed files with 131 additions and 36 deletions

View File

@@ -10,10 +10,13 @@
* @param state 当前的系统运行状态 (STATE_NORMAL/STATE_ARMED/STATE_DISARMED)
* @param hour 当前待显示的小时
* @param min 当前待显示的分钟
* @param weekday 当前星期 (0=周日, ..., 6=周六)
* @param day 当前日 (1~31)
* @param month 当前月 (1~12)
* @details 负责在 120x240 大小的 AMOLED 屏幕上居中绘制巨大的时钟字样,并在顶部
* 绘制对应的状态图标 (如一把打开的锁代表已撤防、闭合的锁代表已布防等)。
*/
void UI_ShowClockPage(SystemState state, u8 hour, u8 min);
void UI_ShowClockPage(SystemState state, u8 hour, u8 min, u8 weekday, u8 day, u8 month);
/**
* @brief 渲染显示传感器对码的二级设备选择菜单页面
@@ -74,19 +77,23 @@ void UI_ShowBindingPage(u32 addr);
void UI_ShowMainMenu(u8 selected_index);
/**
* @brief 渲染显示修改时间页面 (时钟设置编辑状态)
* @brief 渲染显示修改时间/日期页面 (时钟设置编辑状态)
* @param hour 待修改的小时
* @param min 待修改的分钟
* @param selection 当前选中的修改项 (1:修改小时, 2:修改分钟)
* @param day 待修改的日
* @param month 待修改的月
* @param year 待修改的年 (0~99代表 2000~2099)
* @param weekday 根据当前日期算出的星期 (0=周日, ..., 6=周六)
* @param selection 当前选中的修改项 (1:小时, 2:分钟, 3:日, 4:月, 5:年)
* @param blink_on 控制被选中数值以 500ms 周期进行隐现闪烁的周期标志位 (1-显示, 0-消隐)
*/
void UI_ShowSetTimePage(u8 hour, u8 min, u8 selection, u8 blink_on);
void UI_ShowSetTimePage(u8 hour, u8 min, u8 day, u8 month, u8 year, u8 weekday, u8 selection, u8 blink_on);
/**
* @brief 局部刷新时间设置界面里正在调节的那一个字 (小时分钟),用于闪烁/调值时避免整屏重绘
* @param selection 1:刷新小时区域, 2:刷新分钟区域
* @brief 局部刷新时间设置界面里正在调节的那一个字 (小时/分钟/日/月/年),用于闪烁/调值时避免整屏重绘
* @param selection 1:小时, 2:分钟, 3:日, 4:月, 5:年
* @param blink_on 1:显示数值, 0:消隐(涂黑)
*/
void UI_UpdateSetTimeDigit(u8 hour, u8 min, u8 selection, u8 blink_on);
void UI_UpdateSetTimeDigit(u8 hour, u8 min, u8 day, u8 month, u8 year, u8 selection, u8 blink_on);
#endif // __UI_H__