修复 App 语法报错与命名冲突,彻底在后台命令行成功编译生成 wristband.hex 固件

This commit is contained in:
Antigravity IDE
2026-07-17 09:41:29 +08:00
parent 32e48f0576
commit 7cbd83c40b
6 changed files with 73 additions and 42 deletions

View File

@@ -12,12 +12,9 @@ extern SystemState current_state;
extern volatile u16 ms_tick;
extern volatile bit alarm_flash_flag;
// 克隆的手环出厂物理 ID 地址
#define CLONED_ADDR 0x55AAAA
// 本地私有变量
static u8 sos_last_phase = 99; // 记录上一次发射的 500ms 半周期状态
static u32 alarm_timer_ms = 0; // SOS 马达震动波形计数器
static u32 sos_pulse_timer = 0; // SOS 马达震动波形计数器
static u16 last_run_tick = 0; // 记录上一次轮询的 ticks
// 声明本应用的生命周期回调函数
@@ -43,7 +40,7 @@ static void SOSApp_OnStart(void)
{
current_state = STATE_SOS_EMITTED; // 进入 SOS 紧急求救状态
sos_last_phase = 99;
alarm_timer_ms = 0; // 马达震动计数器清零
sos_pulse_timer = 0; // 马达震动计数器清零
last_run_tick = ms_tick;
UI_ShowSosPage(); // 初始化渲染 SOS 警示主页
@@ -101,12 +98,12 @@ static void SOSApp_onRun(void)
}
last_run_tick = ms_tick;
alarm_timer_ms += tick_diff;
if (alarm_timer_ms >= 1200) {
alarm_timer_ms = 0;
sos_pulse_timer += tick_diff;
if (sos_pulse_timer >= 1200) {
sos_pulse_timer = 0;
}
if (alarm_timer_ms < 1000) {
if (sos_pulse_timer < 1000) {
MOTOR = 1;
} else {
MOTOR = 0;