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:
@@ -44,16 +44,17 @@ static void HomeApp_OnStart(void)
|
||||
current_state = STATE_NORMAL; // 系统切入正常待机状态
|
||||
RF_SetMode(1); // 开启天线并置为接收模式,监听无线探测器
|
||||
|
||||
// 尝试从 PCF8563 RTC 芯片中读取硬件时间 (具备非阻塞防卡死保护)
|
||||
// 尝试从 PCF8563 RTC 芯片中读取硬件时间与日期 (具备非阻塞防卡死保护)
|
||||
if (PCF8563_Init()) {
|
||||
PCF8563_ReadTime(¤t_hour, ¤t_min, ¤t_sec);
|
||||
PCF8563_ReadDateTime(¤t_hour, ¤t_min, ¤t_sec, ¤t_day, ¤t_month, ¤t_year);
|
||||
Clock_RecalcWeekday(); // 读回的日期可能与软时钟不同,重新算一次星期
|
||||
XTELL_LOG("[HomeApp] RTC Hardware Synced OK!\r\n");
|
||||
} else {
|
||||
XTELL_LOG("[HomeApp] RTC Hardware Offline, using system clock.\r\n");
|
||||
}
|
||||
|
||||
// 绘制并渲染待机时钟主页面画面
|
||||
UI_ShowClockPage(current_state, current_hour, current_min);
|
||||
UI_ShowClockPage(current_state, current_hour, current_min, current_weekday, current_day, current_month);
|
||||
|
||||
// 关断/熄灭 FCOB 双灯条
|
||||
RGB_Send(0, 0, 0, 0, 0, 0);
|
||||
@@ -69,7 +70,7 @@ static void HomeApp_onRun(void)
|
||||
// 软时钟发生分钟改变,需要通知屏幕重画时钟主页
|
||||
if (clock_updated) {
|
||||
clock_updated = 0;
|
||||
UI_ShowClockPage(current_state, current_hour, current_min);
|
||||
UI_ShowClockPage(current_state, current_hour, current_min, current_weekday, current_day, current_month);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ static EventResult HomeApp_onEvent(SystemEvent *evt)
|
||||
}
|
||||
// 布撤防状态切换成功后进行 100ms 短震确认,并重新刷写时钟待机页
|
||||
MOTOR = 1; Delay_ms(100); MOTOR = 0;
|
||||
UI_ShowClockPage(current_state, current_hour, current_min);
|
||||
UI_ShowClockPage(current_state, current_hour, current_min, current_weekday, current_day, current_month);
|
||||
return EVENT_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user