feat(config): add USE_PCF8563 build switch to run without the RTC chip

Some PCB variants may not populate the PCF8563. Guards RTC init/read
in HomeApp_OnStart(), the WriteDateTime() save in SetClockApp, and the
I2C/RTC diagnostic scans in Self_Test() behind #if USE_PCF8563. When
disabled, the firmware runs entirely on the Timer1-driven software
clock; date/time just won't survive a power cycle without the chip.
This commit is contained in:
edisondeng
2026-07-31 19:54:18 +08:00
parent 6022f0a409
commit 0ef5991d33
4 changed files with 15 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ static void HomeApp_OnStart(void)
current_state = STATE_NORMAL; // 系统切入正常待机状态
RF_SetMode(1); // 开启天线并置为接收模式,监听无线探测器
#if USE_PCF8563
// 尝试从 PCF8563 RTC 芯片中读取硬件时间与日期 (具备非阻塞防卡死保护)
if (PCF8563_Init()) {
PCF8563_ReadDateTime(&current_hour, &current_min, &current_sec, &current_day, &current_month, &current_year);
@@ -52,6 +53,9 @@ static void HomeApp_OnStart(void)
} else {
XTELL_LOG("[HomeApp] RTC Hardware Offline, using system clock.\r\n");
}
#else
XTELL_LOG("[HomeApp] USE_PCF8563=0, running on software clock only.\r\n");
#endif
// 绘制并渲染待机时钟主页面画面
UI_ShowClockPage(current_state, current_hour, current_min, current_weekday, current_day, current_month);