From 0a44e58d4ea3dce7f64f22c17f74586b0a16560d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Jan 2026 13:03:09 +0000 Subject: [PATCH 1/4] Fix WiFi file transfer crash by adding initialization delay Fixed a critical bug where WiFi file transfer would crash and lock the device when accessed directly. The issue was caused by missing initialization time after WiFi.mode(WIFI_STA) call. Root cause: - Hotspot mode includes delay(100) after WiFi.mode(WIFI_AP) to allow hardware initialization - Join Network mode was missing this delay after WiFi.mode(WIFI_STA) - Without the delay, ESP32 WiFi hardware wasn't properly initialized - This caused crashes when starting the web server in STA mode Fix: - Added delay(100) after WiFi.mode(WIFI_STA) in onNetworkModeSelected() - Matches the proven initialization pattern used in hotspot mode - Comment added to explain the purpose of the delay This explains why going to hotspot first and exiting worked - hotspot mode properly initialized the WiFi hardware, which remained stable for subsequent file transfer operations. --- src/activities/network/CrossPointWebServerActivity.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/activities/network/CrossPointWebServerActivity.cpp b/src/activities/network/CrossPointWebServerActivity.cpp index dde05614..8110f73a 100644 --- a/src/activities/network/CrossPointWebServerActivity.cpp +++ b/src/activities/network/CrossPointWebServerActivity.cpp @@ -138,6 +138,7 @@ void CrossPointWebServerActivity::onNetworkModeSelected(const NetworkMode mode) // STA mode - launch WiFi selection Serial.printf("[%lu] [WEBACT] Turning on WiFi (STA mode)...\n", millis()); WiFi.mode(WIFI_STA); + delay(100); // Allow WiFi hardware to initialize before proceeding state = WebServerActivityState::WIFI_SELECTION; Serial.printf("[%lu] [WEBACT] Launching WifiSelectionActivity...\n", millis()); From 6d12c3a6fbb44633aabd43b1b332bb90d4f5eeaa Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Jan 2026 13:10:56 +0000 Subject: [PATCH 2/4] Fix WiFi file transfer crash by disabling WiFi sleep early The previous commit added an initialization delay, but the device was still crashing with a store access fault during web server operation. The root cause was WiFi sleep mode causing instability in the ESP32 WiFi/TCP stack. Root cause analysis: - WiFi.setSleep(false) was only called when web server started - By that time, WiFi operations had already occurred with sleep mode enabled - WiFi sleep mode can cause memory corruption and crashes in the WiFi stack - The crashes manifested as "Store access fault" errors during web server operation Why hotspot-first workaround worked: - Hotspot mode initialized WiFi and called setSleep(false) via web server - This properly configured the WiFi hardware - When switching to STA mode later, WiFi stack remained stable - Direct STA mode start didn't have this initialization, causing crashes Fix: - Added WiFi.setSleep(false) immediately after WiFi.mode() in both STA and AP paths - This disables sleep mode before any WiFi operations occur - Prevents WiFi stack instability and memory corruption - Matches the critical importance noted in CrossPointWebServer.cpp:54-55 Files changed: - CrossPointWebServerActivity.cpp:142 - STA mode path - CrossPointWebServerActivity.cpp:191 - AP mode path (for consistency) --- src/activities/network/CrossPointWebServerActivity.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/activities/network/CrossPointWebServerActivity.cpp b/src/activities/network/CrossPointWebServerActivity.cpp index 8110f73a..7c492863 100644 --- a/src/activities/network/CrossPointWebServerActivity.cpp +++ b/src/activities/network/CrossPointWebServerActivity.cpp @@ -139,6 +139,7 @@ void CrossPointWebServerActivity::onNetworkModeSelected(const NetworkMode mode) Serial.printf("[%lu] [WEBACT] Turning on WiFi (STA mode)...\n", millis()); WiFi.mode(WIFI_STA); delay(100); // Allow WiFi hardware to initialize before proceeding + WiFi.setSleep(false); // Disable WiFi sleep immediately to prevent crashes state = WebServerActivityState::WIFI_SELECTION; Serial.printf("[%lu] [WEBACT] Launching WifiSelectionActivity...\n", millis()); @@ -187,6 +188,7 @@ void CrossPointWebServerActivity::startAccessPoint() { // Configure and start the AP WiFi.mode(WIFI_AP); delay(100); + WiFi.setSleep(false); // Disable WiFi sleep immediately to prevent crashes // Start soft AP bool apStarted; From 1c6a2c29423990a39b37d19beb0913e0eb85d344 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Jan 2026 13:22:49 +0000 Subject: [PATCH 3/4] Add manual build workflow for testing firmware --- .github/workflows/manual-build.yml | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/manual-build.yml diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml new file mode 100644 index 00000000..1a07a7c3 --- /dev/null +++ b/.github/workflows/manual-build.yml @@ -0,0 +1,47 @@ +name: Manual Build Firmware + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to build' + required: true + default: 'claude/fix-firmware-bug-fVdvb' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.inputs.branch }} + submodules: recursive + + - uses: actions/cache@v5 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + + - uses: actions/setup-python@v6 + with: + python-version: '3.14' + + - name: Install PlatformIO Core + run: pip install --upgrade platformio + + - name: Build CrossPoint + run: pio run -e default + + - name: Upload Firmware Artifact + uses: actions/upload-artifact@v4 + with: + name: crosspoint-firmware-${{ github.event.inputs.branch }} + path: | + .pio/build/default/bootloader.bin + .pio/build/default/firmware.bin + .pio/build/default/firmware.elf + .pio/build/default/partitions.bin + retention-days: 7 From 670a4cd3bfed10b9029e0b6140821473d27357ee Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Jan 2026 13:27:49 +0000 Subject: [PATCH 4/4] CI: Upload firmware artifacts for pull requests --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be9a6e59..a734bbf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,3 +35,14 @@ jobs: - name: Build CrossPoint run: pio run + + - name: Upload Firmware Artifacts + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: firmware-pr-${{ github.event.pull_request.number }} + path: | + .pio/build/default/firmware.bin + .pio/build/default/bootloader.bin + .pio/build/default/partitions.bin + retention-days: 7