mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-07-21 02:51:03 +00:00
* feat(gat562): wire nrf52 board runtime and bluetooth stack
* refactor(chat): align shared BLE cores and nrf meshtastic routing
- extract Meshtastic and MeshCore phone/business flows into shared core_chat BLE cores with owner hook seams for ESP and nRF backends
- replace nrf-specific lite adapters with board/platform adapters that consume shared cores and shared storage contracts
- extend nrf Meshtastic radio path with packet history dedupe, flooding rebroadcast, route discovery/traceroute responses, routing ACK/error handling, observed relay learning, retransmit queueing, and next-hop persistence
- persist nrf device identity and node metadata more explicitly, including next-hop state and node-id initialization support
- move nrf chat/contact/blob storage further toward InternalFS-backed persistence and update contact/node store behavior accordingly
- wire gat562 protocol/app facade pieces to the concrete nrf stores/adapters and add supporting app time-sync hooks used by platform runtimes
- add owner-hook split files and planning/status docs to document the ongoing alignment with the reference meshtastic-firmware multi-platform structure
* Add NRF Fusion Pixel font and fix Meshtastic RX
Integrate Fusion Pixel 8px as the NRF mono UI font stack and switch the mono runtime to a dedicated MonoFont/TextRenderer path that can render ASCII, CJK, and symbols from one asset set.
Add the generated NRF font assets and generator script, including the compact font format with per-glyph advance support, and fix the BDF bitmap parsing bug that previously produced blank ASCII glyphs on device.
Move the LVGL Noto CJK font asset out of shared modules into the ESP-specific platform tree and update the related build/config references so the ESP-only font boundary is explicit and NRF does not compile the LVGL asset by accident.
Update the mono UI runtime to use the new renderer, normalize major menu and title labels to uppercase, and wire the GAT562 UI runtime to the Fusion Pixel font.
Fix the core mesh adapter router so Meshtastic and MeshCore backends can coexist without overwriting each other, and ensure active protocol selection is applied before mesh config changes are pushed into the runtime.
Improve GAT562 runtime diagnostics by mirroring debug output to both Serial and Serial2, logging startup radio configuration, and logging raw RX packets with RSSI/SNR so radio-path issues are visible during bring-up.
Relax SX1262 receive polling so it no longer hard-gates RX handling on DIO1 state alone, avoiding a failure mode where the board appeared alive but never delivered packets into the receive path.
Align the NRF Meshtastic adapter with the working ESP behavior for channel handling: use the default expanded public PSK for an unconfigured primary channel, compute channel hashes from the active preset name or Custom label instead of a hard-coded Primary string, and apply the same logic to self-announcement/NodeInfo packets.
Add protocol-layer Meshtastic RX diagnostics for parse, decrypt, decode, text queueing, app-data queueing, unknown-channel, and dedup events to make packet flow visible while validating interoperability.
Fix early duplicate handling for relayed packets so the first valid packet is still delivered into text processing while later relays are correctly suppressed, which restores Broadcast conversation creation and message visibility in the CHATS page.
* feat(gat562): align nrf ui and meshtastic behavior
* Refine mono UI GPS pages and board diagnostics
* refactor: align board runtimes, GAT562 app shell, and BLE integrations
- migrate ESP board-specific implementations and runtime adapters into boards/*
- continue GAT562/Tab5/UI runtime alignment across app and board layers
- sync BLE and runtime integrations, and apply repository clang-format rules
* Refine gat562 mono UI and persist UI settings
* Fix settings persistence and GNSS UI behavior
* Improve mono UI paging and Meshtastic RX fallback
* Align nRF52 Meshtastic BLE and PKI behavior
* Refine mono UI node and chat interactions
* Fix deferred config persistence on gat562 BLE
* Refine mono node compass and GPS layouts
* Include node position in Meshtastic phone info
* Refactor shared board contracts out of ESP platform layer
* Persist node positions across restarts
* Ignore local compile commands database
* Sync README acknowledgements updates
* Apply CI formatting
* Fix board ownership drift and restore pager walkie support
* Add APRS asset, expand System controls, and harden GAT562 self-position persistence
Bundle the current workspace changes into a single checkpoint covering the in-progress shared UI, settings, and GAT562 runtime work.
What this includes:
- add the APRS asset source and image resource currently used by the shared UI asset set
- extend the shared System/settings flow so vibration and screen brightness can be surfaced through the device runtime and settings UI plumbing
- update the mono 128x64 runtime and the GAT562 platform bindings so the new settings controls are available in the GAT562 experience
- wire the ESP runtime/startup helpers needed to support the same device-runtime settings path on the ESP side
- persist the GAT562 self GPS position into the node store during core service updates so a device that already obtained a fix can retain its own last known position across reboot
- add an explicit node-store flush interface and implement it in both the nRF52 and ESP Meshtastic node-store backends so critical self-position updates can be forced to persistent storage immediately instead of waiting for the normal debounce window
- keep the existing debounced persistence behavior for ordinary node-store churn while allowing targeted immediate flushes for data that would otherwise be easy to lose during restart or power loss
* chore: checkpoint current chat and contacts changes
* perf: reduce chat list and message handling latency
* Align Meshtastic phone sync and chat UI refresh
* Remove key verification UI and hide MC position exchange
* Add T-Deck Pro board bring-up and sync pending UI fixes
* Refactor GAT562 runtime and stabilize Meshtastic BLE
Refactor the GAT562 board runtime by extracting dedicated GPS and input runtime components and routing config application through a focused runtime apply service.
Narrow the nRF52 BLE manager dependencies, rework the Meshtastic BLE transport to better match the Android client handshake, and harden the FromRadio/FromNum flow with improved staging, read pacing, diagnostics, and stack-safe config snapshot generation.
Also repair repository text encoding issues in docs and UI comments, and add Meshtastic BLE timing documentation to capture the expected Android/firmware interaction model for future debugging.
* fix: gat562 settings
* Define LoRa tx power caps per board
* Refine mono conversation bubble focus
* Polish mono conversation and message info layout
* Harden Meshtastic BLE flow and cross-target builds
Adjust the Meshtastic BLE transport timing on nRF52, retain pending FROMNUM notifications, and defer local admin/self replies to reduce request/response races during Android settings flows.
Also make the shared chat/UI code compile across non-nRF targets by gating RTOS and Arduino-only helpers and by updating the team page layout to the current page profile fields.
Note: this does not resolve the gat562 Meshtastic Android settings progress bar issue yet; the BLE/admin response path is improved and instrumented, but the root cause of the stuck loading state remains unresolved.
* Fix GAT562 mono channel slot UI and screen timeout
* Revert Meshtastic BLE hardening changes
Revert b9e20b2662 because it causes app-side configuration reads to hang on GAT562.
This restores the previous Meshtastic BLE timing/notification behavior and also drops the cross-target compatibility adjustments that came with that commit.
* Refactor nrf52 fs helpers and show flash free space
* fix sync node info
* Harden Meshtastic BLE receive path
* Fix Meshtastic nodeinfo persistence
* Persist NodeInfo position updates
* Format files to match CI style
* Prepare 0.1.14-alpha docs and CI
* Fix watch chat build and CI formatting
* Format sources for CI clang-format-14
6.5 KiB
6.5 KiB
A. 全部页面一览(按状态完整覆盖)
设备:2.33-inch 横屏,分辨率 222 x 480
约束:固定 TopBar(Back / Title / Battery)
原则:近距离组队优先使用ESP-NOW,不依赖 LoRa / NFC;配对只在对应页面启用,避免误触和持续耗电。
A0. 全局 UI 骨架(复用)
+------------------------------------------------+
| < Back [ TITLE / CONTEXT ] Bat |
+------------------------------------------------+
| |
| CONTENT AREA |
| |
+------------------------------------------------+
| [ Action 1 ] [ Action 2 ] |
+------------------------------------------------+
A1. Team 状态入口页(未加入)
Title:Team
- 主文案:You are not in a team
- 说明:
- No shared map
- No team awareness
- 主动作:
Create (ESP-NOW)Join (ESP-NOW)
A2. Team 状态入口页(已加入)
Title:Team Status
- 展示字段:
- Team name / Team ID
- Role
- Members / Online
- Security / Epoch
- Sync / Last event
- Team Health:
- Leader online
- Last update age
- stale member count
- 主动作:
View TeamPair MemberLeave
这是判断“队伍是否健康、是否同步完成”的总览页,不承担复杂管理职责。
A3. Team Home(成员与结构)
Title:Team / Leader 或 Team / Member
- 展示字段:
- Team / ID
- Members / Online
- Epoch
- Sync status
- 列表内容:
- 成员名
- 在线状态
- 最近在线时间
- 主动作:
Pair MemberManage(Leader 可见)Leave
说明:户外场景里用户更常停留在地图页或聊天页,因此关键状态不能只靠弹窗提示。
A3b. Pairing(ESP-NOW)
Title:Pairing
- 配对窗口有效期:120 秒
- Leader 侧:
- 广播可加入状态
- 接受加入请求
- 下发密钥和初始快照
- Member 侧:
- 扫描 beacon
- 发送 join 请求
- 等待 Key Distribution
- UI 状态:
ScanningJoin sentWaiting for keysCompletedFailed
- 动作:
CancelRetry
A7. Members 管理页(Leader)
Title:Members
- 列表内容:
- You (Leader)
- 普通成员
- 每个成员带
Select
- 用途:进入单成员详情,发起踢人或转移 Leader。
A8. Member Detail(Leader)
Title:Member: <name>
- 展示:
- Status
- Role
- Device
- Capability(Position / Waypoint 等)
- 动作:
KickTransfer Leader
A9. Kick 确认页
Title:Kick Member
- 文案:
- Remove
<member>from team? - This will update the security round (
epoch). - The removed member will no longer receive team updates.
- Remove
- 动作:
CancelConfirm Kick
A9b. Leave 确认页
Title:Leave team?
- 文案:
- This clears local keys.
- 动作:
CancelLeave
Leave 需要二次确认,避免误触导致本地密钥被清空。
A10. Access Lost(Member:被移除 / 失步 / 异常)
Title:Team
- 状态:Access lost
- 原因:
RevokedOut-of-syncUnknown
- 说明:
- Revoked:被 Leader 移除
- Out-of-sync:队伍已经更新,本机需要同步
- 动作:
Try SyncJoin Another TeamOK
关键点:要明确区分“被踢出”和“epoch 不一致”,减少误判。
B. 页面流转说明(UI 状态机)
B1. 顶层流转
[ Team Menu ]
|
v
[ Team Status ]
|
+--> (not in team) --> [ Create / Join ] -> [ Team Status (joined) ]
|
+--> (joined) -------> [ View Team ] -> [ Team Home ]
B2. Member 加入流程(ESP-NOW)
[ Team Status (not in team) ]
|
v
[ Pairing ]
|
+-- scanning -> join sent -> waiting key -> [ Team Status (joined) ]
|
+-- timeout / cancel --------------------> [ Team Status (not in team) ]
B3. Leader 配对流程(ESP-NOW)
[ Team Status (leader) ]
|
v
[ Pairing ]
|
+-- member joins -> send keys -> [ Team Status ]
|
+-- timeout / cancel ----------> [ Team Status ]
B4. 踢人流程(Leader)
[ Team Home ]
|
v
[ Members ]
|
v
[ Member Detail ]
|
v
[ Kick Confirm ]
|
+-- confirm --> epoch rotate --> [ Team Status ]
C. 涉及的协议(Pager Team Core v0.1)
C1. 主要消息类型
| 类型 | 说明 |
|---|---|
TEAM_KEY_DIST |
通过 ESP-NOW 分发队伍密钥 |
TEAM_KICK |
移除成员 |
TEAM_TRANSFER_LEADER |
转移队长 |
TEAM_STATUS |
队伍状态广播 |
TEAM_POS |
成员位置同步 |
TEAM_WAYPOINT |
队伍航点 |
TEAM_TRACK |
轨迹数据 |
TEAM_CHAT |
队伍聊天 |
v0.2 再考虑把部分消息扩展到 LoRa,v0.1 先把 Join Handshake 和本地状态闭环跑通。
C2. 字段命名约定:epoch / event_seq / msg_id
epoch:密钥轮次,用于选择当前有效 key。event_seq:关键事件序号,只用于关键事件同步,单调递增。msg_id:普通消息去重标识,可选;v0.1可以先不做。
C3. TeamEnvelope
所有 Team 消息统一包在一个外层结构里:
TeamEnvelope {
team_id
epoch
type
sender_id
timestamp
msg_id? // optional
auth // AEAD tag or MAC
payload
}
说明:
event_seq只在关键事件或同步承载关键事件时出现。- Presence / Position 这类消息不要求连续
seq。
C4. Key Events(写入 events.log 的事实源)
v0.1 必须记录的关键事件:
TeamCreated(event_seq=1)MemberAccepted(event_seq++)MemberKicked(event_seq++)LeaderTransferred(event_seq++)EpochRotated(event_seq++)
Key Events 是同步和恢复的依据;Presence / Position / Chat 不属于关键事件。
D. 协议与 UI 的对应关系
D1. Create(ESP-NOW)
- 本地生成
team_id - 初始化
epoch = 1 - 写入本地快照
- 进入
Team Status
D2. Join(ESP-NOW)
- 扫描 Leader 广播
- 发送 Join 请求
- 等待
TEAM_KEY_DIST - 写入初始快照与密钥
- 进入
Team Status
D3. Kick / Leave / Transfer Leader
- 这些都是关键事件
- 必须更新
event_seq - 必要时轮换
epoch - UI 成功态统一回到
Team Status