-
Notifications
You must be signed in to change notification settings - Fork 0
Add WiFi-on/off build presets and binary size compare workflow #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| ENV_ON="${1:-slwf09_eth_wifi_on}" | ||
| ENV_OFF="${2:-slwf09_eth_wifi_off}" | ||
|
|
||
| echo "==> Building $ENV_ON" | ||
| pio run -e "$ENV_ON" | ||
| echo "==> Building $ENV_OFF" | ||
| pio run -e "$ENV_OFF" | ||
|
|
||
| BIN_ON=".pio/build/${ENV_ON}/firmware.bin" | ||
| BIN_OFF=".pio/build/${ENV_OFF}/firmware.bin" | ||
|
|
||
| if [[ ! -f "$BIN_ON" || ! -f "$BIN_OFF" ]]; then | ||
| echo "Binary missing. Expected:" | ||
| echo " $BIN_ON" | ||
| echo " $BIN_OFF" | ||
| exit 2 | ||
| fi | ||
|
|
||
| SIZE_ON=$(stat -c '%s' "$BIN_ON") | ||
| SIZE_OFF=$(stat -c '%s' "$BIN_OFF") | ||
| DELTA=$((SIZE_OFF - SIZE_ON)) | ||
|
|
||
| echo | ||
| echo "Firmware binaries:" | ||
| echo " WiFi ON : $BIN_ON" | ||
| echo " WiFi OFF: $BIN_OFF" | ||
| echo | ||
| echo "Sizes (bytes):" | ||
| printf ' %-10s %12d\n' "WiFi ON" "$SIZE_ON" | ||
| printf ' %-10s %12d\n' "WiFi OFF" "$SIZE_OFF" | ||
| printf ' %-10s %12d\n' "Delta" "$DELTA" | ||
| echo | ||
|
|
||
| echo "SHA256:" | ||
| sha256sum "$BIN_ON" "$BIN_OFF" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -511,8 +511,13 @@ void WLED::setup() | |
| WiFi.persistent(false); // on ES8266 using NVM for wifi config has no benefit of faster connection | ||
| #endif | ||
| WiFi.onEvent(WiFiEvent); | ||
| #ifdef WLED_FORCE_WIFI_OFF | ||
| DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF: forcing WiFi OFF.")); | ||
| WiFi.mode(WIFI_OFF); | ||
| #else | ||
| WiFi.mode(WIFI_STA); // enable scanning | ||
| findWiFi(true); // start scanning for available WiFi-s | ||
| #endif | ||
|
|
||
| // all GPIOs are allocated at this point | ||
| serialCanRX = !PinManager::isPinAllocated(hardwareRX); // Serial RX pin (GPIO 3 on ESP32 and ESP8266) | ||
|
|
@@ -633,6 +638,10 @@ void WLED::beginStrip() | |
|
|
||
| void WLED::initAP(bool resetAP) | ||
| { | ||
| #ifdef WLED_FORCE_WIFI_OFF | ||
| return; | ||
| #endif | ||
|
|
||
| if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP) | ||
| return; | ||
|
|
||
|
|
@@ -673,6 +682,14 @@ void WLED::initAP(bool resetAP) | |
| void WLED::initConnection() | ||
| { | ||
| DEBUG_PRINTF_P(PSTR("initConnection() called @ %lus.\n"), millis()/1000); | ||
| #ifdef WLED_FORCE_WIFI_OFF | ||
| DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. Skipping WiFi/AP init.")); | ||
| lastReconnectAttempt = millis(); | ||
| WiFi.disconnect(true); | ||
| WiFi.mode(WIFI_OFF); | ||
| return; | ||
|
Comment on lines
+686
to
+690
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| #endif | ||
|
|
||
| #ifdef WLED_ENABLE_WEBSOCKETS | ||
| ws.onEvent(wsEvent); | ||
| #endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
WLED_FORCE_WIFI_OFFbranch skips the startupfindWiFi(true)call, buthandleConnection()still has an early guard that returns whilewifiConfigured && multiWiFi.size() > 1 && WiFi.scanComplete() < 0. On devices with multiple saved SSIDs,scanComplete()can stay in the negative "no scan complete" state, so the loop keeps returning beforeinitConnection()/interface initialization runs, causing startup networking services to stall even if Ethernet is present.Useful? React with 👍 / 👎.