Skip to content

v1.8.2 - WiFi Manager Refactoring & Build Profile Enhancement (2025-11-23)

What Changed?

This release refactors the WiFi manager API for consistency, documents the high-level state machine design, and adds dedicated WiFi development build profiles. Method names are shortened from wifi_manager_* to wifi_* to align with other module naming conventions. A new esp32dev-wifi profile provides optimized WiFi development and testing environment.


What's New

Main Feature: Consistent WiFi API & Dedicated Build Profile

What it does:

  1. API Refactoring: Shortened method names (e.g., wifi_manager_init()wifi_init()) for consistency with other modules (cosmic_*, adc_*, bme280_*)
  2. Design Documentation: Documented the rationale for using a custom high-level wifi_state_t instead of low-level wl_status_t
  3. Build Profile: New esp32dev-wifi environment for dedicated WiFi development and testing

How to use it:

# Build WiFi development firmware
task wifi:build

# Build and upload to device
task wifi:upload

# Monitor connection
task monitor

API Example (before → after):

// Before (v1.8.1)
wifi_manager_init();
wifi_manager_update();
wifi_manager_is_connected();

// After (v1.8.2)
wifi_init();
wifi_update();
wifi_is_connected();

Installation

Quick Start

# Get the release
git checkout v1.8.2

# Build WiFi firmware
task wifi:build

# Upload
task wifi:upload

# Check it works
task monitor

What's Different from the Last Version?

✅ Added

  • New build profile: esp32dev-wifi for dedicated WiFi development
  • Taskfile aliases: task wifi:build, task wifi:upload, task wifi:clean
  • Design documentation: Detailed rationale for custom wifi_state_t in CLAUDE.md and progress logs

🔧 Changed

  • API naming: 13 function names refactored for consistency
  • wifi_manager_init()wifi_init()
  • wifi_manager_update()wifi_update()
  • wifi_manager_connect()wifi_connect()
  • wifi_manager_disconnect()wifi_disconnect()
  • wifi_manager_get_state()wifi_get_state()
  • wifi_manager_is_connected()wifi_is_connected()
  • wifi_manager_get_ssid()wifi_get_ssid()
  • wifi_manager_get_rssi()wifi_get_rssi()
  • wifi_manager_get_ap_ssid()wifi_get_ap_ssid()
  • wifi_manager_get_ap_ip()wifi_get_ap_ip()
  • wifi_manager_is_ap_mode()wifi_is_ap_mode()
  • wifi_manager_start_ap()wifi_start_ap()
  • wifi_manager_start_sta()wifi_start_sta()
  • Scope preservation: WiFi module scope (wifi_ prefix) retained, only manager suffix removed

🐛 Fixed

  • None (refactoring only)

Is It Safe to Upgrade?

Backward Compatible: No (API breaking change)

Impact on existing users:

  • Code using WiFi functions must be updated to use new function names
  • All internal calls have been updated (main.cpp, text_command_handler.cpp)
  • A simple sed/find-and-replace can automate migration if needed

Migration path:

# Find all old function calls in your code
grep -r "wifi_manager_" src/ include/

# Update using sed (example for one function)
sed -i 's/wifi_manager_init/wifi_init/g' src/*.cpp include/*.h

Tests Passed

  • ✅ Builds without errors (esp32dev-dev, esp32dev-release, esp32dev-debug, esp32dev-wifi)
  • ✅ Flash usage: 60.3% (790741 / 1310720 bytes) - within limits
  • ✅ RAM usage: 14.4% (47264 / 327680 bytes) - well within limits
  • ✅ All WiFi function calls updated and verified
  • ✅ Documentation consistent across CLAUDE.md and progress logs

What's Different in Detail?

Architecture Decision: Custom wifi_state_t

The implementation maintains a Hardware Abstraction Layer (HAL) pattern:

Hardware Layer (Low-Level):
  wl_status_t from WiFi.h (11 states)
         ↓ [used internally in wifi_update()]
Application Layer (High-Level):
  wifi_state_t (4 states: DISCONNECTED, CONNECTING, CONNECTED, FAILED)
         ↓ [exposed in public API]
Caller Code:
  Simple, stable state interface

Why this design?

  1. Timeout Management: Hardware cannot track 10-second connection timeouts
  2. Auto-Retry Logic: 5-second retry interval requires application-level state
  3. State Machine Design: High-level flow (DISCONNECTED → CONNECTING → CONNECTED/FAILED → retry) cannot be represented in hardware states alone
  4. API Simplicity: 4 well-defined states vs 11+ volatile hardware states

See docs/progress/entries/2025-11-22-wifi-manager.md for full design rationale.

Build Profiles

Four complementary profiles now available:

Profile Release Type WiFi Text Commands Detection Use Case
esp32dev-release Production Normal Field deployment
esp32dev-debug Debug Normal Production troubleshooting
esp32dev-dev Development Periodic General development
esp32dev-wifi Development Periodic WiFi feature focus

Release Details

  • Date: 2025-11-23
  • Version: v1.8.2
  • Type: Refactoring + Build Enhancement
  • Files Changed: 6
  • Modified: include/wifi_manager.h, src/wifi_manager.cpp, src/main.cpp, src/text_command_handler.cpp, platformio.ini, Taskfile.yml
  • Updated docs: docs/progress/entries/2025-11-22-wifi-manager.md, docs/wifi-ap-interface.md, CLAUDE.md

  • Commits:

  • 80f5cc7 - refactor(wifi): rename wifi_manager_functions to wifi_ for consistency
  • d2c3b4e - docs(wifi): document design rationale for custom wifi_state_t
  • 6e444cb - build(platformio): add WiFi development profile and task aliases

Next Steps

Planned for v1.8.3+:

  • Implement embedded web server (web_server.h/cpp)
  • Add gzip-compressed HTML UI
  • Implement WiFi status and sensor data JSON APIs
  • STA mode connection troubleshooting (WPA2/WPA3 compatibility)
  • WiFi signal strength (RSSI) dashboard display
  • OTA (Over-The-Air) firmware update support
  • mDNS support (osechi.local connectivity)

Breaking Changes Summary

⚠️ API Breaking Change

All WiFi function names have been shortened. Update your code:

// OLD (v1.8.1)
wifi_manager_init();        // → wifi_init()
wifi_manager_update();      // → wifi_update()
wifi_manager_connect();     // → wifi_connect()
wifi_manager_disconnect();  // → wifi_disconnect()
wifi_manager_get_state();   // → wifi_get_state()
wifi_manager_is_connected();// → wifi_is_connected()
// ... and 6 more functions

Automated migration: All calls within kurikintons have been updated. If you have external code using these functions, use find-and-replace to update.