Skip to content

Refactor core library (constants, endpoint helpers, README, drop ArduinoOTA) - #11

Merged
DTTerastar merged 1 commit into
mainfrom
base-refactor
Jul 24, 2026
Merged

Refactor core library (constants, endpoint helpers, README, drop ArduinoOTA)#11
DTTerastar merged 1 commit into
mainfrom
base-refactor

Conversation

@DTTerastar

Copy link
Copy Markdown
Contributor

Summary

Non-functional core-library cleanup, split out of the Serial Improv work (#3) so it can be reviewed on its own. No behavior change to the WiFi portal or HTTP endpoints.

  • Extract inline string literals into named constants (ERROR_FLASH, ENDPOINT_NOT_FOUND, ERROR_AP_START, JSON templates, content-type strings).
  • Add ensureMainEndpoint() helper and reindent src/ (2-space) with related endpoint/JSON handling cleanup.
  • Rewrite README: expanded usage examples, HTTP API reference, callback docs.
  • Remove the ArduinoOTA example.

Why

The codex/add-serialimprov-... branch had bundled this refactor + whitespace + README rewrite together with the Serial Improv feature. Pulling it into a base PR keeps the feature PR (#3) focused on Serial Improv only.

Testing

  • pio test -e native — JSON encoder tests pass.
  • connect()/portal() logic is unchanged from main (only reindented); the refactor is confined to constants, endpoint helpers, and docs.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DTTerastar, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3dda6ed9-0e0e-424d-bb90-31fad70c0235

📥 Commits

Reviewing files that changed from the base of the PR and between 9bfc9ab and 6efde55.

📒 Files selected for processing (4)
  • README.md
  • examples/ArduinoOTA/ArduinoOTA.ino
  • src/HeadlessWiFiSettings.cpp
  • src/HeadlessWiFiSettings.h
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch base-refactor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…inoOTA example

Non-functional cleanup extracted from the SerialImprov work so it can be
reviewed on its own:

- Extract string literals into named constants (ERROR_FLASH, ENDPOINT_NOT_FOUND,
  ERROR_AP_START, JSON templates, content types).
- Add ensureMainEndpoint() and reindent the source (2-space) with related
  endpoint/JSON handling cleanup.
- Rewrite README with expanded usage, HTTP API reference, and callback docs.
- Remove the ArduinoOTA example.

No behavior change to the WiFi portal or HTTP endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DTTerastar
DTTerastar merged commit 1831b2c into main Jul 24, 2026
2 checks passed
@DTTerastar
DTTerastar deleted the base-refactor branch July 24, 2026 14:43
DTTerastar added a commit that referenced this pull request Aug 2, 2026
Reconstructs Serial Improv support cleanly (the earlier Home Assistant
integration was merged non-functional: it did not compile with Improv enabled,
never serviced the protocol, and reset the device on provisioning).

Serial Improv:
- Non-blocking WiFi callback: save credentials, start WiFi.begin(), return.
  ImprovWiFi::loop() polls WiFi.status() and sends PROVISIONED with the device
  URL. No blocking connect (which caused a task-watchdog reset) and no restart
  (which dropped the serial session).
- serialImprovLoop() serviced from connect()/portal(), so a fresh device can be
  provisioned from the portal before it has credentials.
- Depend on ESPresense/ImprovWiFi (serial-parser frame-desync fix) via
  __has_include, so Improv stays optional.
- Advertise the detected chip family; keep device-info strings in members.
- Guard connect()'s Serial prints while Improv is active.
- SerialImprov and ImprovWithHTTP examples build against the fork and pin the
  tasmota 2023.07.00 platform (ships SPIFFS).

Core refactor (previously #11):
- Named string constants, ensureMainEndpoint(), endpoint/JSON cleanup, 2-space
  reindent, README rewrite, remove the ArduinoOTA example.

Verified on an ESP32-C3: fresh device, IDENTIFY -> AUTHORIZED -> PROVISIONING ->
PROVISIONED in ~3s, device URL returned, correct device name, no reboot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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