feat: 校准电池电压与ADC2充电检测,重构RGB为Bitbang翻转驱动,并修复RTC晶振起振问题
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "system.h"
|
||||
#include "../Drivers/rf.h"
|
||||
#include "../Drivers/lcd.h"
|
||||
#include "../Drivers/pcf8563.h"
|
||||
|
||||
// 外部引用的全局系统状态变量
|
||||
extern SystemState current_state;
|
||||
@@ -64,7 +65,17 @@ static void ClockApp_OnStart(void)
|
||||
time_edit_active = 0;
|
||||
current_state = STATE_NORMAL; // 系统切入正常待机状态
|
||||
RF_SetMode(1); // 开启天线并置为接收模式,监听无线探测器
|
||||
UI_ShowClockPage(current_state, current_hour, current_min); // 渲染时钟主页
|
||||
|
||||
// 尝试从 PCF8563 RTC 芯片中读取硬件时间 (具备非阻塞防卡死保护)
|
||||
if (PCF8563_Init()) {
|
||||
PCF8563_ReadTime(¤t_hour, ¤t_min, ¤t_sec);
|
||||
XTELL_LOG("[ClockApp] RTC Hardware Synced OK!\r\n");
|
||||
} else {
|
||||
XTELL_LOG("[ClockApp] RTC Hardware Offline, using system clock.\r\n");
|
||||
}
|
||||
|
||||
// 绘制并渲染待机时钟主页面画面
|
||||
UI_ShowClockPage(current_state, current_hour, current_min);
|
||||
|
||||
// 关断/熄灭 FCOB 双灯条
|
||||
RGB_Send(0, 0, 0, 0, 0, 0);
|
||||
@@ -156,6 +167,9 @@ static EventResult ClockApp_onEvent(SystemEvent *evt)
|
||||
current_state = STATE_NORMAL;
|
||||
RGB_Send(0, 0, 0, 0, 0, 0); // 熄灭蓝色指示灯
|
||||
|
||||
// 同步将最新时间 (hour, min, 0秒) 写入 PCF8563 芯片寄存器
|
||||
PCF8563_WriteTime(current_hour, current_min, 0);
|
||||
|
||||
// 退出短振反馈
|
||||
MOTOR = 1; Delay_ms(50); MOTOR = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user