Commit Graph

52 Commits

Author SHA1 Message Date
edisondeng
6baf93c550 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.
2026-07-31 19:43:43 +08:00
edisondeng
81ebf7e302 feat(i18n): add weekday abbreviation strings, remove static date text
Replaces the fixed placeholder STR_CLOCK_DATE ("VEN 10-07"/"FRI 10-07")
with 7 weekday abbreviation strings (FR/EN), ordered Sunday-Saturday to
align with current_weekday's 0-6 convention for direct indexing
(STR_WEEKDAY_SUN + current_weekday).
2026-07-31 19:35:21 +08:00
edisondeng
cb37b1deea feat(clock): add day/month/year rollover and Zeller weekday calc
Extends Clock_IncMS()'s existing sec->min->hour cascade to also roll
day->month->year (with leap-year Feb 29 via Days_In_Month()), and adds
Clock_RecalcWeekday() computing current_weekday via Zeller's congruence
whenever the date changes, rather than trusting PCF8563's own weekday
register (which would drift if the date is edited manually). Verified
the formula against 2026-07-31, a known Friday.
2026-07-31 19:32:44 +08:00
edisondeng
1146bade70 feat(rtc): add PCF8563 full date read/write (day/month/year/weekday)
PCF8563's second/minute/hour/day/weekday/month/year registers are
contiguous (0x02-0x08), so PCF8563_ReadDateTime() bursts all 7 bytes
in one transaction. PCF8563_ReadTime() becomes a thin wrapper that
discards the date fields. WriteTime() is kept as its own 3-byte-only
implementation (writing only sec/min/hour) rather than routed through
the new WriteDateTime(), since forcing it through a 7-byte write would
require synthesizing date values and risk corrupting the stored date;
WriteDateTime() is added as a separate full 7-byte write for callers
that actually have real date+weekday values to persist.
2026-07-31 19:30:02 +08:00
edisondeng
4a55c1f9eb docs: add wo-07 to add real year/month/day/weekday support 2026-07-31 19:26:55 +08:00
edisondeng
983b0928dd docs: mark wo-06 code-complete, pending hardware verification 2026-07-31 19:14:43 +08:00
edisondeng
dac2ea4335 fix(ui): partial-refresh time-set digit blink instead of full screen
UI_ShowSetTimePage() cleared and redrew the entire screen on every
500ms blink toggle and on every up/down value change, causing a
full-screen flash instead of just the intended hour/minute digit
blinking. Split out UI_UpdateSetTimeDigit() which only repaints the
32x32px digit region for the field being edited; the full page draw
is now only used on entry. Field-switch (long-press CONFIRM) refreshes
both digit regions to clear any stale blanked-out state.
2026-07-31 19:14:14 +08:00
edisondeng
d4b89c9336 docs: add wo-06 for time-set screen full-screen flicker fix 2026-07-31 19:10:31 +08:00
edisondeng
05f05177de chore: sync Keil uVision IDE session state 2026-07-31 19:10:00 +08:00
edisondeng
2a83079007 refactor(event): replace global 60s inactivity timer with per-second tick event
Adds KEY_EVENT_SECOND_TICK, generated once per real second from
Clock_IncMS() via a new second_tick_flag and pushed through the normal
event queue, so every foreground App's onEvent() receives it and
decides independently whether to act. Removes the old global
inactivity_timer (60s sleep from anywhere) entirely. HomeApp now
accumulates its own idle-second counter and sleeps after 10s idle
specifically while on the home screen; MenuApp's existing 10s
auto-close is converted from onRun() polling to the same tick+reset
pattern for consistency. Any non-tick key event resets each app's own
counter to 0.
2026-07-31 18:49:03 +08:00
edisondeng
cbd480eea3 docs(main): document 24MHz ISP burn requirement at top of main.c
Confirms via code inspection that the firmware isn't uniformly driven
by MAIN_Fosc: Uart1_Init()'s Timer2 baud-rate reload and rf.c/timer.c's
tick-to-microsecond conversion assume an actual 24MHz clock as
hardcoded constants, not values computed from MAIN_Fosc. Flashing at a
different STC-ISP clock setting would silently break UART baud rate
and RF timing without an obvious compile error.
2026-07-31 18:28:52 +08:00
edisondeng
f9bea08375 docs: mark wo-05 all 6 items code-complete, pending hardware test 2026-07-31 18:15:24 +08:00
edisondeng
79d604a387 fix(sleep): pin P3.6 to a fixed rising-edge trigger before Power Down
RF_HandleEdgeInterrupt()'s software ping-pong toggle can leave P3IM0
parked in either edge direction while awake; Enter_Low_Power_Sleep()
never reset it, so sleep entry could randomly land on a direction that
misses the wake edge. Per the datasheet truth table (WO-04 2.9), only
edge modes support power-down wake, not level modes, so this forces a
known rising-edge state (matching RF_Init()'s own boot default) instead
of switching to level-triggered as originally requested. wo-05 updated
to record the deviation and rationale.
2026-07-31 18:14:22 +08:00
edisondeng
ae235d3c51 feat(menu): auto-close main menu after 10s idle
menu_app now tracks the last key-activity timestamp (via current_sec,
same wraparound-safe pattern already used in pair_app) and switches
back to home_app if no key event arrives for 10 seconds, using the
AppManager's existing per-frame onRun() callback as the check point.
2026-07-31 18:11:55 +08:00
edisondeng
a771d1a970 fix(language): default to English instead of French
Both the static initializer and Lang_Init()'s erased-flash fallback
now default to LANG_EN, so first boot / never-written flash shows
English instead of French.
2026-07-31 18:10:22 +08:00
edisondeng
ec556fdd2a fix(boot): hold backlight off until first frame is drawn
SGM_CTRL was turned on at the very start of LCD_Init(), before the
ST7789V register sequence and first frame ran, showing garbage/blank
content briefly on every boot. GPIO_Init() now forces backlight off at
power-on, LCD_Init() no longer touches it, and main() only turns it on
right before entering the main loop (after HomeApp's first frame is
drawn). Wakeup_Restore()'s existing on-then-reinit sequence is
untouched since it sets the level itself before calling LCD_Init().
2026-07-31 18:09:39 +08:00
edisondeng
56b92a8ede refactor(app): App-per-screen navigation, remove menu_level entirely
Splits the ad-hoc menu_level state machine into standalone Apps with a
uniform parent/child exit convention (long-press CONFIRM -> parent):
clock_app renamed to home_app (boot-default), new set_clock_app
extracted from home_app's time-edit mode, new ipc_bind_app extracted
from menu_app's old level-2 screen, and the sensor-type selection step
merged into pair_app as its new initial state. menu_app now only holds
the 4-item top-level list (language toggle inline). Also makes both
menu_app and pair_app's up/down navigation cyclic (wraps at both ends).
2026-07-31 18:05:23 +08:00
edisondeng
655d29bbe1 docs: rename clock_app to home_app, add set_clock_app in wo-05 plan
Confirms clock_app is the boot-default app (main.c:280) and should be
renamed home_app; time editing becomes its own set_clock_app instead
of time_set_app. Drops all remaining menu_level wording, and
cross-references items 1/2 to the renamed APP_ID_HOME/home_app.
2026-07-31 17:52:42 +08:00
edisondeng
653fc85ae5 docs: redesign wo-05 item 3 as App-based menu navigation refactor
Replace the ad-hoc menu_level state machine plan with a uniform
App-per-screen model (home_app/menu_app/time_set_app/pair_app/
ipc_bind_app), each child App exiting to its own parent via long-press
CONFIRM. Folds the sensor-type selection screen into pair_app as a new
initial state, and updates item 5's cyclic-navigation notes to match.
2026-07-31 17:48:33 +08:00
edisondeng
3000780df5 docs: add wo-05 with 6 small UX/wake-reliability fixes to plan
Lists boot-flicker backlight timing, menu idle auto-close, submenu
long-press-confirm exit, default language, cyclic menu navigation, and
P3.6 sleep-wake trigger reliability, each with a brief implementation
approach based on current code.
2026-07-31 17:10:37 +08:00
edisondeng
08dbdabfcb docs(rf): confirm edge-triggered EV1527 decode verified on hardware
Multiple real transmissions (Data=08/04/02/01) decoded correctly and
stably with the ping-pong single-edge trigger fix, no interrupt storm
or crash observed. Closes out the phase-2 RF decode root-cause saga.
2026-07-31 16:52:32 +08:00
edisondeng
4a89aef71e fix(rf): true single-edge P3.6 trigger + pull-down, restore edge decode
Root cause found via datasheet: PxIM0/PxIM1 has no dual-edge mode, only
falling/rising/low-level/high-level. (IM1=1,IM0=1) was actually
high-level interrupt, refiring continuously for the whole high-pulse
duration (confirmed by scope: no real HF noise, and edge_count=0 when
P3.6 grounded). Fix: start in rising-edge mode, software-toggle to the
opposite edge on every trigger (ping-pong) to emulate true dual-edge
triggering, feeding exact edge direction into the incremental decode
state machine (no glitch filter needed). Also switch P3.6 idle bias
from pull-up to pull-down, since floating-high under the old high-level
mode caused the interrupt-storm boot issue; removed the now-conflicting
pull-up restore in Wakeup_Restore().
2026-07-31 16:39:06 +08:00
edisondeng
29194a4f5d debug(rf): revert to polling EV1527_Decode, ISR does pure edge counting
Diagnostic experiment: restore the commit d8df5d4 polling decode
algorithm/thresholds unchanged, while P3.6 ISR now only increments an
edge counter (no decode state machine). Successful decodes print the
edge-count delta over the decode window to compare against the
EV1527 theoretical 50-edges-per-frame, to validate/refute the
edge-interrupt glitch-noise hypothesis.
2026-07-31 15:53:15 +08:00
edisondeng
18d272aac9 chore: sync Keil uVision IDE session state
wristband.uvopt tracks debug/breakpoint/window layout state written by
the Keil IDE; no source or build behavior change.
2026-07-31 15:52:57 +08:00
edisondeng
767aa14086 fix(timer): compensate Timer0_GetTimestamp for pending TF0 overflow
TH0/TL0 torn-read protection didn't cover the case where the hardware
counter already wrapped but Timer0_Isr hasn't run yet to bump
timer0_ovf_count, making the timestamp appear to jump backward by one
overflow period (~32.768ms). Read TF0 under a brief EA guard and treat
a pending-but-unserviced overflow as ovf+1 without clearing it.
2026-07-31 15:52:50 +08:00
edisondeng
3c896ec972 fix(rf): register isr_jump.asm and redirect Port3 vector 40
App/isr_jump.asm was never added to wristband.uvproj, so the Port0/Port2/Port3
hardware vector redirects it defines were never assembled. Port3_Isr (declared
as interrupt 16) never actually ran on real P3 port events, causing the
edge-interrupt-driven RF decode to silently never fire. Adds the missing
CSEG/LJMP redirect for vector 40 and registers the file as FileType=2.
2026-07-31 15:52:43 +08:00
edisondeng
a7a2cc9465 暂存 2026-07-31 13:57:06 +08:00
edisondeng
d8df5d49d3 fix: 修复 main.c/event.c/lcd.c 的中文注释乱码,统一为 UTF-8 编码
lcd.c 原本整体是 GBK 编码,直接转码即可。main.c 与 event.c 曾被
Keil 环境以错误编码保存导致部分注释损坏,本次以历史提交中未损坏的
版本为基底恢复正确注释文本,并将其后新增的真实代码改动(RGB 三色
诊断指令、SOS 按键状态机解锁)对应的注释一并还原,不涉及任何代码逻辑变更。
2026-07-31 09:54:59 +08:00
41bb78aa59 feat: 增加调试串口指令 'q'/'Q',支持自动轮流点亮红、绿、蓝三色以校准物理灯珠通道顺序 2026-07-30 13:46:44 +08:00
be397fba76 feat: 按照要求调整 SOS 期间 RGB 闪烁顺序,并延长闪烁间隔为 300ms 方便人眼分辨 2026-07-30 13:44:09 +08:00
58dfe5bb9c debug: 增加 Loopback_Test 硬件电气回环自检及对应的调试串口指令 'l' 2026-07-29 10:16:05 +08:00
a766ada53d fix: 彻底解开 SOS 求救按键状态机被注释的屏蔽,使按键正常产生求救事件并分发 2026-07-29 10:09:19 +08:00
48db6523fb debug: 增加 KEY_SOS 物理按键开机自检与运行期电平跳变串口调试打印 2026-07-29 10:04:00 +08:00
2f4dd2660d fix: 解锁恢复 SOS 物理按键电平读取逻辑,并添加 GPIO_Init 中对应 P2.6 的上拉配置 2026-07-29 09:57:36 +08:00
0a79e7a3b9 fix: 重构 EV1527 发射时序,使用硬件 Timer0 保证 100% 精准码宽延迟以成功触发接收机 2026-07-29 09:40:54 +08:00
d7cb2ae37f fix: 开机默认挂载后台射频监控应用,修复唤醒/复位后无法识别传感器的问题 2026-07-28 18:34:28 +08:00
8367524eec fix: 完美复原低功耗停机休眠与外部唤醒控制寄存器,修复唤醒死机 2026-07-28 18:22:04 +08:00
d01121e3ae feat: 校准电池电压与ADC2充电检测,重构RGB为Bitbang翻转驱动,并修复RTC晶振起振问题 2026-07-28 18:08:40 +08:00
Antigravity IDE
47bcd252b2 修正1.14寸屏幕垂直偏置并添加自动清屏以清除开机噪声;修正新硬件射频收发引脚对调,低功耗唤醒中断重定向至P3.6中断16;添加一键串口收发诊断测试指令,并临时屏蔽SOS物理按键 2026-07-17 19:43:02 +08:00
Antigravity IDE
7cbd83c40b 修复 App 语法报错与命名冲突,彻底在后台命令行成功编译生成 wristband.hex 固件 2026-07-17 09:41:29 +08:00
Antigravity IDE
32e48f0576 修复 menu_items 未定义错误,并清除旧 uvopt 强制 Keil 重新生成配置 2026-07-17 09:32:44 +08:00
Antigravity IDE
9b6b61739c 同步 wristband.uvopt 配置以确保所有新源文件参与编译 2026-07-17 09:28:57 +08:00
Antigravity IDE
790583781f 修复编译报错:清理 config.h 中的 WristbandApp 重复定义并同步参数声明类型 2026-07-17 09:25:04 +08:00
Antigravity IDE
c0d1fe74f5 重构手环软件架构:实现动态挂载前后台 App 框架,解耦拆分源文件,并引入统一日志宏 xtell.h 2026-07-17 09:08:53 +08:00
Antigravity IDE
8fdbb32f42 fix(rf): 补齐 rf.c 里的 Uart_SendHex32 外部变量声明,修复编译错误 2026-07-16 18:28:53 +08:00
Antigravity IDE
31f5066052 fix(rf): 升级 EV1527 为完整 24 位统一寻址,彻底分清不同按键/型号配对报警的 Bug 2026-07-16 18:25:16 +08:00
Antigravity IDE
731115e09a docs: 为所有代码源文件添加详细中文注释,并在设计文档中纠正GPIO物理引脚映射表 2026-07-16 17:53:44 +08:00
Antigravity IDE
afd59d28ee Configure low-power sleep and wakeup sequences for RF alarm trigger without noise interruption 2026-07-15 17:26:50 +08:00
Antigravity IDE
7292fd0fcb Fix RF noise wake-up bug by sleeping with EA=0 and checking flags directly 2026-07-15 17:16:56 +08:00
Antigravity IDE
601e01e954 Implement low power RF wake-up and filter mechanism 2026-07-15 17:05:22 +08:00