Skip to content

Harden Host AP startup and event lifecycle - #1434

Open
p-keminer wants to merge 2 commits into
justcallmekoko:developfrom
p-keminer:fix/host-ap-lifecycle
Open

Harden Host AP startup and event lifecycle#1434
p-keminer wants to merge 2 commits into
justcallmekoko:developfrom
p-keminer:fix/host-ap-lifecycle

Conversation

@p-keminer

Copy link
Copy Markdown

Summary

  • check the WiFi.softAP() result and keep failures visible until acknowledged
  • report AP-mode IP and MAC values instead of station values
  • register and remove AP event callbacks with the actual Host AP lifecycle

Testing

  • Focused ESP32-C5 hardware tests covered failed and successful SoftAP startup, AP IP/MAC reporting, persistent failure acknowledgement, Host AP Info exit/re-entry, client connect/disconnect, shutdown, and AP restart without duplicate callbacks or UI corruption.

Copilot AI lite review requested due to automatic review settings August 9, 2026 18:44
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.40%. Comparing base (66f3c81) to head (5fd3b41).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
esp32_marauder/WiFiScan.cpp 0.00% 72 Missing ⚠️
esp32_marauder/MenuFunctions.cpp 0.00% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #1434      +/-   ##
==========================================
- Coverage     0.40%   0.40%   -0.01%     
==========================================
  Files           20      20              
  Lines        17176   17239      +63     
  Branches        11      11              
==========================================
  Hits            69      69              
- Misses       17103   17166      +63     
  Partials         4       4              
Flag Coverage Δ
firmware-unit-tests 0.40% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request hardens the ESP32 Marauder Host AP (SoftAP) startup path and aligns AP-related WiFi event callback registration/unregistration with the AP lifecycle, while also correcting which IP/MAC values are reported when running in AP mode.

Changes:

  • Adds explicit SoftAP start-result handling, including failure reporting and cleanup when WiFi.softAP() fails.
  • Updates network info reporting to use AP IP/MAC values when in AP mode, and adjusts UI messaging accordingly.
  • Introduces explicit register/unregister helpers for WiFi event callbacks and ties them to AP start/stop paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
esp32_marauder/WiFiScan.h Adds state + helper declarations for managing WiFi event handler registration.
esp32_marauder/WiFiScan.cpp Implements AP-aware network info reporting, SoftAP start failure handling, and lifecycle-managed event handler registration/unregistration.
esp32_marauder/MenuFunctions.cpp Adds a touch acknowledgement helper and surfaces AP start failure feedback in the touch UI flow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread esp32_marauder/WiFiScan.cpp

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

esp32_marauder/WiFiScan.cpp:2255

  • On SoftAP startup failure, the code stops the AP and clears state but leaves the Arduino WiFi stack in AP mode (since WiFi.mode(WIFI_MODE_AP) was set earlier). This can keep the radio configured/on unexpectedly and make later mode checks misleading. Consider explicitly turning WiFi off (or restoring the prior mode) on this failure path, consistent with shutdownWiFi() using WiFi.mode(WIFI_OFF) for cleanup.
    this->unregisterWiFiEventHandler();
    WiFi.softAPdisconnect(true);
    this->connected_network = "";

esp32_marauder/MenuFunctions.cpp:2587

  • startWiFi() now returns false when SoftAP startup fails, but only the touch-keyboard path handles that failure. The HAS_MINI_KB path a few lines above still calls wifi_scan_obj.startWiFi(...) without checking the return value and immediately changes menus, which can hide the failure and leave the UI implying the AP started. Consider adding an equivalent acknowledgement/handling for the mini keyboard flow as well (not just the touch flow).
              const bool access_point_started = wifi_scan_obj.startWiFi(ssids->get(i).essid, String(passwordBuf));
              if (!access_point_started)
                waitForTouchAcknowledgement("AP start failed");

@p-keminer

Copy link
Copy Markdown
Author

All 22 firmware matrix builds and the Native Unity tests pass on this head. The remaining red statuses are limited to the repository-wide Codecov policy addressed separately in #1448.

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