diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..710a414 --- /dev/null +++ b/README.en.md @@ -0,0 +1,76 @@ +
+ +

+ Lire cette page en français + English, page shown +

+ +WiFi Manager, the base firmware of the modules + +
+ +The common base for every MicroCoaster module. It handles getting an ESP32 onto the network: a captive portal on first boot, stored credentials, automatic reconnection, and an escape button for taking control back when the network has changed. + +Every module on the layout starts from this firmware and grafts its own logic on top. What is settled here does not have to be settled anywhere else. + +**Version 2.0.0** + +01 How it works + +A module has neither keyboard nor screen. The only way to hand it the credentials of a network is for it to create one itself. + +First boot: no wifi.json, the module opens its access point. Captive portal: every request is redirected to the configuration page. Credentials entered: written to wifi.json on LittleFS, then a reboot. From then on: a direct connection to the remembered network, an automatic retry if it drops, then a fallback to the portal. + +The `/wifi.json` file is declared protected with the library, which keeps a filesystem operation from wiping it by accident. That is the difference between a module you reconfigure and a module you have to go and prise out of the layout. + +02 Taking it back + +A button on GPIO 0, the one already wired on most development boards. + +Press for 2 to 5 seconds: reopens the configuration portal without erasing anything. Press for 5 seconds or more: erases the stored credentials, the module starts over blank. + +It earns its keep the day the network changes name or key and the module is still looking for the old one. + +03 Settings + +setPortalTimeout: how long before the portal closes. setAPClientCheck: the portal stays open as long as a client is connected to it. setWebClientCheck: every HTTP request restarts the countdown. setCaptivePortal: redirects every request to the configuration page. setFallbackPolicy ON_FAIL: the portal only opens after a failed connection. setAutoReconnect: retries the connection without intervention. + +An hour of portal is comfortable while developing, but generous for a module sitting in a layout: an open access point is a way in. In service, a few minutes are enough. + +The access point credentials live in `include/env.h`, which is not in git. Copy [`include/env.h.example`](include/env.h.example) and fill it in: without that file the firmware does not compile, and that is deliberate. An oversight shows up at build time rather than in production. + +The home network credentials never go through the code at all: they are typed into the portal and stay in `/wifi.json`, in the module's memory. + +04 Bringing it up + +Requires [PlatformIO](https://platformio.org/) inside Visual Studio Code. + +```bash +pio run # build +pio run -t upload # upload the firmware +pio run -t uploadfs # upload the portal to LittleFS +pio device monitor # serial console, 115200 baud +``` + +The portal is made of static files in `data/`. They go to LittleFS with `uploadfs`, separately from the firmware: changing a page does not mean recompiling. + +1. Power the module. It creates the `WifiManager-MicroCoaster` access point. +2. Connect to it and open `http://192.168.4.1`. +3. Enter the target network. +4. The module reboots and joins the network. + +The serial console at 115200 baud traces every step, and a connection status is published every thirty seconds with the IP address and the signal strength. + +05 Ecosystem + +```ini +ayresnet/AyresWiFiManager ; captive portal, storage, reconnection +``` + +The library logs are turned off through `AWM_ENABLE_LOG=0` in `platformio.ini`, so the console does not mix two languages. Embedded filesystem: **LittleFS**, which holds the portal pages and `/wifi.json`. + +Modules built on this base: [Switch Track](https://github.com/Microcoaster/Switch-Track), [Launch Track](https://github.com/Microcoaster/Launch-Track), [Lift Hill](https://github.com/Microcoaster/Lift-Hill), [Audio module](https://github.com/Microcoaster/Module-Audio), [Smoke Machine](https://github.com/Microcoaster/Smoke-Machine). The whole thing is driven by the [WebApp](https://github.com/Microcoaster/MicroCoasterWebApp). + +--- + +MicroCoaster · Author: Cybertrist diff --git a/README.md b/README.md index 46b927c..25c5162 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@
+

+ Français, page affichée + Read this page in English +

+ WiFi Manager, firmware de base des modules
diff --git a/docs/en/banniere.png b/docs/en/banniere.png new file mode 100644 index 0000000..07ca002 Binary files /dev/null and b/docs/en/banniere.png differ diff --git a/docs/en/schemas/bouton.png b/docs/en/schemas/bouton.png new file mode 100644 index 0000000..1a3fa0d Binary files /dev/null and b/docs/en/schemas/bouton.png differ diff --git a/docs/en/schemas/principe.png b/docs/en/schemas/principe.png new file mode 100644 index 0000000..6c9cf8f Binary files /dev/null and b/docs/en/schemas/principe.png differ diff --git a/docs/en/schemas/reglages.png b/docs/en/schemas/reglages.png new file mode 100644 index 0000000..58b8133 Binary files /dev/null and b/docs/en/schemas/reglages.png differ diff --git a/docs/en/sections/s01.png b/docs/en/sections/s01.png new file mode 100644 index 0000000..b236e04 Binary files /dev/null and b/docs/en/sections/s01.png differ diff --git a/docs/en/sections/s02.png b/docs/en/sections/s02.png new file mode 100644 index 0000000..3a34e0c Binary files /dev/null and b/docs/en/sections/s02.png differ diff --git a/docs/en/sections/s03.png b/docs/en/sections/s03.png new file mode 100644 index 0000000..970e461 Binary files /dev/null and b/docs/en/sections/s03.png differ diff --git a/docs/en/sections/s04.png b/docs/en/sections/s04.png new file mode 100644 index 0000000..518d3d9 Binary files /dev/null and b/docs/en/sections/s04.png differ diff --git a/docs/en/sections/s05.png b/docs/en/sections/s05.png new file mode 100644 index 0000000..80475b8 Binary files /dev/null and b/docs/en/sections/s05.png differ diff --git a/docs/langues/en-off.png b/docs/langues/en-off.png new file mode 100644 index 0000000..77ea9ec Binary files /dev/null and b/docs/langues/en-off.png differ diff --git a/docs/langues/en-on.png b/docs/langues/en-on.png new file mode 100644 index 0000000..c9dbf28 Binary files /dev/null and b/docs/langues/en-on.png differ diff --git a/docs/langues/fr-off.png b/docs/langues/fr-off.png new file mode 100644 index 0000000..41f4335 Binary files /dev/null and b/docs/langues/fr-off.png differ diff --git a/docs/langues/fr-on.png b/docs/langues/fr-on.png new file mode 100644 index 0000000..4e1cb47 Binary files /dev/null and b/docs/langues/fr-on.png differ