Skip to content

raft new: an App type question (general, battery) that sets defaults and settings - #12

Merged
robdobsn merged 1 commit into
mainfrom
feature/new-app-type
Oct 27, 2026
Merged

robdobsn merged 1 commit into
mainfrom
feature/new-app-type

Conversation

@robdobsn

Copy link
Copy Markdown
Owner

raft new asks App type after the hardware: general (the questions' own defaults; nothing changes for existing users) or battery (sleeps, wakes to measure and report). The type sets the defaults of the later questions and, together with the connectivity answer and the chip, some generated settings. Every later question still works as usual: a --set answer or a saved answer wins over the type's default.

Phase 1 of devdocs/raft-new-app-types-proposal.md (in this PR), which also plans publishing and gateway types.

battery

  • Defaults: connectivity wifi, no web server, no I2C.
  • With WiFi (SysTypes.json NetMan): "startMode": "onDemand" (the app starts WiFi with {"cmd":"wifiStart"}), wifiSTAFastReconnect with 30 uses before a rescan, no access point or mDNS, and on the esp32c5 "wifiBand": "2g". systypes/Common/features.cmake selects RaftCore's wifi-fast-connect sdkconfig fragment (needs RaftCore from PR #37, merged 2026-10-27).
  • With BLE: advIntervalMs 1000.
  • The generated README gets a "Battery powered app" section: how to start WiFi, and the per-device commands (w, wifiip, MQTT broker) so installation values stay out of SysTypes.
  • deep-sleep-fast-wake and WARN log levels are not set: they are suggested in a comment until their effect is measured (plan §7).

For every type

  • No I2C now gives set(RAFT_DEVICE_MANAGER OFF) (about 100 KB of flash).
  • The NetMan, BLEMan and WebServer blocks are made in Rust (type_settings()) instead of JSON-in-a-string generators. Their text for general is unchanged.
  • The summary shows the type (when not general) and the fragments selected.

Tested

  • Output for general is byte-identical to the previous build for all four connectivity cases (wifi_ble, wifi, ble, none on a FeatherS3 preset), apart from .raftnew.json gaining "app_type": "general".
  • A battery app for the ESP32-C5 (raft new -d --set app_type=battery --set target_chip=esp32c5) builds with ESP-IDF 6.1: 1.29 MB, 27% of the slot free; the build log shows the fragment applied and the generated sdkconfig has CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y and CONFIG_LWIP_DHCP_DOES_NOT_CHECK_OFFERED_IP=y.
  • 148 tests pass (--locked), four new: type defaults and overrides, battery + WiFi (esp32c5 vs esp32s3), battery + BLE, general blocks unchanged.
  • Not done: the hardware measurements in plan §7 (wake-to-IP on a C5, and whether deep-sleep-fast-wake and WARN logging are worth making defaults). No C5 board was attached.

README: the question row, an "App types" section, and raft update-project --set app_type=... behaviour (it changes the generated settings, not already-saved answers).

🤖 Generated with Claude Code

…and settings

- app_type, asked after the hardware: general (the questions' own defaults - nothing changes for existing apps) or
  battery (sleeps, wakes to measure and report). A type sets the defaults of the later questions (type_defaults;
  a --set or saved answer still wins) and, with the connectivity answer and the chip, some generated settings.
- battery: connectivity wifi, no web server, no I2C by default. With WiFi, NetMan starts WiFi on demand, connects
  straight to the remembered AP (wifiSTAFastReconnect, 30 uses), no AP or mDNS, wifiBand 2g on the esp32c5;
  RaftCore's wifi-fast-connect sdkconfig fragment in systypes/Common/features.cmake. With BLE, a 1 s advertising
  interval. The generated README gets a section on the on-demand WiFi and the per-device settings (w, wifiip, MQTT).
- No I2C: set(RAFT_DEVICE_MANAGER OFF) in features.cmake, for every type.
- The NetMan, BLEMan and WebServer SysTypes blocks are made in Rust (type_settings) rather than as JSON-in-a-string
  generators; the text for general is unchanged.
- devdocs/raft-new-app-types-proposal.md: the plan (phase 1 done, phases 2-4 planned).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@robdobsn
robdobsn merged commit 1b017c7 into main Oct 27, 2026
6 checks passed
@robdobsn
robdobsn deleted the feature/new-app-type branch October 27, 2026 10:43
@robdobsn robdobsn mentioned this pull request Oct 28, 2026
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.

1 participant