Skip to content

Enhance documentation and add OTA firmware update manager - #8

Merged
navado merged 5 commits into
mainfrom
claude/explain-codebase-mm8fa8n20mviibyt-Nya5r
Mar 8, 2026
Merged

navado merged 5 commits into
mainfrom
claude/explain-codebase-mm8fa8n20mviibyt-Nya5r

Conversation

@navado

@navado navado commented Mar 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

claude added 5 commits March 8, 2026 18:13
… methods

- Add nRF52840-DK and nRF52840-Feather to supported boards section
- Add board feature matrix table (WiFi/BLE/CAN/LittleFS/mDNS per board)
- Document all three bus/history/* MCP methods with request/response examples
  (bus/history/read for can|nmea|nmea2000|obdii, config/get, config/set)
- Expand I2C sensor reference with full parameter and address lists
- Expand NMEA 0183 sentences table with all 9 sentence types
- Add NMEA 2000 PGN reference table (all 8 supported PGNs)
- Add OBD-II PID category table
- Add Discovery section (mDNS + UDP broadcast)
- Update architecture diagram to include BusHistory and DiscoveryManager
- Update HTTP endpoints table with /bus-history routes
- Add nRF52840 build/flash instructions
- Update metrics/list example to include system.wifi.rssi

https://claude.ai/code/session_01KcwgryFgMCJubfjtwqMnUc
Introduces OTAManager with HTTP Basic Auth (username "admin", password
stored in NVS namespace "ota").  Routes registered on the shared
AsyncWebServer:

  GET  /ota           — upload page (LittleFS /ota.html or built-in form)
  GET  /ota/status    — public JSON: fw version, build date, last result
  POST /ota/update    — authenticated multipart firmware upload + reboot
  GET  /ota/config    — authenticated: reports whether default pwd is set
  POST /ota/config    — authenticated: change OTA password (min 8 chars)

Default password on first boot is "admin" — change it immediately after
flashing via POST /ota/config.  Password persisted to NVS and survives
reboots.  OTAManager is excluded from nRF52 and native (unit-test) builds
via platformio.ini build_src_filter rules.

https://claude.ai/code/session_01KcwgryFgMCJubfjtwqMnUc
All OTA tunables are now set in platformio.ini (esp32_base) and consumed
via preprocessor macros with #ifndef fallback defaults in OTAManager.h:

  OTA_USERNAME          HTTP Basic Auth username       (default: "admin")
  OTA_NVS_NAMESPACE     NVS namespace for password     (default: "ota")
  OTA_NVS_PWD_KEY       NVS key for the password       (default: "password")
  OTA_DEFAULT_PASSWORD  First-boot password            (default: "admin")
  OTA_MIN_PASSWORD_LEN  Minimum new-password length    (default: 8)

Per-board overrides can be added to any [env:*] section in platformio.ini.

https://claude.ai/code/session_01KcwgryFgMCJubfjtwqMnUc
OTAManager's class body is gated on #if BOARD_HAS_WIFI, which is not
defined when NetworkManager.cpp is compiled in the native test environment.
This left OTAManager as an incomplete type and broke all 11 native tests.

Changes:
- NetworkManager.h: wrap OTAManager forward decl, setOTAManager() and
  ota_* member in #ifndef NATIVE_TEST blocks.
- NetworkManager.cpp: same guard around #include "OTAManager.h",
  setOTAManager() impl, and ota_->registerRoutes() call.
- test/stubs/ESPAsyncWebServer.h: add AsyncWebServerResponse stub,
  two-callback on() overload (needed by OTA upload handler signature),
  and authenticate() / requestAuthentication() / beginResponse() stubs.

https://claude.ai/code/session_01KcwgryFgMCJubfjtwqMnUc
- NetworkManager.cpp: include board_config.h before OTAManager.h inside
  the NATIVE_TEST guard so BOARD_HAS_WIFI is defined for ESP32 targets
  (the #if BOARD_HAS_WIFI in OTAManager.h required it to be set first).
- OTAManager.cpp: replace esp_app_get_description() with
  esp_ota_get_app_description(), which is the correct IDF API on
  ESP32-C3/S3 and newer IDF versions.

https://claude.ai/code/session_01KcwgryFgMCJubfjtwqMnUc
@navado navado self-assigned this Mar 8, 2026
@navado
navado merged commit 27b0905 into main Mar 8, 2026
16 checks passed
@navado
navado deleted the claude/explain-codebase-mm8fa8n20mviibyt-Nya5r branch March 8, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants