feat(wifi): v1.9.2 - WiFi resilience and credential persistence (#1)

## Problem
Previous versions would clear WiFi credentials on connection failure,
requiring manual reconfiguration via captive portal after each WiFi outage.

## Solution
- Never clear credentials on connection failure
- Infinite retry with exponential backoff (5s → 10s → 20s → ... → 5min max)
- Fallback AP ("TJ56654-Setup") enabled after ~5 min of failed attempts
- Dual STA+AP mode allows configuration while still retrying connection
- AP automatically disabled when WiFi reconnects

## Changes

### WiFi Credential Handling
- Try SDK-stored credentials first (from WiFiManager)
- Fall back to EEPROM config if SDK credentials fail
- Fixes OTA update credential loss issue

### User Experience
- Display shows "No WiFi" with retry countdown instead of cryptic numbers
- "!" indicator in date line when WiFi is disconnected
- Clock continues running with last synced time during outage

### Network Activity (~50 requests/day)
| Service | Interval | Endpoint |
|---------|----------|----------|
| NTP | 1 hour | pool.ntp.org:123 (UDP) |
| Weather | 30 min | api.open-meteo.com (HTTP) |
| mDNS | continuous | 224.0.0.251 (multicast) |

Co-authored-by: Alex Petrochenko <petrochenko@life-pay.ru>
This commit is contained in:
Alex Petrochenko
2026-01-06 20:51:42 +00:00
committed by GitHub
co-authored by Alex Petrochenko
parent 0f2860c25e
commit c3bfaa26bc
4 changed files with 2487 additions and 230 deletions
-73
View File
@@ -1,73 +0,0 @@
name: Build Firmware
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1
- name: Install ESP8266 platform
run: |
arduino-cli core update-index
arduino-cli core install esp8266:esp8266
- name: Install libraries
run: |
arduino-cli lib install "Adafruit GFX Library"
arduino-cli lib install "Adafruit SSD1306"
arduino-cli lib install "NTPClient"
arduino-cli lib install "WiFiManager"
arduino-cli lib install "AsyncHTTPRequest_Generic"
arduino-cli lib install "ESPAsyncTCP"
- name: Compile firmware
run: |
arduino-cli compile --fqbn esp8266:esp8266:generic \
--build-property "build.flash_size=1M64" \
--build-property "build.flash_mode=dio" \
--output-dir build \
src/clock_ntp_ota_v1.9.ino
- name: Check firmware size
run: |
SIZE=$(stat -c%s "build/clock_ntp_ota_v1.9.ino.bin")
echo "Firmware size: $SIZE bytes"
MAX_SIZE=470000 # 470KB max for OTA
if [ $SIZE -gt $MAX_SIZE ]; then
echo "ERROR: Firmware too large ($SIZE > $MAX_SIZE)"
exit 1
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: firmware
path: |
build/clock_ntp_ota_v1.9.ino.bin
build/clock_ntp_ota_v1.9.ino.elf
build/clock_ntp_ota_v1.9.ino.map
retention-days: 30
- name: Upload release assets
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/clock_ntp_ota_v1.9.ino.bin
asset_name: esp8266-weather-clock-${{ github.event.release.tag_name }}.bin
asset_content_type: application/octet-stream