Skip to content

Releases: IdefixRC/AyresWiFiManager

AyresWiFiManager 2.5.0

Choose a tag to compare

@IdefixRC IdefixRC released this 03 Oct 12:09

Overview

AyresWiFiManager 2.5.0 is a feature release of the IdefixRC fork. The time sync no longer blocks your loop: update() drives it in the background, reconnects never wait for the time, and the HTTP Date fallback runs in a short-lived task of its own. AWM also stops overriding your timezone, and new calls tell you whether the clock can be trusted.

This fork tracks ayresnet/AyresWiFiManager.

Highlights

  • Non-blocking time sync: the same NTP servers, rotation and HTTP Date fallback as before, without freezing the caller. Before, a connection without internet could hold the caller for about 45 seconds.
  • Your choice at boot: run() still waits for the time by default. setTimeSyncWait(ms) caps the wait; setTimeSyncWait(0) returns at once.
  • Reliable reconnect sync: every reconnect re-syncs the time, and never waits.
  • Your timezone stays: AWM no longer forces UTC0. Set TZ once and local time survives every sync.
  • Know when the clock is real: isTimeSynced() and getTimeSyncStatus() (IDLE, SYNCING, SYNCED, FAILED).
  • Off switch: setTimeSync(false) for applications that run their own NTP client.

User guide: time sync

void setup() {
  setenv("TZ", "AEST-10", 1); // optional: your local timezone
  tzset();

  wifi.setTimeSyncWait(0);    // don't hold up setup() for the time
  wifi.begin();
  wifi.run();
}

void loop() {
  wifi.update();
  wifi.reintentarConexionSiNecesario();

  if (wifi.isTimeSynced()) {
    // the clock is real: HTTPS certificate checks and timestamps work
  }
}
Call What it does Default
setTimeSync(bool) Turns AWM's time sync on or off. Off: AWM never touches the clock or TZ. true
setTimeSyncWait(ms) How long run() waits for the time after connecting. TIME_SYNC_WAIT_FULL: until the sync succeeds or gives up
isTimeSynced() true once the system clock is valid (2017 or later).
getTimeSyncStatus() IDLE, SYNCING, SYNCED or FAILED. FAILED can still become SYNCED, because SNTP keeps retrying in the background.

Compatibility

  • ESP32 with the Arduino framework, Arduino-ESP32 core 2.x and 3.x (CI builds both examples on both).
  • ArduinoJson 6.21.2 or newer within major version 6.
  • Tested on hardware with an ESP32-C6 on core 3.3.11.
  • One extra FreeRTOS task (8 KB stack) exists only while the HTTP Date fallback runs. That's only when NTP fails, and for at most 60 seconds. On the ESP32-C6 it used at most about 2.9 KB of that stack (minimum free 5256 bytes over 15+ runs), and the heap stayed flat across 11 back-to-back fallback runs.
  • Core 2.x: the core's DNS lookup (hostByName) is not safe to run from two tasks at once. While the HTTP fallback runs, a DNS lookup in your loop() may wait or, rarely, fail; retry it. Core 3.x is not affected.

Upgrade Notes

  • run() waits as before; nothing to do unless you want a shorter wait.
  • Reconnects now re-sync the time and never wait. In 2.4.0, the reconnect sync almost never ran.
  • AWM no longer sets TZ to UTC0. If you never set TZ, nothing changes. If you set your own TZ, it now survives every sync.
  • getTimestamp() returns 0 until the clock reads 2017 or later (before: 1970-01-02).
  • The "Hora sincronizada" log line now shows local time when you set TZ.
  • The setBusyCallback() callback is now also called while run() waits for the time.

AyresWiFiManager 2.4.0

Choose a tag to compare

@IdefixRC IdefixRC released this 01 Oct 12:29

Overview

AyresWiFiManager 2.4.0 is a feature release of the IdefixRC fork. The captive portal now comes in English, Spanish and German. By default it opens in the language of the visitor's browser, falling back to English, and every page has a language menu so the user can switch. Two new settings let you fix the language or hide the menu.

This fork tracks ayresnet/AyresWiFiManager. We have offered this work to the original author.

Highlights

  • Multilingual portal: the setup, success and error pages are fully translated into English, Spanish and German.
  • Automatic language: the default AUTO reads the browser's preferred languages and picks the first one the portal supports.
  • Language menu: a globe menu in the header lists English · Español · Deutsch, each language in its own name. The chosen language carries over to the success or error page after saving.
  • Two new settings: setLanguage() and setLanguageSwitcher().
  • /info reports the configured lang and lang_switch.
  • Safer by design: scanned SSIDs stay plain text, translated text escapes any values it inserts, and the confirmation phrase for "erase all" is per language.

User guide: portal language

Call both settings in setup(), before begin():

#include <AyresWiFiManager.h>

AyresWiFiManager wifi;

void setup() {
  wifi.setLanguage(AyresWiFiManager::Language::AUTO); // default; AUTO, EN, ES or DE
  wifi.setLanguageSwitcher(true);                     // default; false hides the language menu
  wifi.begin();
  wifi.run();
}

void loop() {
  wifi.update();
}

setLanguage(): the language the portal opens in

Value Portal opens in
AUTO (default) The browser's language, if the portal supports it; otherwise English
EN English
ES Spanish
DE German

How AUTO decides. The page goes through the browser's preferred languages in order and uses the first one the portal supports. On a phone, those are the phone's language settings. It matches on the language and ignores the region:

Browser languages Portal shows
es-AR Spanish
de-CH, en German
pt-BR, es Spanish (the second preference is supported)
fr-FR, it English (neither is supported yet)

setLanguageSwitcher(): show or hide the language menu

With true (the default), every page shows the language menu and the user can switch at any time. A fixed setLanguage() value then only sets the starting language. With false, the menu is hidden and the portal stays in the configured language. A ?lang= parameter in the address is ignored too.

Common combinations

You want setLanguage setLanguageSwitcher
Visitor's language, with a choice (default) AUTO true
Visitor's language, no choice AUTO false
Start in German, allow switching DE true
Always Spanish, as before 2.4.0 ES false

The setup page reads both settings each time it loads, so a change takes effect on the next page load.

Custom pages. Pages you upload to LittleFS replace the built-in ones completely, including their language handling.

Testing

  • Tests and checks: the portal asset and translation checks pass, along with 10 Node and 17 pytest tests. CI builds both examples on Arduino-ESP32 core 2.x and 3.x.
  • Browser review: checked in all three languages, at PC and phone size.
  • On hardware: a Waveshare ESP32-C6 on core 3.3.11, using a dedicated device test, with an iPhone and an Android phone. All of these passed:
    • AUTO per phone language, with French falling back to English;
    • fixed and locked languages;
    • translated success and error pages;
    • built-in and custom pages;
    • the recovery section with the per-language erase phrases.

Compatibility

  • Framework: Arduino
  • Platform: ESP32
  • Arduino-ESP32 core: 2.x and 3.x
  • Dependency: ArduinoJson ^6.21.2

Upgrade Notes

lib_deps =
  https://github.com/IdefixRC/AyresWiFiManager.git#2.4.0
  • The default portal language changes. Up to 2.3.x the built-in portal was Spanish only. With the new default AUTO, browsers in other languages now see English (or German). To keep the old behaviour, add:

    wifi.setLanguage(AyresWiFiManager::Language::ES);
    wifi.setLanguageSwitcher(false);
  • The 405 reply text is now "Method not allowed".

  • The _en sample pages (data/index_en.html, success_en.html, error_en.html) are removed. The built-in pages now cover English. If you uploaded your own pages to LittleFS, they keep working unchanged.

  • There are no other API changes, and 2.4.0 includes all 2.3.3 fixes.

Thank you to Daniel Salgado and AyresNet for AyresWiFiManager, and to everyone using and testing it.

AyresWiFiManager 2.3.3

Choose a tag to compare

@IdefixRC IdefixRC released this 01 Oct 12:20

Overview

AyresWiFiManager 2.3.3 is a patch release of the IdefixRC fork. It fixes two bugs on Arduino-ESP32 core 3.x, both found on real hardware. First, the captive portal's network scan always came back empty. Second, the serial log flooded with Task WDT errors. Everyone on core 3.x should update.

This fork tracks ayresnet/AyresWiFiManager, and both fixes will be offered upstream.

Fixes

  • The portal scan lists networks again on core 3.x. handleScan() started the scan with a raw esp_wifi_scan_start() and then read the result with WiFi.scanComplete(). That broke in two ways:

    • On core 3.x, the WiFi class ignores the completion of a scan it did not start itself. scanComplete() therefore reported a failure, and /scan always answered with an empty list.
    • The scan configuration was never zeroed. ESP-IDF 5.5 logged wifi:2g bitmap contains only invalid channels= 0xffff.

    The portal now scans with WiFi.scanNetworks(), using the same synchronous active scan with 120 ms per channel. This bug had been present since 2.3.0.

  • No more task_wdt: esp_task_wdt_reset(...): task not found flood. The library fed the Task WDT on every update() call and in several other places. The loop task, however, only subscribes to the watchdog when the portal opens. Under ESP-IDF v5, each of those calls logged an error, which on a connected boot meant about one line every 5 ms. The library now feeds the watchdog only after the task has subscribed.

  • Fewer watchdog errors when the portal opens. Each portal open logged "TWDT already initialized", and every reopen also logged "task is already subscribed". Both are gone: the portal now reconfigures the watchdog that is already running and subscribes the task only once.

Testing

  • Tested on a Waveshare ESP32-C6-Touch-LCD-1.47 with Arduino-ESP32 core 3.3.11.
  • The scan lists nearby networks again.
  • A connected boot logs no watchdog errors.
  • The full portal flow (set up, save, recover, restart) works as before.
  • CI builds both examples on core 2.x and 3.x.

Compatibility

  • Framework: Arduino
  • Platform: ESP32
  • Arduino-ESP32 core: 2.x and 3.x
  • Dependency: ArduinoJson ^6.21.2

Upgrade Notes

2.3.3 is a drop-in replacement for 2.3.2, with no API changes.

lib_deps =
  https://github.com/IdefixRC/AyresWiFiManager.git#2.3.3

Thank you to Daniel Salgado and AyresNet for AyresWiFiManager, and to everyone using and testing it.

AyresWiFiManager 2.3.2

Choose a tag to compare

@IdefixRC IdefixRC released this 29 Sep 13:35

Overview

AyresWiFiManager 2.3.2 is a security patch release of the IdefixRC fork. It fixes an HTML and script injection in the captive portal's network list. Everyone using the portal should update.

This fork tracks ayresnet/AyresWiFiManager. The fix is offered upstream as ayresnet/AyresWiFiManager#11.

Security fix

  • Scanned SSIDs are shown as text, not HTML. The portal built its network list with innerHTML and inserted each SSID unescaped. SSIDs come from any access point in radio range, so a nearby network whose name contained HTML could run script inside the setup page while someone was configuring the device. The maximum SSID length of 32 bytes is enough for that. The script ran with the page's own access, so it could call /save (point the device at a different network) or /erase.
  • The fix builds the SSID and signal elements with textContent. It applies to the built-in page in src/AWM_html_gz.h, to data/index.html, and to data/index_en.html, which isn't served by default but can be uploaded as a custom page.
  • Verified in a browser against a mock /scan returning an SSID with an event-handler payload: before the fix the handler ran; after it, the name is shown literally and nothing executes.

Compatibility

  • Framework: Arduino
  • Platform: ESP32
  • Arduino-ESP32 core: 2.x and 3.x
  • Dependency: ArduinoJson ^6.21.2

Upgrade Notes

2.3.2 is a drop-in replacement for 2.3.1. There are no API changes.

lib_deps =
  https://github.com/IdefixRC/AyresWiFiManager.git#2.3.2

If your project uploads its own portal pages to LittleFS, updating the library is not enough, because those pages override the built-in ones. Check your index.html for code that inserts SSIDs with innerHTML, apply the same fix, and upload the file system again.

Thank you to Daniel Salgado and AyresNet for AyresWiFiManager, and to everyone using and testing it.

AyresWiFiManager 2.3.1

Choose a tag to compare

@IdefixRC IdefixRC released this 28 Sep 12:30

Overview

AyresWiFiManager 2.3.1 is a patch release of the IdefixRC fork. It makes the library build on Arduino-ESP32 core 3.x (ESP-IDF v5), includes the MAC-based device naming helpers added upstream after 2.3.0, and brings the version metadata back in line with the code.

This fork tracks ayresnet/AyresWiFiManager. We offer our changes back to the original author as pull requests.

Highlights

  • Arduino-ESP32 core 3.x support: startPortal() configured the Task WDT with the ESP-IDF v4 call esp_task_wdt_init(120, true), which does not compile on core 3.x. On core 3.x the library now uses the ESP-IDF v5 config struct and reconfigures the watchdog that is already running from boot. Core 2.x keeps the original call.
  • MAC-based device naming helpers: AyresWiFiManager::getMacAddress() returns the full Station MAC (for example A4:CF:12:34:4C:25), and AyresWiFiManager::getMacSuffix() returns its last four hex characters (for example 4C25). Use the suffix to give every device a unique hostname and setup AP name.
  • Consistent version reporting: AWM_VERSION, library.json, library.properties and the README all say 2.3.1. Before this, a device reported 2.3.1 on /info while PlatformIO and the Arduino Library Manager saw 2.3.0.

Build and CI

  • Every pull request builds both examples, examples/Arduino/example.ino and examples/PlatformIO/main.cpp, on Arduino-ESP32 core 2.x and core 3.3.11.
  • New tools/check_portal_assets.py verifies that the portal pages embedded in src/AWM_html_gz.h match the sources in data/. It replaces a check that called a helper script no longer in the repository.

Documentation and Packaging

  • Both READMEs open with a note explaining that this is a fork and why it exists.
  • The Compatibility section lists Arduino-ESP32 core 2.x and 3.x.
  • Added 2.3.1 changelog entries in AyresWiFiManager.h and AyresWiFiManager.cpp.

Compatibility

  • Framework: Arduino
  • Platform: ESP32
  • Arduino-ESP32 core: 2.x and 3.x
  • Dependency: ArduinoJson ^6.21.2

Upgrade Notes

2.3.1 is a drop-in replacement for 2.3.0. The public API only gains the two MAC helpers.

This release is not published to the PlatformIO registry. To use it, point lib_deps at this repository:

lib_deps =
  https://github.com/IdefixRC/AyresWiFiManager.git#2.3.1

One behaviour difference on core 3.x: once startPortal() reconfigures the Task WDT, the idle tasks are no longer subscribed to it. On core 2.x the idle-task subscriptions stay as they were. If your application relies on the Task WDT catching a starved idle task, subscribe the idle tasks again after the portal closes.

Thank you to Daniel Salgado and AyresNet for AyresWiFiManager, and to everyone using and testing it.