Files
trail-mate/docs/UI_SHARED_IDF_PHASE_PLAN.md
T
vicliu d320b6511d Unify PlatformIO and ESP-IDF around a shared UI/runtime shellRefactor/repo structure (#11)
* Unify PlatformIO and ESP-IDF around a shared UI/runtime shell
2026-03-12 01:17:46 +08:00

9.1 KiB

UI Shared / IDF ???????

?????? UI ?????apps/* ??????? ESP-IDF ????????????

???????

  • ????????????????????????
  • ???? apps/esp_pio?apps/esp_idf?modules/ui_shared ?????????????
  • PlatformIO ? ESP-IDF ??????? shared UI/page/runtime ????

1. ???

??????????????????????????????

  1. ?????????????????????? modules/ui_shared
  2. ??????apps/esp_pio ? apps/esp_idf ??? startup / loop / runtime / adapter ????
  3. ????????? PIO / IDF ????? platform/* ? app runtime adapter ????????????

2. ????

2.1 ??????

???????????????

  • ??????????? modules/ui_shared
  • *_page_shell.cpp ???????host ???fallback ??
  • ???? shell ??????????????
  • ???? apps/esp_pio ? apps/esp_idf ?????????

2.2 apps ?????????

apps/esp_pio ? apps/esp_idf ??????

  • ????startup / boot / menu ????
  • loop ??????tick???
  • runtime access??????????????????
  • facade/runtime adapter???????? shared ??? shared ?????

??????

  • ????
  • ????
  • ???????
  • ??????
  • ???? wrapper ????

2.3 ???? placeholder ??????

?????????????????? shared ???????????????????

placeholder ??????

  • ?????????????
  • ??????????????????????
  • ??????????? runtime/capability ??????

placeholder ???????????????

2.4 PIO / IDF ??????

?????????????????????

  • apps/esp_pio ????
  • apps/esp_idf ????
  • ??????????? shared ??
  • ?? runtime adapter ? PIO / IDF ??????????? capability gating

2.5 ????????? profile ??

???????? profile / runtime config ???????????????????????

????

  • tab5 ??????? tdeck ?????????? pager
  • topbar???? icon card???/???????? shared profile ????

3. ???????2026-03-11?

3.1 ??? shared shell ??????

????????????????? shared shell + runtime/components/controller ???

  • Settings
  • Chat
  • GPS / Map
  • GNSS Sky Plot
  • Contacts
  • Team
  • Tracker
  • PC Link
  • USB
  • SSTV
  • Energy Sweep
  • Walkie Talkie

???

  • ?????????????? shared ????
  • ???????????????????? shared capability-gated fallback ??

3.2 apps ?????

?? apps/esp_pio/src ????????????????

  • startup_runtime.cpp
  • loop_runtime.cpp
  • app_runtime_access.cpp
  • app_registry.cpp
  • arduino_entry.cpp
  • app_context.cpp

?? apps/esp_idf/src ?????????????????

  • startup_runtime.cpp
  • loop_runtime.cpp
  • app_runtime_access.cpp
  • app_registry.cpp
  • runtime_config.cpp
  • app_facade_runtime.cpp
  • idf_entry.cpp
  • idf_component_anchor.cpp

?????

  • ?? 5 ??? IDF retired stub ?????
  • modules/ui_shared ??? ui_common_stub.cpp / ui_status_stub.cpp ????? 6 ??
  • apps/esp_pio/src ?? ui_*.cpp ?? wrapper ??

3.3 ????????

  • ????? shared ?????Settings?Chat?Contacts?Team
  • ??? shared shell / runtime ?????????????? 4 ?????GPS / Map?GNSS Sky Plot?Tracker?PC Link / USB?SSTV?Energy Sweep?Walkie Talkie
  • ??? shared shell ??????? capability-gated ?????? ui/screens/common/page_shell_fallback.h

4. ???????


?? 0??????????

??

???????????????????????????? / adapter / stub ???

????

  • ????????????
  • ???? app ?????
  • ??????? shared shell ??????

????

  • ???

?? 1?apps ???????

??

? apps/esp_pio ? apps/esp_idf ???????? + runtime ????????? wrapper ??????

???

  1. ?? app_catalog / menu / startup / loop ??? shared ??
  2. ?? apps/esp_pio ???? page wrapper / registry ????
  3. ?? app_runtime_access ???????????????????
  4. ?? esp_pio / esp_idf ? startup / loop / event ????

????

  • apps/esp_pio / apps/esp_idf ???????????
  • app_runtime_access ?? lifecycle / runtime access
  • ????????? shared app catalog / shared shell ????

????

  • ????2026-03-11?
  • apps/esp_pio/src ? apps/esp_idf/src ??????????
  • apps/esp_pio/src ?? ui_*.cpp ?? wrapper ??
  • startup / loop / menu / runtime access ??? shared shell ????

?? 2???????????

??

????????????

  • shell???? / host / fallback
  • components / controller / runtime????? shared ??

???

  1. ?????? shell + components/runtime ??
  2. ?? shell ???????????
  3. ????????? shared app catalog / shared page shell ?? shared ??
  4. ?? fallback ????????? runtime ???????

????

  • ?????????????
  • shell ??????????
  • ?????????????????????

????

  • ????2026-03-11?
  • Chat / Contacts / Team / Settings ? shared shell ??? placeholder fallback ?????????? runtime ??
  • ?? capability-gated ?????? page_shell_fallback.h?????????? enter / exit placeholder ??
  • apps ???????????????

?? 3?????????

??

? shared ????????????? adapter / runtime hook ??

???

  1. ? shared UI ???? adapter contract??????
    • restart
    • kv/config persistence
    • screen sleep
    • tone/audio preview
    • GPS runtime control
    • tracker recording runtime hook
    • hostlink / USB capability hook
  2. Arduino ??? platform/esp/arduino_common
  3. IDF ??? platform/esp/idf_common ? apps/esp_idf/*runtime
  4. shared ????? contract?????? ESP ???

????

modules/ui_shared ????????????????

  • <Arduino.h>
  • <Preferences.h>
  • nvs.h
  • esp_system.h
  • ?? board ????

????

  • ????2026-03-10?
  • modules/ui_shared ????????? ESP ???? <Arduino.h>
  • ??? platform/ui/* contract??? device / screen / settings / gps / tracker / hostlink / walkie / sstv / lora / usb_support
  • Arduino ??? platform/esp/arduino_common?IDF ??? platform/esp/idf_common

?? 4???????????

??

??????? capability fallback ????????????????????? shared ?????

?????

  1. Settings ?? adapter ??????
  2. Chat
  3. GPS / Map
  4. GNSS Sky Plot
  5. Contacts / Team / Node Info
  6. Tracker
  7. PC Link / USB
  8. SSTV / Energy Sweep / Walkie Talkie

??????

??????????????????

  • shared ???????????? placeholder
  • PIO / IDF ??????
  • ???? shared ?????
  • ???? runtime / facade adapter ???
  • ????? tab5 ? tdeck ???? profile ??

????

  • ????2026-03-11?
  • Settings?Chat?Contacts?Team ??? shared ???????
  • GPS / Map?GNSS Sky Plot?Tracker?PC Link / USB?SSTV?Energy Sweep?Walkie Talkie ???? 4 ??????????
  • ?? 6 ?????????????????? 4 ?????????

?? 5?IDF ???????

??

? apps/esp_idf ????????? shared ???????????????????

???

  1. ????? stub????? IDF runtime / facade
  2. ? IDF runtime facade ? shared ??????
  3. ?? tab5 profile / topbar / menu layout / page layout ??
  4. ?? capability-based fallback???????????

????

  • tab5 ????? startup shell ????
  • ??????????????
  • ???????????? stub ????
  • ????? capability / adapter ??????????????

????

  • ????2026-03-10?
  • apps/esp_idf ??????? / ?? / ????????????? skeleton ???
  • IDF ????? capability gating ??? Chat / Contacts / Team / Settings ????? shared runtime ????
  • screen_sleep?ui_common?gps_service_api?gps_tracker_overlay?team_ui_store ???? IDF ??
  • tab5 ??????? modules/ui_shared/src/ui/startup_shell.cpp??? menu_runtime.cpp / ui_status.cpp ?????????

?? 6?????????

??

???????????????????????

???

  1. ??????? wrapper / shim / duplicate shell logic
  2. ???? stub ??????
  3. ?? README / ???? / ????
  4. ????????

????

  • ?????? modules/ui_shared
  • app ??????? runtime ??
  • platform ??????????
  • ?????????

????

  • ????2026-03-11?
  • ??? apps/esp_idf/src/*_stub.cpp ? modules/ui_shared/src/ui/*_stub.cpp ?? retired ????
  • idf_component_stub.cpp ????? apps/esp_idf/src/idf_component_anchor.cpp??????? stub?????????
  • TeamUiStoreStub ???? TeamUiMemoryStore?????????????????????
  • Chat / Contacts / Team / Settings ? shared page shell ??? placeholder fallback ?????????? runtime ??
  • ?? capability-gated ??????? ui/screens/common/page_shell_fallback.h
  • apps/esp_pio/src ?? ui_*.cpp ?? wrapper ???apps/esp_idf/src ??????????
  • ?? README?????? build ?????????

5. ??????

????

2026-03-11 ????

  • platformio run -e tdeck
  • idf.py -B build.tab5 -DTRAIL_MATE_IDF_TARGET=tab5 build

????

2026-03-11 ????

  • apps/esp_pio/src ?? ui_*.cpp ?? wrapper ??
  • apps/esp_idf/src ??????????? retired *_stub.cpp ??
  • modules/ui_shared ? capability fallback ?????? helper?????? shell ???? placeholder ??
  • shared ?????????? modules/ui_shared

??????

??????????

  • tab5 ?? shell?????????????? 5 ???????????
  • ???? 6 ??????????helper ???retired ?????????? runtime ??

6. ??????

?? 2026-03-11?

  • ?? 0?1?2?3?5?6 ???
  • ?? 4 ???????????????????????????????

?????

  • ????? UI / app / platform ??????
  • ????????????????????????? 4 ???????????

2026-03-11 阶段 4 完成更新

  • 阶段 4 现已完成。
  • pc_linksstvenergy_sweepwalkie_talkie 的 shared page runtime 现已统一支持 Arduino / ESP-IDF(ESP_PLATFORM) 编译,并通过 platform::ui::* 能力接口决定是否可用。
  • modules/ui_shared/src/ui/app_catalog_builder.cpp 不再把 Walkie Talkie 入口硬编码在 Pager 专属宏后面,菜单入口统一由 shared feature flags 控制。
  • apps/esp_pio/src/app_registry.cpp 已切换到与 apps/esp_idf/src/app_registry.cpp 一致的 platform::ui::* 能力判定,不再在 apps 层维护独立宏分叉。
  • USB 在 IDF 侧当前仍属于 shared shell + capability gate 的特例;真正的 IDF USB / Hostlink / LoRa / Walkie 平台后端对接继续归入阶段 5。
  • 验证已通过:idf.py -B build.tab5 -DTRAIL_MATE_IDF_TARGET=tab5 buildplatformio run -e tdeck