Compare commits

...
1321 Commits
Author SHA1 Message Date
alex f4fa653a7b fix: retain async dependencies for nested PlatformIO builds 2026-08-26 01:17:05 +10:00
alex 63b0291961 fix: declare async TCP PlatformIO dependencies 2026-08-26 01:06:22 +10:00
alex 3b07903bf4 docs: clarify provisioning and release workflow 2026-08-25 09:01:06 +10:00
alex 1f196895ce Update DFTE dependency to 1.0.2 2026-08-24 22:42:16 +10:00
alex 35e02f54e5 Redact WiFiManager diagnostic values 2026-08-24 22:17:22 +10:00
alex e2495843ff Release WiFiManager 3.0.0 2026-08-24 22:05:16 +10:00
alex 95e9f9a751 Stream portal templates via TemplateEngineAsyncWeb chunked wrapper
Use the DFTE async integration helper so portal HTML chunk callbacks handle
zero-length buffers and no-progress retries without terminating transfers
early on constrained hosts.
2026-05-06 00:44:56 +10:00
alex 396a6e07db Improve portal WiFi handoff and bump WiFiManager to v2.0.19.
Expose redirect details after connect-on-save so clients can land on the station IP before the AP closes, hide the mobile nav scrollbar, and document the updated API contract.
2026-05-05 00:23:22 +10:00
alex 7735d7f0cb Portal customization API v2, SPA hardening, and test cleanup
- Group portal state into brand/pages/actions/layout structs; portal* API
- Bootstrap JSON: nested brand/context/pages/actions/layout; param kind
- Handlers: PROGMEM default CSS when no override/append; dynamic CSS path
- PortalAppJS: portal timeout countdown; safe WiFi scan DOM; serialized
  scan-status polling; fetch error handling; wm:view-changed on redirects
- CSS: scan list icon alignment; wm-status for timeout
- Tests: remove low-value/no-op tests; trim fragile JS substring checks
2026-05-04 22:03:43 +10:00
alex 93711d981d Portal home: single Status card; rename params placement API
- Merge initial status and guidance into one wm-card (Status) on Home.
- Add .wm-home-summary styling for the primary status line.
- Replace legacy setParamsPage with setParametersEmbeddedInWifi (matches
  _paramsInWifi / SPA Setup vs WiFi placement); remove setParamsPage.
- Update README, handlers comment, and advanced-options tests.
2026-05-04 12:58:38 +10:00
alex 3af9706f87 Portal UI: design tokens, cards, nav, WiFi scan rows
- Replace legacy centered stylesheet with CSS variables, layout shell,
  pill navigation with active state, cards, form fields, buttons.
- Restructure SPA markup (hero, page heads, scan list as tap rows).
- Shell dialog buttons use wm-btn classes for consistent styling.
2026-05-02 21:11:35 +10:00
alex 66e6088bf1 Portal: request-scoped shell bundle, SPA connect poll fix, test tidy
- Use per-request PortalShellRenderBundle and one root shell template; drop
  server-side template registry and simplify WiFiManagerServer.
- PortalAppJS: centralize chrome/form binding; fix WiFi connect polling by
  stopping previous timers on view change and before new polls.
- processPortalConnect honors _cleanConnect like connectWifi.
- Remove brittle full-JSON API tests; trim test harness surface.
- README: small doc touch-up for the shell/portal flow.
2026-05-02 20:19:44 +10:00
alex bb1629af90 WiFiManager: consolidate portal JS, update handlers and tests
Remove legacy JS.h template; extend PortalAppJS and RootShell; adjust
WiFiManager core/server/handlers and platformio; refresh captive and
template tests.
2026-05-01 23:57:58 +10:00
alex da99137023 Clean stale portal-save wording in comments.
Update remaining references to the removed wifisave flow so the source comments match the SPA/API portal architecture.
2026-04-27 23:36:16 +10:00
alex 86d9004c9b Portal SPA: single shell, JSON /api surface, remove legacy portal routes
Replace multi-page portal with hash-routed SPA, DFTE shell placeholders, and
data-first JSON APIs. Remove legacy routes, root-template override path, and
HTML-derived info pipeline. Add bootstrap feature flags, in-DOM toast/dialog UX,
OTA via POST /u, and tests for shell, bootstrap, API JSON, and captive host rule.
Rewrite README as fork disclaimer and modernization overview.
2026-04-22 12:09:08 +10:00
alex 350f19cd93 Remove GitHub Actions compile workflow (CI used local DFTE symlink). 2026-04-20 23:34:22 +10:00
alex 5776341b86 Remove temporary tools/ directory (migrate_debug_wm helper). 2026-04-20 23:31:57 +10:00
alex ac42d9a342 WiFiManager: structured logging, SPA portal, DFTE bridge.
Replace DEBUG_WM with WiFiManagerLogLevel/log(), optional WiFiManagerLogSink,
and WM_NO_LOG stripping. Add JSON API handlers and shell templates (RootShell,
PortalAppJS). Bridge DFTE logging with owner-scoped teardown; add migrate_debug_wm
helper; document and set WM_LOG_LEVEL in platformio.
2026-04-20 23:28:57 +10:00
alex a7d1755bcf DFTE docs, single root library.json, optional DFTE logging bridge
- Document fork/DFTE in README; WiFiManager template setup API forwards to server
- Remove nested lib/WiFiManager/library.json; rely on root library.json only
- Delete legacy extras/ tooling; point HTML help link at this fork
- Add WiFiManagerDfteLogger and WM_DFTE_LOGGING integration in WiFiManagerServer
- Pin ESP8266 Arduino core (postmortem jump fix) in platformio.ini for tests
2026-04-19 21:16:02 +10:00
alex 55f1fd7ce6 Add root library manifest for git consumers.
Point local test builds at the local DFTE checkout while keeping the published WiFiManager metadata usable from the repository root.
2026-04-18 01:23:24 +10:00
alex 9401c20df6 WiFiManager: fragment templates, handler refactor, and tests.
Split reusable HTML into Fragments, Message, and Param headers; route
more pages through DFTE streaming. Update handlers, WiFi polling JS,
and configuration/scanning tests; add template rendering coverage.
2026-04-18 00:23:57 +10:00
alex 69aea5ce35 WiFiManager: stream info and wifi pages through DFTE.
Harden the root placeholder path, add direct render-isolation coverage, move simple status pages and /info onto request-scoped streamed templates, and switch /wifi to a streamed shell while keeping scan/form sections string-built for now.
2026-04-17 06:41:44 +10:00
alex 9f111ab8bd WiFiManager: stabilize root rendering and reduce page reallocations.
Keep root template state request-scoped so dynamic placeholders stay consistent during chunked renders, add reserve() coverage for non-streamed pages, and add compile/test coverage for the new root render lifecycle.
2026-04-16 20:54:03 +10:00
alex bb1008435f Update library.json and platformio.ini 2025-11-30 00:55:31 +10:00
alex d8046146b5 WiFiManager: add template customization hooks (callback, granular default registrations, rebuild); switch to RootSelector for overridable WM_ROOT_TEMPLATE; minor menu logic fixes 2025-11-16 23:05:12 +10:00
alex 3054123b7f WiFiManager: add DFTE root template and chunked rendering for handleRoot; introduce shared placeholder registry via server singleton; add getMenuOut(String*) overload and menu logic for params/close 2025-11-16 22:21:47 +10:00
alex 3b488423a8 WiFiManager: remove legacy web customization API; simplify handlers to static templates; drop custom menu; keep title and parameter customization; update tests; remove renderer abstraction; build/test clean 2025-11-16 18:09:59 +10:00
alex aa4705e1e3 deps: align with platformio.ini; add ESP32Async/ESPAsyncWebServer@3.8.1 and DFTE 2025-11-16 17:21:17 +10:00
alex ac38bc20f5 chore: tidy comments, remove dead code, add actionable TODOs, improve API docs 2025-11-16 17:05:15 +10:00
alex 10c068178e Remove multi-language support and reorganize constants
- Delete language files (wm_strings_*/wm_consts_*) and wm_consts_en.h
- Move constants to appropriate headers (routes/menu tokens to Server, CSS/forms/headers to Handlers)
- Extract utility functions to WiFiManagerUtils.h/cpp
- Create template files (HTML.h, CSS.h, JS.h) for web interface
- Update version to 2.0.18
- Remove unused HTTP_HEAD_CL constant
2025-11-16 00:07:10 +10:00
alex 1b2cc44bc3 Update author attribution in headers and documentation 2025-11-15 22:24:54 +10:00
alex 9cd5f62f9b Refactor WiFiManager: extract server and handlers into separate modules
- Move server lifecycle management to WiFiManagerServer
- Move HTTP handlers and rendering to WiFiManagerHandlers
- Move DEBUG_WM template definitions to WiFiManagerDebug
- Implement lazy initialization of server manager to save memory
- Add proper cleanup in destructor and on multiple createServer calls
- Update tests to use getServer() and getDNSServer() accessors
2025-11-15 22:22:36 +10:00
alex 1788aa3c4a Refactor WiFiManagerParameter 2025-11-14 16:18:44 +10:00
alex c4ab152566 Pin ESPAsyncWebServer version 2025-11-13 07:42:45 +10:00
alex e5174d1009 Merge branch 'device-framework' of github.com:alexhopeoconnor/WiFiManager into device-framework 2025-11-05 23:25:31 +10:00
alex f056893f87 Implement comprehensive test suite improvements
- Added 42 new tests covering critical functionality:
  * WiFi connection flow tests (6 tests)
  * Callback firing verification tests (4 tests)
  * DNS server lifecycle tests (3 tests)
  * Error condition tests (7 tests)
  * Parameter value management tests (5 tests)
  * WiFi scanning tests (4 tests)
  * State transition tests (4 tests)
  * Integration tests (5 tests)
  * Stress tests (5 tests)

- Fixed compilation errors by replacing protected connectWifi() calls with public autoConnect()
- Fixed config reset callback test to use resetSettings() instead of erase()
- Added delays around resetSettings() calls to prevent ESP8266 WiFi stack crashes
- Reduced stress test iterations to avoid excessive output
- Improved test stability with better state checking and error handling

Total test count: 86 tests (up from 44)
All tests passing successfully
2025-11-05 23:25:06 +10:00
alex f119b02815 Fix async WiFi scanning and captive portal redirects
- Fix captive portal redirect to preserve URL path and query params
- Fix password field rendering for WiFi networks (encryption detection)
- Add WiFiPollingJS template for AJAX polling (currently disabled due to size limit)
- Remove blocking WiFi scan operations
- Add debug output for response handling
2025-11-05 23:19:26 +10:00
alex f5db6b13d1 Merge branch 'device-framework' of github.com:alexhopeoconnor/WiFiManager into device-framework 2025-11-05 20:52:17 +10:00
alex b94f34f06a Remove blocking config portal mode and refactor API
- Remove setConfigPortalBlocking() API and _configPortalIsBlocking member variable
- Remove blocking while(1) loop from startConfigPortal()
- Change startConfigPortal() return type from boolean to void
- Change stopConfigPortal() return type from bool to void
- Make stopConfigPortal() immediately shutdown portal (call shutdownConfigPortal() directly)
- Remove unused portalAbortResult and portalTimeoutResult variables
- Update all comments to remove blocking mode references
- Simplify debug messages (remove 'non-blocking' references)
- Update tests to remove setConfigPortalBlocking() calls
- All 43 tests passing

The config portal is now always non-blocking, requiring users to call
process() periodically in their main loop. This aligns with the async
web server architecture and simplifies the API.
2025-11-05 20:49:22 +10:00
alex a0a7b7e263 Refactor WiFi scanning JavaScript to use raw string literal template
- Remove async parameter from WiFi_scanNetworks() method signatures
- Move JavaScript code to templates/WiFiPollingJS.h using R"rawliteral" format
- Fix JavaScript syntax errors by eliminating quote escaping issues
- Change scan status route from /wifi/scanstatus to /wifistatus to avoid route conflicts
- Cleaner code structure with JavaScript in separate template file
2025-11-05 20:47:10 +10:00
alex d533f4d754 Refactor WiFi scanning to be fully async for ESPAsyncWebServer
- Remove blocking WiFi scan operations from HTTP handlers
- Make WiFi_scanNetworks() always async, remove sync path
- Remove blocking wait loop that caused WDT resets
- Add scan status polling in process() function
- Make getScanItemOut() cache-only, never triggers scans
- Add /wifi/scanstatus JSON endpoint for AJAX polling
- Add client-side JavaScript for async network list updates
- Remove _asyncScan toggle, always use async scanning
- Add scan state management variables (_scanInProgress, _scanRequested)
2025-11-05 19:18:48 +10:00
alex d62f680132 Refactor to use ESPAsyncWebServer instead of ESP8266WebServer/WebServer
- Replace ESP8266WebServer/WebServer with ESPAsyncWebServer
- Update all route handlers to async pattern with AsyncWebServerRequest*
- Replace synchronous HTTPSend() with request->send()
- Add configurable delay constants (REBOOT_DELAY_MS, EXIT_DELAY_MS, ERASE_REBOOT_DELAY_MS)
- Implement scheduled reboot/abort flags instead of blocking delays
- Update WiFiManagerRequestArgs to use AsyncWebServerRequest
- Remove server->handleClient() and server->stop() calls (not needed for AsyncWebServer)
- Update parameter access to use request->getParam() instead of server->arg()
- Add ESPAsyncWebServer to platformio.ini dependencies
2025-11-04 22:51:22 +10:00
alex c2e1e7f95c Bump version to 2.0.18 2025-11-04 20:16:44 +10:00
alex 4b1226bd05 Add WiFiManagerRequestArgs class and update saveParamsCallback to pass request arguments
- Created WiFiManagerRequestArgs nested class to encapsulate HTTP request arguments
- Updated setSaveParamsCallback to accept WiFiManagerRequestArgs by value
- Updated handleWifiSave() and handleParamSave() to build RequestArgs early
- Updated doParamSave() to accept and use RequestArgs for custom HTML params
- Updated test callbacks to match new signature
- All tests passing (43/43)
2025-11-04 20:06:24 +10:00
alex 64c987a560 Remove examples directory and update tests for ESP32 compatibility
- Remove examples directory (not maintained)
- Remove ArduinoJson dependency from platformio.ini (only needed for examples)
- Update platformio.ini comments for test configuration
- Fix test_reset_settings to handle ESP32 NVS behavior differences
2025-11-02 14:17:07 +10:00
alex ca373b2b8e Consolidate and optimize test suite (80 -> 43 tests) 2025-11-02 13:44:49 +10:00
alex afb5bb61b8 Add comprehensive test suite for WiFiManager (80 tests) 2025-11-02 13:25:58 +10:00
alex b2a17d81bf Restructure project for PlatformIO best practices and add test framework
- Move library code from src/ to lib/WiFiManager/src/
- Move headers from include/ to lib/WiFiManager/include/
- Move library.json to lib/WiFiManager/
- Update platformio.ini with Unity test framework configuration
- Add test structure following PlatformIO unit testing best practices
- Remove empty src/ directory (not needed for library-only projects)
2025-11-02 12:50:57 +10:00
alex e6a0813666 Tidy up fork: remove .github, update LICENSE and README 2025-11-02 12:02:32 +10:00
alex 2b40362ff7 Refactor to proper PlatformIO library structure
- Move source files to src/ and headers to include/ directories
- Remove Arduino IDE specific files (.travis.yml, keywords.txt, library.properties, CMakeLists.txt, travis/)
- Update library.json with export section pointing to include/
- Add platformio.ini for development and testing
- Update .gitignore with PlatformIO-specific entries
- Update LICENSE with fork attribution
- Update README.md with PlatformIO-focused installation instructions

Verified working with:
- ESP8266 examples (Basic, Advanced)
- ESP32 examples (Basic)

All builds successful ✅
2025-11-02 01:05:34 +10:00
Rob Aleck 32655b7226 Update WiFiManager.cpp (#1812) 2025-03-28 19:32:57 -05:00
Pascal Brunot b67b7828b9 Fix compilation warning (#1740)
Compiler warning : format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t'
he compiler warning arises because the format specifier %lu expects a long unsigned int, but the variable free is of type uint32_t (which is typically unsigned int). The ESP32, part of the Espressif32 family, typically defines uint32_t as unsigned int, so using the %u format specifier is appropriate.
2025-02-04 20:11:10 -06:00
Dave MadisonandAndreas Breitschopp 8e4c612fa3 Add user custom header/footer functions (#1769)
* Added setCustomTopBodyElement allowing to define custom HTML to be added at the top of the "<body>" tag.

* Change custom top body element to 'header'

This will make more sense once a footer is added. No functional changes.

* Make custom header concat conditional

Matching the _bodyClass comparison above

* Create getHTTPEnd function

* Add custom body footer functionality

* Fix <small> close tag on update page

* Add missing HTTP ends to exit and close

* Remove 'immediately' from header/footer desc

It's not immediate, the 'wrap' div is added before/after.

---------

Co-authored-by: Andreas Breitschopp <a-breitschopp@ab-tools.com>
2024-12-12 16:40:11 -06:00
Shawn A 7e2fa84daf Update cpp_lint.yml
remove line length
2024-12-12 16:39:33 -06:00
Jos Zuijderwijk 0fad7f50d1 Replace deprecated type (#1748) 2024-12-10 21:06:50 -06:00
Jack 47342ed6f7 Force remove DNS input from Captive portal issue #1733 (#1745) 2024-12-10 21:02:41 -06:00
Dave Madison 9333ec68ed Add CSS body classes for each page (#1767)
* Add body classes argument

Note that the additional function argument for getHTTPHead() includes a default argument for backwards compatibility with the API.

* Add page-specific classes

Allows easy styling of each page

* Change root CSS class to 'home'

Trying to avoid confusion between the class for the root level and the CSS ":root" pseudo-class

* Use conditional body class spacing

Avoids an extra space if a body class is set, but an empty string is passed to the function
2024-12-10 20:56:58 -06:00
Anil Raj Rimal 922059b472 fix(compile_example.yaml): Fix cache key inconsistency and correct typo in 'Compile examples' workflow (#1776) 2024-12-10 20:53:25 -06:00
Dave Madison b541d9cd9c Do not fill child backgrounds in dark mode (#1768)
Small change which allows users to style the body background with dark mode enabled, without having to style the child elements (a, h1) as well.
2024-12-10 20:26:18 -06:00
Anil Raj Rimal 7ebbcfe360 Enhance cache strategy with board-specific cache keys (#1777)
* fix(compile_example.yaml): Fix cache key inconsistency and correct typo in 'Compile examples' workflow

* feat(compile_library.yml): Use board-specific cache keys to avoid conflicts
2024-12-10 20:17:25 -06:00
David RAMBEAU a37f4fc41c FR Translation (#1755)
Proposal of French translation
2024-08-07 21:42:01 -05:00
Shawn A e978bc059c Update compile_examples.yaml 2024-03-29 20:40:20 -05:00
Shawn A 94020043a5 Update compile_examples.yaml 2024-03-29 20:39:46 -05:00
Shawn A 8cc5f290fa Rename onDemandWebPortal.ino to OnDemandWebPortal.ino 2024-03-29 20:38:12 -05:00
Harshad Italiya 4cca898927 Renaming as Arduino needs same name for sketch and directory. (#1727) 2024-03-29 14:58:31 -05:00
DarkZeros 76efbd5c36 Fix Debug Log format (#1722) 2024-03-17 15:58:54 -05:00
tablatronix d82d0a1b9f version bump 2024-03-01 20:29:49 -06:00
tablatronix b1720d2981 disable agressivereconn test method 2024-02-19 21:47:44 -06:00
tablatronix d8f8d5478a Adds connect status for ambiguous state
Will find a way to clear this up using assumption based on reason codes, wrong password is very ambiguous with PMF and modern APs
2024-02-16 22:07:21 -06:00
tablatronix 45675eae3e add debug level to version str 2024-02-16 22:02:42 -06:00
tablatronix 91451f58bf typo #1710 2024-02-15 08:59:09 -06:00
tablatronix 304d489c2f fix for #1710 2024-02-14 23:41:56 -06:00
tablatronix 607dfdb606 wifi mode debug 2024-01-22 20:35:10 -06:00
Frank Cohen 0d84861270 Wifi manager frank cohen (#1642)
* Readme update

Tested on ESP32-S3, so I added the ESP32-S3 shield to the readme

* testing a commit

* Update to Readme

Added ESP32-S3 tag and fixed the release shield to not click away from the project.

* Typos fixed
2024-01-20 10:21:23 -06:00
tablatronix e76e4c27af #1703 2024-01-16 22:13:54 -06:00
tablatronix c2af8e55d6 Update WiFiManager.cpp 2024-01-16 22:11:14 -06:00
Yohan Lasorsa 20535edf27 Allow subclassing (#1698) 2024-01-13 09:51:39 -06:00
tablatronix 73da98b3ec Remove S3 NOTEMP 2023-12-31 12:39:34 -06:00
tablatronix c09a3584dd revert, S3 platform does not have this yet 2023-12-31 12:39:19 -06:00
tablatronix 0b734828ba restore getWiFiIsSaved adds lowlevelinit 2023-12-16 22:16:20 -06:00
tablatronix 5656e5707b #1595 2023-11-22 14:08:00 -06:00
tablatronix 3efb536629 disable captiveportal for webportal 2023-11-17 19:37:44 -06:00
tablatronix 9df7acdeeb doh 2023-11-17 12:14:04 -06:00
tablatronix 18145e42ba update serverloc 2023-11-16 21:32:16 -06:00
tablatronix 0e2016879b #1558 fix?
Detect password only change
2023-11-15 21:56:07 -06:00
tablatronix 680968ff30 comments 2023-11-05 08:34:12 -06:00
tablatronix 94529cd08b turn off preload and async scanning
Until more qa can be done here , I have reports of these causing issues and first scans being empty on latest IDF and chips
2023-11-03 22:18:26 -05:00
tablatronix 7d95727761 add button funcs tests to super 2023-11-03 22:17:20 -05:00
tablatronix f328cd05cd possible fixes for these
Not entirely sure why esp8266 is not auto casting these
2023-10-10 22:52:41 -05:00
tablatronix 72956f563f Revert "Revert "#1587""
This reverts commit ba3f1986f2.
2023-10-10 21:56:28 -05:00
tablatronix 1cc7df59c2 add delays to some loops
These are fast and should not be needed but better safe I suppose
2023-10-10 07:09:39 -05:00
tablatronix 439af6e6b1 oops 2023-10-09 22:24:01 -05:00
tablatronix 99f770c493 adds button func tests 2023-10-09 22:22:36 -05:00
tablatronix 5a663db42e Fix debug_max 2023-10-09 22:22:02 -05:00
tablatronix ba3f1986f2 Revert "#1587"
This reverts commit b735c61f6e.
2023-09-28 23:41:35 -05:00
Nicolas T 6a92492bee Update WiFiManager.cpp (#1657) 2023-09-21 08:59:06 -05:00
tablatronix 0d07e09a44 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2023-09-18 18:20:48 -05:00
tablatronix d6bf07fd71 Update OnDemandConfigPortal.ino 2023-09-18 18:20:45 -05:00
tablatronix 5a8e869a7e add workaround for #1543
@etoten thanks, slight change, Might have to add ipv6 detection instead and handle it that way
2023-09-18 18:18:12 -05:00
tablatronix 465b44d734 localize debuglevel enum, add method 2023-09-18 18:14:18 -05:00
tablatronix eb27c525e3 move 404 handler public, remove 404 info, add examples for overrides 2023-09-08 13:27:15 -05:00
Avi B 3a303eeb45 Update CMakeLists.txt (#1624)
Change `REQUIRES` to `PRIV_REQUIRES` because the public API of this package does not require users of this package to know about `arduino`.
2023-06-10 20:53:21 -05:00
tablatronix 9b8de0d77f #1610 quick fix
dirty fix, will have to add proper flashstring helper casts instead probably
2023-05-18 22:51:04 -05:00
tablatronix df250c9074 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2023-05-16 20:20:05 -05:00
tablatronix b735c61f6e #1587
menutokens pointers not actually in progmem
2023-05-16 20:19:57 -05:00
Pascal Wagler cad9ffc83f Make *Show Password* a label so one can click on it (#1595) 2023-05-16 20:17:39 -05:00
tablatronix e9bbb6c588 fixes #1608 2023-05-16 20:14:38 -05:00
tablatronix 88c378f0a2 v2.0.16-rc.2 2023-05-11 13:40:19 -05:00
tablatronix aa8856adf3 #1583 missed this one 2023-05-02 15:03:29 -05:00
tablatronix 4611c75dfb fix #1540 2023-03-22 19:35:57 -05:00
tablatronix 8cf3b43efb Remove hacky scope check, param length 0 2023-03-15 21:24:44 -05:00
tablatronix ca5df00d60 fix HTTPSend copy 2023-03-15 21:17:46 -05:00
tablatronix 4c0d7fa777 Adds es_ES strings sample for WM_STRINGS_FILE
add strings file `build_flags = -DWM_DEBUG_PORT=Serial  -DWM_DEBUG_LEVEL=4 -DWM_STRINGS_FILE="\"wm_strings_es.h\""`
2023-03-15 20:58:45 -05:00
tablatronix ccf04aa5b0 added some http debugging 2023-03-15 17:54:47 -05:00
tablatronix 297123b5d7 disable hallread
I will add esp detection for this stuff before readding
2022-12-16 11:40:15 -06:00
tablatronix 32b6bda04c fixes #1532 2022-12-15 14:41:21 -06:00
Philipp bacaf521e4 Unified casing of strings (#1529) 2022-12-11 11:21:14 -06:00
tablatronix 430a9bcdcb I think i versioned this wrong 2022-12-10 11:22:15 -06:00
Shawn A 26a33e3e11 Update README.md 2022-12-08 10:18:15 -06:00
tablatronix 118ca1ec30 fixes #1528 2022-12-08 10:15:06 -06:00
tablatronix fe9774fe0f lower debug level 2022-11-28 16:34:44 -06:00
tablatronix 7cdaf5c785 2.0.0-RC.1 2022-11-28 16:32:13 -06:00
Shawn A 0080e3581e Refactor strings BREAKING (#1474)
* refactor strings, split out consts breaking!

* move consts out of strings file BREAKING

You will have to remove the constants from your strings files and add the new include instead, a simple diff should obviously show the changes

* adds WM_STRINGS_FILE for env overrides

* Revert "move consts out of strings file BREAKING"

This reverts commit bb9f092413153825d8e7acde1dcc1489e840df1e.

* Create wm_strings_en.h

* final clean up of strings_en.h, legacy

* comments
2022-11-28 16:15:20 -06:00
tablatronix 6eb8432357 add scan mode options examples 2022-11-28 15:30:44 -06:00
Shawn A 71937d1155 Update ISSUE_TEMPLATE.md 2022-11-10 13:07:45 -06:00
tablatronix 9f5981e2fd v bump 2022-10-14 11:50:32 -05:00
tablatronix 701d58fd07 fixes #1511 2022-10-14 11:35:51 -05:00
tablatronix dbefaed1a2 fix #1509 2022-10-14 11:34:50 -05:00
tablatronix 476952c2da add back button to saves 2022-10-04 16:35:43 -05:00
Avi B 48d4dbcfe5 Support for WifiManager as ESP-IDF component (#1489)
Enables support for WifiManager as an ESP-IDF component.  ESP-IDF is a popular development framework for ESP32 chips.

This file is based on the CMakeLists.txt file from the popular Adafruit-GFX-Library library.
2022-10-03 20:55:56 -05:00
Shawn A 9e4b7cb66d Update README.md 2022-09-25 11:48:03 -05:00
tablatronix 7fa6387d99 #1504 2022-09-21 11:55:56 -05:00
Thiti Yamsung 993b1ad9a9 fix: not found getChipModel method for ESP8266 (#1503) 2022-09-21 06:54:31 -05:00
tablatronix 696b920273 update rtc for resetreasons on multiple models 2022-09-20 22:11:52 -05:00
tablatronix 4ff7d7049a add chip model etc to debugging 2022-09-20 22:11:35 -05:00
tablatronix 30efa2e028 add esp model and wifi mode status to info page headers 2022-09-20 22:11:15 -05:00
tablatronix 6d23d7591f remove hall sensor, fix temp 2022-09-20 22:09:57 -05:00
tablatronix 9eee18ab32 add esp32 temp sensor back 2022-09-20 22:08:54 -05:00
tablatronix 0ae78ee339 add heaadings to template 2022-09-20 22:07:50 -05:00
tablatronix 15459925b0 ver bump 2022-09-20 19:39:50 -05:00
tablatronix d5536fbc69 remove workardound for arduino 2.0.5 #1482 2022-09-20 19:37:26 -05:00
tablatronix ac2cd86f21 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-09-16 10:22:48 -05:00
tablatronix 3545410ba4 remove captive portal check on ota done, remove serial debug 2022-09-16 10:22:34 -05:00
tablatronix dda1c45fa9 disable captive portal checks on ota uploades 2022-09-16 10:21:52 -05:00
tablatronix 297a1af260 clean up 2022-09-16 10:21:34 -05:00
Thiti Yamsung c34770ec32 feat(callback): add config portal timeout callback for handle config portal timeout (#1497) 2022-09-15 07:07:55 -05:00
tablatronix 1b5d71bac7 workaround for #1482 2022-09-12 16:06:23 -05:00
tablatronix 6fb63f834a remove wifiissaved check 2022-09-12 16:05:16 -05:00
tablatronix 2b24b91f88 fixes #1490
Does not fix wifi not init yet thanks @erriez
2022-09-12 12:06:40 -05:00
tablatronix b676daf37c oops #1403 2022-09-12 11:23:04 -05:00
tablatronix 7bdcfd501e fix esp8266 versioning 2022-09-01 15:27:31 -05:00
tablatronix 60efff754e fix redefine 2022-09-01 11:53:53 -05:00
tablatronix 62d951c8e4 try to fixup arduino version debugging info 2022-09-01 10:43:44 -05:00
tablatronix bb8aec4ce5 remove reset from basic 2022-09-01 10:43:19 -05:00
tablatronix 201ad2e838 Disable temp sensor for all esp32 until can find a better check 2022-09-01 07:54:41 -05:00
tablatronix d04d1f677b enabling #538
Turning on wifi scan preload and async scanning, with hardcoded cachetime of 30seconds. Should make wifi page load faster, and make interface seem smoother. Will have to test with various enviroments and on S2/x3 chips
2022-08-31 16:40:01 -05:00
tablatronix 9abf5abdf6 fixes #1206 2022-08-31 15:34:20 -05:00
tablatronix 5820298640 cleanup dev example 2022-08-31 14:36:30 -05:00
Shawn A 4dcf0cc78b Update discord link 2022-08-24 18:10:55 -05:00
tablatronix 94bb90322b #1403 try to increase hostname reliability and keep connect times low 2022-08-18 22:10:41 -05:00
tablatronix b90af1ac4d fixes #1068 esp32 S2
Esp32 has seeveral variations on when you can sethostname, might vary with versions so will try to add a best practice for all
2022-08-17 19:24:45 -05:00
tablatronix e0c5fb7daf Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-08-09 11:04:19 -05:00
tablatronix e9dec77a83 beta ver bump 2022-08-09 11:04:07 -05:00
John 8e0a17e5c8 Change test action to install from local directory (#1473)
* Change test action to install from local directory

* Update GH action for ESP8266 as well
2022-08-09 11:00:03 -05:00
tablatronix 58baeaba6f adds temporary fallbacks for esp32 set country
Find better way to check version feature check, arduino ver is not always available.
2022-08-09 10:59:33 -05:00
John 5ded0c9ef8 Use esp_wifi_set_country_code for ESP32 (#1470)
Replaces the use of esp_wifi_set_country() with esp_wifi_set_country_code() for ESP32 in order to both solve a crash under Arduino 2.x and remove the requirement to independently maintain country-specific channel settings
2022-08-09 10:44:06 -05:00
JoergAJ 7d498ed50a Added links in readme file (#1446)
* Update README.md

Updated links to examples

* Update README.md

Updated links

* Update README.md

* Update README.md

* Update README.md

* Update README.md

added placeholder links for buttons

* Update README.md

added links to the action workflow (compile_library /examples) + expressif links to the product pages
2022-07-15 11:59:12 -05:00
tablatronix f2ed2cb997 #1452
Possible fix
2022-07-13 22:14:58 -05:00
tablatronix b8205e71f3 add connection fixes for esp32 wifi not started yet 2022-06-30 13:40:38 -05:00
tablatronix 605d1e897a add missing debug toggle 2022-06-30 12:14:23 -05:00
45gfg9 01bd8a398b Update WiFiManager.cpp (#1443)
Avoid constructing two String objects and adding them together. Just concatenate c-strings.
2022-06-28 13:14:06 -05:00
tablatronix 65fec94317 fix compiler warnings #1421 2022-06-26 23:22:10 -05:00
tablatronix 06c63720f6 #1421
remove temp
2022-06-26 16:39:33 -05:00
tablatronix 14aeb7575f Fix hostname for esp8266, needs to run after sta ughh 2022-06-24 23:44:03 -05:00
tablatronix afd328b3b2 Fix hostname #1403 2022-06-24 20:07:17 -05:00
tablatronix 9e408e41a8 LittleFS Basic example 2022-06-22 10:50:47 -05:00
tablatronix 6522cb30a8 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-06-21 08:22:00 -05:00
tablatronix 260a9abee8 add input type example 2022-06-21 08:21:58 -05:00
tablatronix 3c2a05312b Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-06-20 22:14:12 -05:00
tablatronix b05a71b618 add comments for httpupdate callbacks 2022-06-20 22:13:30 -05:00
tablatronix f9a47786b7 adds otacallback and progress example callback for Update lib #1435 2022-06-20 22:12:52 -05:00
tablatronix a2c33744f6 rename wifi callbacks 2022-06-17 14:21:13 -05:00
tablatronix 317c026952 adds setPreSaveParamsCallback
//called when saving params before anything else happens
    void          setPreSaveParamsCallback( std::function<void()> func );
2022-06-17 14:07:11 -05:00
tablatronix b5671834e4 Moves presavecallback after static ip copy
#1429
2022-06-17 13:50:33 -05:00
tablatronix 7078bd1786 add template js #1430 2022-06-17 12:35:53 -05:00
Martijn Hendriks 1af8f4540d Update strings_en.h (#1430)
show/hide wifi password during input
2022-06-17 12:35:17 -05:00
tablatronix b257590e98 comments 2022-06-17 11:46:49 -05:00
tablatronix ca4b63220c remove double non blocking timeout handler 2022-06-17 11:36:21 -05:00
tablatronix 0ab747c62a going through todos 2022-06-17 11:13:39 -05:00
JoergAJ c6e2b1b349 Updated links in README.md (#1431)
* Update README.md

Updated links to examples

* Update README.md

Updated links

* Update README.md

* Update README.md

* Update README.md
2022-06-16 15:33:51 -05:00
tablatronix 9c7fed4fe1 update template 2022-05-15 08:29:51 -05:00
tablatronix c56eec9018 change css disabled for all 2022-05-15 08:26:04 -05:00
Perry e7bb9bc28e Change Stream to Print (#1307)
* Change Stream to Print 1/2

Update WifiManager to use base class Print instead of Stream.

I debug into a custom buffer, and that buffer implements Print, but not Stream.

* Change Stream to Print 2/2

Update WifiManager to use base class Print instead of Stream.

I debug into a custom buffer, and that buffer implements Print, but not Stream.
2022-05-08 09:30:33 -05:00
Michael Ammann 137410e184 Silence debug output (#1404)
This is probably a left over from debugging, can we remove or at least move it to a DEBUG_WM
2022-05-08 09:28:07 -05:00
Anthony Bryant 86e413dc2a Escape single quotes in htmlEntities() (#1413)
This should allow SSIDs that contain single quotes to populate data-ssid correctly. Without this patch, clicking on an SSID containing a single quote will either:
* Not use the whole SSID, in cases where there's text before the quote:
  `foo'bar` will appear in the SSID box as just `foo`
* Fall back to innerText, in cases where the quote is the first character in the SSID:
  `'); DROP TABLE WIFI; --` will appear in the SSID box as a version that has spaces converted to non-breaking spaces, causing the connection to eventually fail with WL_NO_SSID_AVAIL.
2022-05-08 09:27:17 -05:00
tablatronix 8d34744b29 fixes #1414
added a prefix to macros
2022-05-08 09:24:28 -05:00
alexmaurer-madis 833420fe99 WM_VERSION_STR correction (used in About section) (#1407)
From  "v1.0.11-beta" to "v2.0.11-beta"

I think the major version was forgotten to be updated.
2022-05-03 09:38:44 -05:00
tablatronix b7ca079d9d add favicon example 2022-04-19 20:55:24 -05:00
tablatronix 13b43076f9 bump beta 2022-04-14 12:08:37 -05:00
Ovidiu Pruteanu cd01cbf77d Add .idea to .gitignore for JetBrains IDEs (#1391) 2022-04-12 08:11:31 -05:00
tablatronix 483b83489b Fix #1383 2022-04-11 20:23:43 -05:00
tablatronix 7bffda3fe6 adds option to keep cfgp open on wifi save
// if true (default) then stop the config portal from autoConnect when wifi is saved
    void          setDisableConfigPortal(boolean enable);

Name will change
2022-04-08 20:44:08 -05:00
tablatronix 590e212ddb better fix $1386 2022-04-07 08:41:57 -05:00
tablatronix 379ffee475 clean up variable declarations 2022-04-07 08:38:23 -05:00
tablatronix 1e628625aa fixes #1386
8
2022-04-07 08:37:43 -05:00
tablatronix c9393744a4 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-03-29 14:46:49 -05:00
tablatronix 918e02ddfd add resetsetting delay, some complaints its not working shrug 2022-03-29 14:46:42 -05:00
tablatronix 9cd81e3af9 debug 2022-03-29 14:46:08 -05:00
tablatronix ba6336587e Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-03-29 13:35:00 -05:00
tablatronix 6a85acdf85 add customMenuHTML 2022-03-29 13:34:58 -05:00
tablatronix 88b97c7caa #1383 fix 2022-03-29 13:31:41 -05:00
John ea4ee025f2 Output "Unknown" if Arduino/ESP-IDF version is unknown (#1382)
Closes #1381
2022-03-28 20:41:08 -05:00
tablatronix 278c57b4ec fixes #1379 2022-03-28 08:23:16 -05:00
tablatronix 91826229cb oops 2022-03-26 13:01:01 -05:00
tablatronix 9cec5a25a8 bump version 2022-03-25 14:41:03 -05:00
tablatronix da02b59a21 update template styles, add versionng to info 2022-03-25 14:40:52 -05:00
tablatronix e9a02d4668 add some button feedback 2022-03-25 14:36:46 -05:00
tablatronix b4368308ca remove bad example 2022-03-14 06:43:23 -05:00
tablatronix 47ce0110af Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-03-13 21:36:32 -05:00
tablatronix eb5ba12df1 #1371 2022-03-13 21:36:25 -05:00
tablatronix d70f358f3e add check to dissallow starting cp if already running
This will avoid support inquiries and add a log
2022-03-13 21:34:26 -05:00
tablatronix 1f3b2e34ae typo 2022-03-13 21:26:13 -05:00
tablatronix 0994c4b3f8 regression, webserver callbacks before reset crashes
any webserver event handlers bound before the webserver new reset would cause memory access issues when triggered.

Should remove all events on reset or make memory safe, not sure if this is the correct way to be reseting the webserver, but there were issues with the ports not releasing etc.
2022-03-11 08:34:08 -06:00
tablatronix 0d61a6b55f esp32 crashes on cb route shared pointer 2022-03-11 00:05:01 -06:00
tablatronix e830fa26e3 Adding a data attribute for ssid for input value
so it has nothing to do with the html , and can have different encoding, we could also just use IDs but scan cannot change, or use bssid

#1370
2022-03-11 00:04:21 -06:00
tablatronix acdad80a43 add callback debuggin 2022-03-10 22:34:03 -06:00
tablatronix 8f2c7ae870 remove test 2022-03-10 15:45:49 -06:00
tablatronix 713fcfc740 disable country in example 2022-03-10 15:41:07 -06:00
tablatronix e6d21b8436 use macro for webserver routes fstring helper 2022-02-24 12:15:11 -06:00
tablatronix 0aecb22904 Fix old sdk esp8266 error w softapssid 2022-02-24 11:50:08 -06:00
tablatronix fd7f400b25 Revert "Both infoids and _ap_password are intialized by check time. (#1344)"
This reverts commit 9f6dcad791.
2022-02-24 11:44:45 -06:00
tablatronix d8c81ecca1 macro test 2022-02-24 11:43:42 -06:00
tablatronix 8ecf0575a1 remove old content length headers 2022-02-24 10:45:06 -06:00
tablatronix e9d0012cce abstract httpserver setup 2022-02-23 16:46:24 -06:00
tablatronix c987ee93c8 abstract httpsend 2022-02-23 16:36:52 -06:00
Andy Piper 8279c5be2a Fix "Acccess" typo (#1366) 2022-02-23 13:08:30 -06:00
tablatronix 5acc7cc9aa css tweaks for inputs including select,checkbox
added vertical margins to inputs
2022-02-22 13:41:27 -06:00
tablatronix 14cf6b81d4 bump 2022-02-15 20:59:27 -06:00
tablatronix 36ed8c1af6 undo dashes, no clue
I will have to figure out why this causes ap not found on save, the string looks clean but there must be something going on, scan result not const?
2022-02-15 20:03:22 -06:00
tablatronix a581de29f3 bump ver bugfix 2022-02-15 08:26:55 -06:00
tablatronix 4ab63aa1e9 remove esp32 softapssid, ver check not working correctly 2022-02-15 08:26:42 -06:00
tablatronix c2081aaae7 bump releaase 2022-02-13 15:36:20 -06:00
tablatronix abd52d4754 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-02-04 22:04:22 -06:00
tablatronix 5052c675be version debug 2022-02-04 22:04:21 -06:00
tablatronix 755aca1643 #1348 just change _hostname to string ? 2022-02-04 22:04:10 -06:00
Shawn A 068c32ad27 oops 2022-02-04 18:12:14 -06:00
tablatronix fa76838ee5 fix esp32 softapssid 2022-02-04 17:54:50 -06:00
tablatronix 4d999b1456 fix #1353 #1354 2022-02-04 12:35:10 -06:00
Shawn A 78ca3ee39a badgers 2022-02-02 20:57:56 -06:00
tablatronix 68f5195260 add seminqignal to example dev 2022-01-24 14:13:36 -06:00
tablatronix 4086e46f6c fix param out of scope check, avoids some exceptions 2022-01-24 14:13:03 -06:00
tablatronix cf9d85fd6d add dashes to htmlentities 2022-01-24 14:12:42 -06:00
tablatronix 7c05228def debug logging 2022-01-24 14:12:21 -06:00
tablatronix 924cc06bb2 remove empty ssid, no idea what these are 2022-01-24 14:11:01 -06:00
tablatronix c3c741a2c0 add flash warning 2022-01-24 10:48:35 -06:00
Shawn A 6e057dfbb2 add connect timer log 2022-01-23 20:48:37 -06:00
Shawn A c8a8cc2f31 remove event debug 2022-01-23 20:45:37 -06:00
Shawn A c12d3c4a6e add aggressive recon options 2022-01-23 20:39:15 -06:00
Pedro Gabriel Planel 9f6dcad791 Both infoids and _ap_password are intialized by check time. (#1344)
Comparing it to NULL raises operation overload.
2022-01-23 20:01:05 -06:00
Shawn A 62ba184cc8 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2022-01-22 10:15:59 -06:00
Shawn A cfe2619069 add debugging 2022-01-22 10:15:58 -06:00
tablatronix 810f144cff keep portal open if connectonsave is false
Not sure if this is a good idea or bad one.. probably better than closing it automatically.
2022-01-21 16:14:11 -06:00
tablatronix 553ae00bac #1327 2022-01-21 14:02:59 -06:00
ricardollreis d0bdf7bdaa Enable Portal Timeout in not Blocking Portal (#1331)
Enable the use of setConfigPortalTimeout( ) & setConfigPortalBlocking(false) at same time, by calling process()
2022-01-06 11:04:13 -06:00
tablatronix 8452df79bb patch for arduino 2.0 event names 2021-11-09 08:24:14 -06:00
Shawn A 72b5331610 possible fix #1306 2021-10-30 16:51:39 -05:00
Shawn A 9d061ab24e fixes #1295 2021-10-01 21:17:37 -05:00
tablatronix 927e3e8db0 comment example 2021-09-29 13:47:02 -05:00
tablatronix deeff9fa89 fixes #1297 2021-09-29 13:46:21 -05:00
tablatronix 654d692025 move version to top 2021-09-29 13:07:35 -05:00
Shawn A f1779c97a1 Update titles 2021-09-17 15:31:02 -05:00
tablatronix 9553022b40 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-09-17 10:05:16 -05:00
tablatronix c77ab9e62c flip the --board args, although it was working already 2021-09-17 10:05:04 -05:00
Shawn A 2c28203c29 add discord 2021-09-17 10:02:30 -05:00
Shawn A 05807f56d8 Update README.md 2021-09-17 09:50:18 -05:00
Shawn A fd30eff2bf Update README.md 2021-09-17 09:49:27 -05:00
Shawn A aa20fbc789 swap CI badge 2021-09-17 09:49:03 -05:00
tablatronix ac089992e8 oops forgot this second section 2021-09-17 09:42:37 -05:00
tablatronix 2001438d6f fixing examples and actions 2021-09-17 09:37:07 -05:00
tablatronix 5928293c89 moved non blocking to advanced, accidently put in basic 2021-09-17 09:33:31 -05:00
tablatronix 5e9b0091da wrong case path 2021-09-17 09:22:16 -05:00
tablatronix aa59dcfe0f removed double author from arduino manifest, seems to mess up library searching 2021-09-17 09:17:39 -05:00
tablatronix 5bab658031 oops removed another example 2021-09-17 09:08:35 -05:00
tablatronix 08b2f4d83d change actions compile examples 2021-09-17 09:08:07 -05:00
Dmitriy Shafranskiy 2d2b9f82f3 CI / DC Update - Library Build, Linting, Examples Json Fix (#1264)
* Create main.yml

added onPush & onPull

* Update examples_esp8266.yml

added on push & on pull

* Delete main.yml

* Create examples_esp32.yaml

* CI/DC update

* CI/DC update

* CI/DC update

* hardcoded json lib version

* hardcoded json lib version

* hardcoded json lib version
2021-09-17 09:02:53 -05:00
tablatronix ef8bef1f4d Move spiffs examples, restructure params examples 2021-09-17 08:59:42 -05:00
tablatronix ef09264b6d remove empty example 2021-09-17 08:56:49 -05:00
tablatronix f9091951be add non blocking to basic 2021-09-17 08:56:28 -05:00
tablatronix 925eb79066 clean up spiffs examples 2021-09-17 08:43:01 -05:00
Ruan de Villiers 917f8bbfb0 Auto check ArduinoJson rather than using a #define 2021-09-17 08:32:41 -05:00
tablatronix 620ca70086 Merge branch 'master' into esp32s2 2021-09-09 10:18:58 -05:00
tablatronix 55d7ccbd7a Add better handling of arduino ver checking 2021-09-09 10:18:40 -05:00
tablatronix f199906e9d Testing fixes 2021-09-08 16:41:34 -05:00
Mollayo 70776a0a05 Using __FlashStringHelper for customHTML (#1292)
* Add callback for OTA update

* Using __FlashStringHelper for customHTML
2021-09-08 10:52:21 -05:00
tablatronix 94754e60b5 Merge branch 'master' into esp32s2 2021-09-08 10:49:10 -05:00
Mollayo 8ce698427d Add callback for OTA update (#1286) 2021-09-03 21:23:37 -05:00
tablatronix 8984863fe6 update example action 2021-06-21 11:15:56 -05:00
Dmitriy Shafranskiy cdd8a406a8 Added Github Action to Compile Examples on ESP8266 (#1258)
* Create examples_esp8266.yml

Init add of examples compilation

* Update examples_esp8266.yml

* Update examples_esp8266.yml

* Update examples_esp8266.yml

* Update examples_esp8266.yml

* Update examples_esp8266.yml

* Update examples_esp8266.yml
2021-06-21 11:11:39 -05:00
Shawn A d395e496a1 update travis url 2021-06-21 11:04:20 -05:00
tablatronix e87141eb04 bump arduinojson CI 2021-06-21 10:57:47 -05:00
tablatronix 8c1e890c36 remove uneeded test 2021-06-21 10:54:49 -05:00
tablatronix 109a618c1f Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-06-21 10:42:36 -05:00
tablatronix ce37e5c8ff file was named wrong 2021-06-21 10:42:34 -05:00
Shawn A 8503260101 Merge pull request #1005 from flavio-fernandes/constWiFiManagerParameter
trivial: WiFiManagerParameter get accessors should work on const
2021-06-21 10:28:52 -05:00
tablatronix 2ce0850d80 Renamed example folders 2021-06-21 10:06:46 -05:00
tablatronix 3bf0d4bed3 fix presavecallback called twice if params in wifi 2021-06-21 09:49:39 -05:00
tablatronix 69c60e8e4e drop debug back to verbose 2021-06-12 10:21:46 -05:00
tablatronix a83ac6e926 debugging, bypass loop if portalstopped
I really have to fix this state handling
2021-04-24 12:06:34 -05:00
tablatronix 14f70dde76 Switched to abort for #1243 2021-04-24 10:49:19 -05:00
tablatronix 5fa729170a oops 2021-04-24 09:14:00 -05:00
tablatronix b78efd36df oops #1243 2021-04-22 17:18:36 -05:00
tablatronix 8448d66ea7 #1243 clean 2021-04-22 17:16:34 -05:00
tablatronix bcf1dd69ff oops, fix comemnt 2021-04-22 11:09:19 -05:00
tablatronix 7820fb72e7 #1243 setSaveConnect()
can disable connect when save, does not alter return codes!
2021-04-22 11:06:12 -05:00
tablatronix 3bec5ade1a Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-04-13 14:40:08 -05:00
tablatronix 4d37843af8 fix #1241 maybe 2021-04-13 14:40:06 -05:00
tablatronix 87fcf08ee0 remove content-length heasders #1235 2021-04-13 14:35:27 -05:00
tablatronix f5dd402ba2 Fix ota title 2021-04-08 17:01:47 -05:00
tablatronix 960ef96805 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-04-05 10:05:15 -05:00
tablatronix d157694b12 minor whitespzce 2021-04-05 10:05:14 -05:00
Shawn A 1e90d22d3b removed development branch 2021-03-31 22:07:51 -05:00
Shawn A f16af759d1 Update ISSUE_TEMPLATE.md 2021-03-24 12:57:42 -05:00
tablatronix e8297f9b8f Merge branch 'master' into esp32s2 2021-03-18 16:56:35 -05:00
tablatronix 8bfc228695 fix for numretries not bailing 2021-03-18 16:56:25 -05:00
tablatronix 9b100c34dc missed one #1226 2021-03-18 14:28:04 -05:00
tablatronix c47fc907a9 fix array sizes for info 2021-03-17 14:52:11 -05:00
tablatronix 34e30277d7 double debug 2021-03-17 14:50:15 -05:00
tablatronix cd9e2070c3 fix bug in setconnecttimeout 2021-03-17 14:41:54 -05:00
tablatronix 1431ca7615 Revert "Merge pull request #1206 from cpainchaud/patch-1"
This reverts commit 65d3affda3, reversing
changes made to fe8d2970a0.
2021-03-17 13:46:00 -05:00
tablatronix a9507c98b5 test fixes for v3 esp32 S2 2021-03-16 08:53:17 -05:00
Shawn A 65d3affda3 Merge pull request #1206 from cpainchaud/patch-1
fix potential memory leak in  WiFiManagerParameter::setValue
2021-03-11 13:25:27 -06:00
tablatronix fe8d2970a0 better checking 2021-03-10 11:59:11 -06:00
tablatronix d805cbdc0c oops fix syntax 2021-03-10 11:58:51 -06:00
tablatronix 3e8560c570 fix for esp32 will have to shim 2021-03-09 14:15:34 -06:00
tablatronix 848a107b16 reorder info page 2021-03-09 14:09:14 -06:00
tablatronix 5578cb85c6 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-03-09 11:35:22 -06:00
tablatronix e24108fa45 debugplatform 2021-03-09 11:35:20 -06:00
tablatronix 2dd2eb1d7e fix omit param page if no params 2021-03-06 20:48:16 -06:00
tablatronix 04a39c2917 fix title on ota 2021-03-06 20:10:54 -06:00
tablatronix dac0018d77 Add ability to set custom titles, change page header titles
Replaces root WiFiManager title with cusotm as well as page title, Also swaps headers, title first then domain - ip
2021-03-06 20:09:12 -06:00
tablatronix c48173e32a Add ability to customize debug prefix 2021-03-06 11:25:38 -06:00
tablatronix 133dd8cd52 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-03-06 11:12:08 -06:00
tablatronix 0dbffbb730 adds wifi config tests 2021-03-06 11:12:01 -06:00
tablatronix 8aca0beccb fixup some debugs for portal timeout 2021-02-22 16:04:56 -06:00
tablatronix 77bd201d13 fixes #1210
Moves dns server out of webportal setup as it is only needed for softap and captive portal, still enabled for portal so cp can be toggled on and off
2021-02-22 16:04:37 -06:00
tablatronix 0780e4fe02 adds preloadWiFi default ssid pass 2021-02-05 16:23:44 -06:00
tablatronix c710e9ecbe add br to no networks error 2021-02-05 15:47:13 -06:00
tablatronix 2fdba90efb Remove links from help for dangerous items 2021-02-05 11:09:02 -06:00
Christophe Painchaud 9d9d314a0c fix syntax error 2021-02-05 17:50:34 +01:00
Christophe Painchaud bd59d98b91 fix potential memory leak in WiFiManagerParameter::setValue 2021-02-04 23:29:25 +01:00
tablatronix f122cc9509 fix ota debug 2021-02-04 13:23:48 -06:00
Shawn A 1c72f4c944 Merge pull request #1204 from cpainchaud/patch-1
fix  debug message in WiFiManager::handleParamSave
2021-02-04 12:05:40 -06:00
Christophe Painchaud 42532f995b fix debug message in WiFiManager::handleParamSave
DEBUG_WM(DEBUG_VERBOSE,F("<- HTTP Wifi save "));  while it's obviously Params instead of Wifi
2021-02-04 19:01:04 +01:00
tablatronix f714000fb9 Fixup ota 2021-02-04 10:25:30 -06:00
tablatronix 83e9bbc9db fix esp32 ota size 2021-02-03 16:18:19 -06:00
tablatronix ef8e26c87e debugger adjustments 2021-02-03 12:34:14 -06:00
tablatronix 0d04a14352 fix esp32 country err handle 2021-02-03 11:25:59 -06:00
tablatronix f9b86f6870 Changed ssid psk gets to peristent
Status would not show existing saved ssid psk or status if connect failed, as current config is empty if conx fails, this might break something not sure what else I am using non persistent checking for
2021-02-03 10:01:10 -06:00
tablatronix e933a20d20 Fixes #1203
Psk placeholder should not show if no psk is saved
2021-02-03 09:59:20 -06:00
tablatronix 6119a9efdf refactor #1199 2021-01-28 12:15:57 -06:00
Shawn A 9eac697606 Merge pull request #1199 from cpainchaud/master
adding WifiManager::isConfigPortalActive() abd WifiManager::isWebPortalActive()
2021-01-28 12:06:55 -06:00
Christophe Painchaud 87ec3c8d8d adding WifiManager::isConfigPortalActive() abd WifiManager::isWebPortalActive() 2021-01-28 18:13:09 +01:00
tablatronix 73b465329c clean up redundant debug blocks 2021-01-26 11:18:50 -06:00
tablatronix 245d24b31b fix comments for callbacks 2021-01-25 15:52:11 -06:00
tablatronix 1fc27318d3 Remove branch references 2021-01-25 10:28:39 -06:00
tablatronix 6eb463d646 Merge branch 'master' of https://github.com/tzapu/WiFiManager 2021-01-15 13:33:01 -06:00
tablatronix fcc662c70a add setDarkMode alias 2021-01-15 13:32:59 -06:00
tablatronix 60c1b8617d adding ota error 2021-01-09 11:26:05 -06:00
tablatronix 28a0dcbf13 Merge branch 'master' into development 2021-01-04 11:21:26 -06:00
tablatronix 0602cdcb41 Update .gitignore 2020-12-22 08:44:00 -06:00
Shawn A 6205ddc3d8 Delete .DS_Store 2020-12-22 08:41:41 -06:00
tablatronix e759a48847 esp temp and hall test 2020-12-18 16:26:34 -06:00
tablatronix b3d45031a5 update esp info page 2020-12-18 14:52:23 -06:00
tablatronix db74856951 Fix warning 2020-12-18 14:52:03 -06:00
tablatronix 0b68256215 #1158 2020-12-18 13:26:47 -06:00
tablatronix 6e05a9ff27 fix bad code, this was not supposed to be commited, sorry 2020-12-16 16:37:05 -06:00
tablatronix 41cb00ecaa fixes #1177 oops 2020-12-16 16:23:30 -06:00
Shawn A 4d2a6b2bac Merge pull request #1175 from egrekov/development
Fix. The library is not assembled under ESP8266
2020-12-16 09:32:16 -06:00
Evgenii Grekov 1e85c0e35e Fix. The library is not assembled under ESP8266 2020-12-16 15:17:38 +05:00
Shawn A 82701d9ec7 Update README.md 2020-12-15 20:22:33 -06:00
tablatronix e071e3ad8f debugging testing country esp32 2020-12-14 22:48:10 -06:00
tablatronix e394283fda fix ota handler string 2020-12-14 17:26:44 -06:00
tablatronix 4e4942b511 fixes #1169 for now 2020-12-12 18:25:08 -06:00
tablatronix 1fb70a9b44 fixes #1164 thanks @fretzbiz 2020-12-09 20:50:48 -06:00
Shawn A f0d3a24c11 badgers? 2020-12-08 14:03:07 -06:00
Shawn A 86a97d7669 gitter 2020-12-08 13:38:31 -06:00
tablatronix 506b3c48f3 Merge branch 'development' into ota 2020-12-08 12:59:00 -06:00
tablatronix 16bd0f4f3c dev v2.04 beta 2020-12-08 12:57:33 -06:00
tablatronix 78f00ffe0a v 0.16 2020-12-08 12:54:46 -06:00
Shawn A a72930eebf Merge pull request #1155 from ivankravets/patch-7
Fix library name
2020-12-08 10:31:44 -06:00
Ivan Kravets 8d967a6dfc Fix library name 2020-12-02 15:08:27 +02:00
tablatronix 321034b99e Moved debug strings no in flash, added WM_NODEBUG 2020-12-01 12:07:06 -06:00
tablatronix d8c7d2a6f0 Remove debug 2020-12-01 11:36:41 -06:00
tablatronix fc48649129 nother 2020-12-01 11:33:44 -06:00
tablatronix 12c114d11b missed one 2020-12-01 11:31:31 -06:00
tablatronix 2c84651286 clean up debug lines 2020-12-01 11:27:58 -06:00
tablatronix b34efd0206 testing basic auth 2020-12-01 10:09:15 -06:00
tablatronix 54904d316b add info page ota update 2020-12-01 10:09:01 -06:00
tablatronix 35e9f41b8b Merge branch 'development' into ota 2020-11-23 13:07:59 -06:00
Shawn A b5508762ef Merge pull request #1151 from brewpi-remix/development
Use constrain properly
2020-11-22 10:05:18 -06:00
Lee Bussy 3a66412db4 Merge pull request #1 from brewpi-remix/fix-constrain
Use constrain properly
2020-11-22 07:58:31 -06:00
Lee Bussy 5def8f84d4 Use constrain properly 2020-11-22 07:58:02 -06:00
tablatronix e1a263b47f forgot to clamp 0 2020-11-19 14:42:38 -06:00
tablatronix 3828790109 remove warnings 2020-11-19 14:25:21 -06:00
tablatronix a7fb6d5caf adds #1137 connect retries
setConnectRetries()
2020-11-19 14:25:12 -06:00
Flaviof 08fbe310b7 Merge branch 'development' into constWiFiManagerParameter 2020-11-19 14:32:36 -05:00
Shawn A 9e29835ac8 Merge pull request #1106 from davefiddes/fix-warning-in-debugplatforminfo
Fix warning in WiFiManager::debugPlatformInfo for ESP32
2020-11-19 13:11:32 -06:00
tablatronix e454c9969a remove oled stuff 2020-10-17 21:44:55 -05:00
tablatronix 08efbfcfe7 remove country debug 2020-09-15 10:18:43 -05:00
tablatronix 726bdfae46 #1125 remove country from 2.3.0 2020-09-15 09:54:45 -05:00
tablatronix 61916627ed example compile issue 2020-09-14 10:23:09 -05:00
tablatronix d1656421bb remove getheapstats, not exist in 2.3.0 2020-09-14 10:23:00 -05:00
David J. Fiddes fac59e1982 Fix warning in WiFiManager::debugPlatformInfo for ESP32
This fixes an unused variable warning as the call to
heap_caps_get_free_size() is not required.

Tests:
 - Enable debug mode and verify free heap and ESP SDK
    version are correctly displayed
 - Cross check with the free heap reported via the captive
    portal info page
2020-08-13 18:19:55 +01:00
tablatronix 31be25d54b Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2020-08-04 23:24:29 -05:00
tablatronix 994609f1e0 add logging 2020-08-04 23:24:28 -05:00
Shawn A 4319a66da9 Merge pull request #1073 from adrianjost/patch-1
swap comments
2020-06-07 13:58:21 -05:00
Adrian Jost 998243c60c swap comments 2020-06-07 20:26:03 +02:00
tablatronix 9af72535ef I messed up 2020-05-25 11:42:31 -05:00
tablatronix 2cedf7b368 2.0.2 2020-05-24 14:11:25 -05:00
tablatronix af3c3671a2 oops, remove js alert debug 2020-05-24 13:19:00 -05:00
tablatronix 80a8dfd554 Merge branch 'master' into hotfixes 2020-05-22 10:09:56 -05:00
tablatronix bc06bb0a1b clean up dev example a little 2020-05-19 23:26:08 -05:00
tablatronix 57a9f17335 add mdns update to process 2020-05-19 23:25:54 -05:00
Shawn A b2f87abd1b Update README.md
Title..
2020-05-19 16:18:44 -05:00
tablatronix 01538e69c1 cleaning up .h 2020-05-19 11:55:58 -05:00
tablatronix 3c0c3ff93e adds green status S, adds test back button 2020-05-19 11:34:31 -05:00
tablatronix f99eda8a9f Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2020-05-19 10:58:12 -05:00
tablatronix d71a14194b Fix MDNS
stupid c++ macros
2020-05-19 10:58:10 -05:00
Shawn A 95d116cea3 Update README.md
:warning
2020-05-18 16:34:27 -05:00
Shawn A f4a577bbc2 Update README.md 2020-05-18 16:31:13 -05:00
tablatronix 634fac4be0 fix travis esp32 2020-05-18 15:49:24 -05:00
tablatronix b67d1656d8 Fix esp32 mdns 2020-05-18 15:46:44 -05:00
tablatronix 01b909a1d2 version alpha release 2020-05-18 15:36:15 -05:00
tablatronix 5edf38550a update 2020-05-18 15:35:50 -05:00
tablatronix 7458674c7b Merge branch 'development' into ota 2020-05-15 16:53:13 -05:00
tablatronix 0486034c6a some comments etc 2020-05-14 21:56:33 -05:00
tablatronix 6029a39f05 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2020-05-14 21:55:49 -05:00
tablatronix 3e9f9a103e #1050 prevent copy assignment of param constructor 2020-05-14 21:55:47 -05:00
Shawn A 062e66bb3c Merge pull request #1053 from dontsovcmc/readme_dns
Readme: fill DNS server if setSTAStaticIPConfig
2020-05-14 08:21:00 -05:00
doncov.eugene 7b52e709db Readme: fill DNS server if setSTAStaticIPConfig 2020-05-14 15:50:39 +03:00
tablatronix 135e872caa remove debug 2020-05-11 21:29:46 -05:00
tablatronix 6515190124 fixes #1046 2020-05-11 17:23:20 -05:00
tablatronix 32075b32cd fixes #1040, adds http port
`setHttpPort`
2020-05-11 12:39:50 -05:00
tablatronix 6b6a960075 Merge branch 'development' into ota 2020-05-10 14:00:22 -05:00
tablatronix 5aebb1dd51 Some hostname testing 2020-05-08 23:31:02 -05:00
tablatronix 293f705b0f #1039 2020-04-19 00:53:18 -05:00
tablatronix e9d75a08b8 Disables usermode restore
I may add optionals later for this, right now sta mode is the default, and sta mode will always be the only mode on after using WM, if you were using ap mode you have to turn it back on yourself until I have a better solution or documentation.
2020-04-10 10:06:11 -05:00
tablatronix 709cfffb95 adds embedded logo example 2020-04-07 11:42:01 -05:00
tablatronix 6c08094e41 Skip autoconnect when there are no creds saved 2020-03-13 11:35:04 -05:00
tablatronix 4a98ba0e29 Update OnDemandConfigPortal.ino 2020-02-27 11:34:31 -06:00
tablatronix 3f93afe9c2 change debug saves logs 2020-02-25 16:31:45 -06:00
tablatronix eb771a0608 Merge branch 'development' into ota 2020-02-19 12:54:04 -06:00
tablatronix 89fcfe9680 adds to dev example 2020-02-18 16:25:17 -06:00
tablatronix b61bc261bf disable clean connect, OPTIONAL setter
setCleanConnect(bool enable); // default false

This was originally intended to improve connection stability, but it is now causing problems , this is now disabled and can be reenabled optionally.
Possible race condition diconnecting while auto connecting or async setmode delays
2020-02-18 16:14:45 -06:00
tablatronix decd2942c5 fix param out of scope check in doparamsave 2020-02-18 15:09:42 -06:00
tablatronix dd8bbea8c5 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2020-02-18 13:31:49 -06:00
tablatronix bdb1ab3c32 comments, dev example tests 2020-02-18 13:31:40 -06:00
Shawn A e173946284 Merge pull request #1011 from marcovannoord/patch-1
Update WiFiManager.cpp
2020-02-18 13:29:28 -06:00
Marco f7d4c166ae Update WiFiManager.cpp
Fixed bug where, after clicking "Save", it would display an empty page to the user, instead of the wifi save page. (due to local variable)
2020-02-18 11:02:56 +01:00
Flavio Fernandes 893568052a trivial: WiFiManagerParameter get accessors should work on const instances
Enhancement: It should be okay to invoke getID() and getValue() in a
const instance of the WiFiManagerParameter class.

See: https://github.com/flavio-fernandes/persistWifiSetting/commit/135adb1c7e436db1ed92ccd5eb522b9ae418b216
2020-02-07 07:39:46 -05:00
Shawn A 9967d27148 Merge pull request #993 from Ruandv/issue654
Fix ArduinoJson (Using ARDUINOJSON_VERSION_MAJOR)
2020-01-27 14:28:25 -06:00
tablatronix cc4acba4ab add shouldbreakafterconifg workaround to readme 2020-01-22 10:51:27 -06:00
tablatronix 87009dc443 fixes #987 2020-01-22 10:42:08 -06:00
tablatronix 2f76338ec7 merge and release hotfixes 2020-01-22 09:05:41 -06:00
tablatronix f3c1964e1c Merge branch 'hotfixes' 2020-01-22 09:04:39 -06:00
tablatronix 13132edd9e Easier debugging autoconnect 2020-01-22 09:02:02 -06:00
Shawn A 0a7d7469fd Merge pull request #995 from revolter/patch-1
Add missing line to code sample
2020-01-22 08:58:43 -06:00
Iulian Onofrei 725f824e58 Add missing line to code sample 2020-01-19 18:35:06 +02:00
Ruan de Villiers a6438edb3c Auto check ArduinoJson rather than using a #define 2020-01-15 07:24:28 +02:00
Ruan de Villiers 9669bfd1a3 Added functionality to toggle between ArduinoJson 5 and 6 2020-01-14 21:20:51 +02:00
Ruan de Villiers 210b4c5d01 Updated AutoConnectWithFSParameters to toggle between ArduinoJson5 and ArduinoJson6 2020-01-14 21:07:38 +02:00
tablatronix ef962adc57 Merge branch 'development' into ota 2019-12-12 12:41:27 -06:00
tablatronix c9665adfaf oops remove mdns test 2019-12-03 23:00:40 -06:00
tablatronix 12fde678e5 bump arduino ide 2019-12-03 22:55:59 -06:00
tablatronix 351761b9a7 travis failing shrug
`home/travis/.arduino15/packages/esp8266/hardware/esp8266/2.6.0/cores/esp8266/debug.h:8:26: error: '::printf' has not been declared`
2019-12-03 22:15:03 -06:00
tablatronix 0fd0c33222 remove serial1 2019-11-29 20:06:41 -06:00
tablatronix 636027cabc rework #974
make compatible with params page
2019-11-29 20:04:31 -06:00
tablatronix 7882c0e9a9 fixes #975 2019-11-29 19:54:02 -06:00
tablatronix 9d6ce13b92 fix for #740 confusion 2019-11-29 19:29:56 -06:00
tablatronix 72bcbd8a80 fixes #974 password placeholder
showPassword()  optional
2019-11-29 18:32:10 -06:00
tablatronix 56ad40d083 Fixes #970 I broke constructor 2019-11-17 12:20:30 -06:00
tablatronix 22e35b2a03 #667 remove compile warning
Still not sure what the issue was here.
2019-11-14 00:37:41 -06:00
tablatronix f93d444966 remove otaflag probably not needed 2019-11-14 00:24:11 -06:00
tablatronix d90f6854e9 Update OnDemandConfigPortal.ino
adds ota to dev example suite
2019-11-13 23:11:05 -06:00
tablatronix a4993a8441 comments 2019-11-13 23:10:43 -06:00
tablatronix 768ead409e add support for build debug flags
WM_DEBUG_LEVEL
WM_DEBUG_PORT
closes #965
2019-11-13 22:47:55 -06:00
tablatronix fb29462e73 add heap frag logging to esp32 2019-11-13 09:12:23 -06:00
tablatronix 2447a3fd74 oops double debug titles 2019-11-12 22:56:46 -06:00
tablatronix e45bdb1831 Update WiFiManager.cpp
adds more heap debug debug_level DEBUG_MAX to enable
#961 #518
2019-11-12 22:54:45 -06:00
tablatronix a2355889ba fixes #956
Not tested, not sure if captive portal works with hidden ap, test please.
adds wm.setWiFiAPHidden(bool);
2019-10-30 08:55:24 -05:00
Shawn A 4014daeb71 Merge pull request #958 from LongLiveCHIEF/add-platformio-install-info
Add PlatformIO installation docs
2019-10-27 20:13:11 -05:00
Brian vanderbusch 7d7e228b9e Add PlatformIO installation docs 2019-10-27 15:06:44 -05:00
tablatronix 9a85b107fa spiffs erase #949 2019-09-26 13:56:48 -05:00
tablatronix 8190ec6077 Merge branch 'development' into ota 2019-09-25 12:43:49 -05:00
tablatronix 3771a79a55 dev example country and bounce 2019-09-13 11:28:05 -05:00
tablatronix 4d94476fa3 add string guards 2019-09-13 11:27:20 -05:00
tablatronix 5d9a51f671 adds country support for esp8266 #667 2019-09-13 11:27:05 -05:00
tablatronix e50d30cd5e uppercase default ap name
This should match the default in sdk now
2019-09-12 14:49:38 -05:00
tablatronix 6e1e698cf9 comments 2019-09-12 09:57:56 -05:00
tablatronix f06f4ea5dc adds async cache time _scancachetime adds async flag 2019-09-12 09:57:35 -05:00
tablatronix 646af21d30 changed dev example non delay 2019-09-12 09:56:55 -05:00
tablatronix 3f8f3eb1ad fixes #936, adds setWiFiAPChannel 2019-09-12 09:56:37 -05:00
tablatronix bd8320a45a fixes #935 disables password ofr open ap selects
Only works if htmk class l is not removed and html not changed, js will have to be updated if changed
2019-09-12 09:53:49 -05:00
tablatronix 58428ec1f8 fixup some calls
I think these should work, will have to test for empty strings and not actual info and fix
2019-09-11 12:22:31 -05:00
tablatronix 999da6d1a1 fixes #924 wifi info getters
gets ssid and psk with persistent param, needs testing
2019-09-11 12:00:09 -05:00
tablatronix 368ea928f0 arduino wont pickup this release
trying a different format
2019-09-09 08:46:45 -05:00
tablatronix 7acc77bcb1 fixing comments for disableipfields 2019-08-30 10:48:43 -05:00
tablatronix 2e7af253ab V0.15-beta
I think this works for library managers..
2019-08-30 09:44:20 -05:00
tablatronix d0e70fdd6b fixes #336 2019-08-30 09:36:44 -05:00
tablatronix 8f9edd18a6 fixes #708 2019-08-30 09:19:20 -05:00
tablatronix 89eb952d18 hotfix #576 2019-08-30 09:14:54 -05:00
Shawn A d1e395e78f Merge pull request #615 from xnorbi/master
Fixed: Waiting for connection result with time out issue
2019-08-30 09:02:19 -05:00
Shawn A 286e5d13d9 Merge pull request #772 from dontsovcmc/issuu_#644_utf-8_correct
separate charset UTF-8 and viewport meta
2019-08-30 09:01:09 -05:00
Shawn A ff26ed4e4c Merge branch 'master' into issuu_#644_utf-8_correct 2019-08-30 09:00:57 -05:00
Shawn A edce3fc84c Merge pull request #928 from d-a-v/head
hotfix: rename internal HTTP_HEAD to HTTP_HEADER
2019-08-30 08:52:52 -05:00
David Gauchard f26638e38b hotfix: rename internal HTTP_HEAD to HTTP_HEADER 2019-08-30 15:38:36 +02:00
tablatronix 1b8d870c22 add explicit mode to all examples
So people stop complaining when ap starts by default cause they dont know how esp works.
2019-08-14 13:40:19 -05:00
tablatronix 34d9a975b5 remove reeadme self reffeential link 2019-07-29 16:59:50 -05:00
tablatronix e2d7ae7533 ESP32 DEFINE LED_BUILTIN 2019-07-29 16:33:59 -05:00
tablatronix 41810a344a bump arduino 1.8.8, install boards esp32 2019-07-29 16:06:57 -05:00
tablatronix 6e1104efbf esp8266 build passing, work on esp32 2019-07-29 15:08:34 -05:00
tablatronix 422ce3e165 not sure how this all got changed 2019-07-29 14:13:39 -05:00
tablatronix 7f414f5224 dumb 2019-07-29 14:10:01 -05:00
tablatronix 5b997e0597 trying to fix travis again 2019-07-29 14:02:47 -05:00
tablatronix 6335512ded Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2019-07-29 13:49:17 -05:00
tablatronix 7446edf547 remove esp32 travis 2019-07-29 13:48:53 -05:00
tablatronix 4775b1df51 ok maybe not 2019-07-19 09:19:39 -05:00
tablatronix 8a8e363cc3 Can i just do esp32 boards install now ? 2019-07-19 08:23:21 -05:00
tablatronix b5218d1b93 fix travis compile on esp32 2019-07-19 08:04:46 -05:00
tablatronix e0e0150f78 why did they change every flag????? 2019-07-13 07:34:57 -05:00
tablatronix 5685e7d9b4 ugh boards is so whack 2019-07-13 07:21:19 -05:00
tablatronix 35a1ab2e8d remove crytalfreq 2019-07-13 07:18:23 -05:00
tablatronix 8483118860 all jacked up 2019-07-13 07:15:32 -05:00
tablatronix 49c6cec998 ugh wtf 2019-07-13 07:08:35 -05:00
tablatronix a1c53d785f travis fqbn updates
just removing bad ones for now, will fix later
2019-07-13 07:00:13 -05:00
tablatronix debb20e41b Revert "remove geenric from travis for now"
This reverts commit d20b85a7b8.
2019-07-13 06:56:20 -05:00
tablatronix d20b85a7b8 remove geenric from travis for now 2019-07-13 06:53:58 -05:00
Shawn A c3ff582374 Merge pull request #894 from mikdatdogru/patch-1
signal class value has been wrapped to int()
2019-06-03 11:38:29 -05:00
Shawn A cccc7c9ae6 Merge pull request #895 from mikdatdogru/patch-2
Update WiFiManager.template.html
2019-06-03 11:32:38 -05:00
Mikdat DOĞRU 318742e183 Update WiFiManager.template.html
parse.js parsing error fixed
2019-06-02 18:58:13 +03:00
Mikdat DOĞRU 7fbb941383 Update WiFiManager.cpp
i wrapped to int() function, because cannot match on css because the incoming data is decimal
2019-06-02 18:27:50 +03:00
tablatronix 4873c7c632 silence event debug 2019-02-26 21:37:57 -06:00
tablatronix f0441f65b7 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2019-02-26 21:36:27 -06:00
tablatronix ea1a09130f fix #771 again, I never set hasbegun to true!
should fix esp32 events not working, namely async scannetworks
2019-02-26 21:36:25 -06:00
tablatronix 8b685d6826 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2019-02-25 08:46:29 -06:00
tablatronix 621ac63154 Update .travis.yml 2019-02-25 08:46:10 -06:00
tablatronix d6cf147e5b fixing up travis, not sure why cpufreq is throwing errors or debug ? 2019-02-24 08:41:33 -06:00
tablatronix 30fd2b13a6 remove extra define init() 2019-02-24 08:30:57 -06:00
tablatronix 6131c2d38a update basic.ino 2019-02-24 08:29:20 -06:00
tablatronix bbc98a7e74 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2019-02-19 22:06:18 -06:00
tablatronix 9353fb01d3 added debugging log 2019-02-19 22:06:16 -06:00
Shawn A 8f6950d3eb Merge pull request #803 from sidey79/define-hardware
wifimanager.cpp / wifimanager.h
2019-02-14 11:52:42 -06:00
tablatronix 0865a36a5e fix for #782 2019-01-31 16:49:13 -06:00
tablatronix c6591ce7b9 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2019-01-26 18:07:24 -06:00
tablatronix 0e75b669b7 change var name 2019-01-20 10:11:24 -06:00
tablatronix 3717e323b9 adds password debugging 2019-01-10 15:37:12 -06:00
sidey79 1282c4d5b5 wifimanager.cpp / wifimanager.h
added define that checks on esp32 or esp8266. If another hardware is selectec, then do not try to compile this code.
2019-01-08 23:33:56 +01:00
tablatronix 862e2dbde2 stupid shit wont compile
other stuff says not in scope , makes no sense
2019-01-04 14:54:31 -06:00
tablatronix aaf2544c93 add sample oled support to DEV example 2019-01-04 14:50:38 -06:00
tablatronix e25277b20c make getRSSIQuality public 2019-01-04 09:37:07 -06:00
tablatronix 944450840a applies #772 to dev 2018-12-20 10:56:55 -06:00
tablatronix 540ee694fe Merge branch 'development' into ota 2018-12-20 10:47:11 -06:00
david gauchard 71f997b5c7 Merge branch 'master' of https://github.com/tzapu/WiFiManager into loop 2018-12-08 23:42:48 +01:00
doncov.eugene fd6bf74720 separate charset and viewport meta 2018-11-26 17:03:20 +03:00
tablatronix 65ad141008 Update WiFiManager.cpp
tentative fix for #771
2018-11-24 19:16:25 -06:00
tablatronix 4add3127d4 Update WiFiManager.cpp
tentative fix for #771
2018-11-24 19:12:33 -06:00
tablatronix 3e2f8ae9d8 fix update menu bug 2018-11-18 10:32:13 -06:00
tablatronix bbe984c93b sampe update 2018-11-13 16:49:43 -06:00
tablatronix cf1b1a93a6 remove width to make buttons back to small width 2018-11-13 16:36:21 -06:00
tablatronix 0ec7a58b7b add upload note 2018-11-13 16:35:26 -06:00
tablatronix 7da803389c add js to firmwaree upload
hide upload until selected, update return msg box
2018-11-09 16:43:54 -06:00
tablatronix 5a3829abf9 Merge branch 'development' into ota 2018-11-09 15:38:19 -06:00
tablatronix 6459e4fd4d add variable css to template 2018-11-09 15:37:27 -06:00
tablatronix df38c54a66 Merge branch 'development' into ota 2018-11-09 15:26:52 -06:00
tablatronix 65cb95585d more css consolodating 2018-11-09 15:25:56 -06:00
tablatronix 9d3cc69b56 rework css
shrink css, add file upload input styling
2018-11-09 15:16:19 -06:00
tablatronix 5dab5a4685 adds accept filter for ota .bin
#727
2018-11-09 14:20:35 -06:00
tablatronix 69e08e7871 add input accepttype 2018-11-09 14:19:30 -06:00
tablatronix c9af1b11a7 clean up some ota stuff disable renable timeouts 2018-11-08 14:11:56 -06:00
tablatronix cac71e368e update todo 2018-11-08 13:36:13 -06:00
tablatronix 2267f34fb5 fix wrong urls 2018-11-08 13:35:33 -06:00
Shawn A 205d30e958 Merge pull request #587 from sidey79/dev-ota-updater
WIP: Added OTA updater option from esp8266
2018-11-08 12:51:02 -06:00
Shawn A 7dc75eacde Merge branch 'ota' into dev-ota-updater 2018-11-08 12:50:14 -06:00
tablatronix 9a4c0f1580 hotfix #576 2018-11-08 12:20:01 -06:00
tablatronix ccfca4b663 adds customhtml input example 2018-11-06 12:04:18 -06:00
tablatronix 41214ad7eb Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-11-02 10:13:09 -05:00
tablatronix 501c824993 supports stopConfigPortal if blocking , flag abort 2018-11-02 10:13:07 -05:00
tablatronix 73f2a8c366 adds empty param constructor 2018-10-31 14:23:39 -05:00
tablatronix 38b6c878a2 chaange setCaptivePortalClientCheck to setAPClientCheck 2018-10-31 14:15:02 -05:00
tablatronix 370be061e4 adds custom param examples to advanced 2018-10-31 14:03:26 -05:00
tablatronix 2209f987b7 removed placeholder and added temlplace comments 2018-10-31 14:02:16 -05:00
tablatronix 7f0bd1e41f changed placeholder to label
deprecated getPlaceholder with getLabel
2018-10-31 13:47:05 -05:00
tablatronix 55577692fe add ntp time to dev example 2018-10-18 16:47:52 -05:00
tablatronix 2d021bbab8 adds nonblocking params example 2018-10-13 15:57:00 -05:00
tablatronix 256c889715 comments 2018-10-12 16:08:31 -05:00
tablatronix c3fd7d9622 #461 testing
adds new callback and moved webserver to public
2018-10-12 15:57:35 -05:00
tablatronix 3c280b12a8 moved apcallback after webserver is available 2018-10-12 15:16:59 -05:00
tablatronix 080f7751e0 moving apcallback after everything 2018-10-12 14:52:10 -05:00
tablatronix 1d0970a882 moving apcallback after sosftap()
apcallback used to only indicate that mode was softap, moved untikl after actually starting the ap, so it can be used to check status and get ip etc.
2018-10-12 14:10:16 -05:00
tablatronix bef46b9e72 adds setSaveParamsCallback
clean up examples
2018-10-11 15:23:48 -05:00
tablatronix 4f1196aa69 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-10-06 14:11:22 -05:00
tablatronix ea67dc22c0 remove resetsettings 2018-10-06 14:11:20 -05:00
tablatronix b091ee00d8 working on readme 2018-10-05 15:04:25 -05:00
tablatronix ec1d474d7b readme and comments 2018-10-05 14:29:11 -05:00
Shawn A 7d01b99e72 Merge pull request #378 from gmag11/resetConfigCallback
Add a callback when reset settings is triggered, changed to development branch
2018-10-05 09:21:36 -05:00
Shawn A 29bb8a7d22 Merge branch 'development' into resetConfigCallback 2018-10-05 09:21:14 -05:00
Shawn A b95cadbe9a Merge branch 'master' into resetConfigCallback 2018-10-05 08:43:26 -05:00
Shawn A e1e061e46a Merge pull request #734 from irwanayeah/development
add callback before save config wifi or params
2018-10-05 08:41:57 -05:00
Shawn A 686f7f74ee Merge pull request #718 from fllaca/get_parameters_method
Implements #717:  Added getParameters and getParametersCount methods.
2018-10-03 10:29:45 -05:00
tablatronix 669dad4206 starting readme updates 2018-10-01 12:28:37 -05:00
Shawn A 8e7b43a029 rename example 2018-09-27 13:39:12 -05:00
Shawn A fe772f6bf5 fix example 2018-09-26 09:47:59 -05:00
Shawn A 193fdf177c fix example 2018-09-26 09:45:03 -05:00
Shawn A 613ec354bd param defvalue mismatch checking 2018-09-26 09:44:59 -05:00
Shawn A 6dbc0017ba Merge pull request #743 from dontsovcmc/setValue
Set value
2018-09-26 10:28:33 -04:00
Shawn A 37e100672a Merge pull request #741 from dontsovcmc/waterius_development
WiFiManagerParameter init() to protected from private
2018-09-26 10:27:51 -04:00
Dontsov Evgeny 7d42423894 value limit is length 2018-09-24 04:19:21 +03:00
Dontsov Evgeny 85b2319b59 correct your idea about deflength 2018-09-24 03:45:49 +03:00
Dontsov Evgeny dbf91a4e8c example: custom paramaters with load/save settings 2018-09-24 03:28:03 +03:00
Dontsov Evgeny aad1a8d9d2 WiFiManagerParameter init() to protected 2018-09-23 23:19:17 +03:00
Shawn A c0f29a6fc3 Merge branch 'master' into hotfixes 2018-09-20 12:15:44 -05:00
Shawn A 34e1516524 charset utf-8 2018-09-20 12:15:02 -05:00
Shawn A 740005b21e Merge pull request #687 from dontsovcmc/utf-8
issuu #644 add utf-8 charset to head
2018-09-20 12:08:39 -05:00
Shawn A b42b2f23c2 Merge pull request #722 from rodri16/patch-2
Swapping enableAP and softAPConfig
2018-09-20 12:05:21 -05:00
Shawn A 0e4af48d54 fix example 2018-09-19 09:54:17 -05:00
Shawn A 9d00937f34 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-09-18 11:35:57 -05:00
Shawn A 0cd0b75d9e added custom html param example pattern 2018-09-18 11:35:55 -05:00
tablatronix c88df86313 syntax error in examples 2018-09-17 13:44:06 -05:00
Fernando Llaca 1c191c1d14 Rename "Old Examples" folder to "Old_Examples", to avoid errors when iterating examples folder. 2018-09-16 23:16:25 +02:00
Fernando Llaca 12fc6516d2 Missing semicolon 2018-09-16 22:57:01 +02:00
Fernando Llaca 448e079bc8 Use a especific version of ArduinoJson 2018-09-16 22:49:40 +02:00
Fernando Llaca b4cc27cb56 Added getParameters and getParametersCount methods.
Useful for iterating over WiFiManager parameter list
2018-09-16 21:34:24 +02:00
ayeah f9d1c9bd6f reformat 2018-09-17 01:19:18 +07:00
ayeah d9c27b98d4 add listener setPreSaveConfigCallback
this listener required for action before save process behind wifi or params.
2018-09-17 01:10:37 +07:00
Shawn A 4f0a87a0a5 adds esp32 core temp, not enabled
the core temp sensors are not calibrated in production atm, they are large offsets form chip to chip and are useful for relative temp swings only. Until the IDF comes up with a new temp sense, this is commented out.
2018-09-12 13:19:53 -05:00
Shawn A 9ce498c5b6 remove sleep mode 2018-09-12 10:55:04 -05:00
Shawn A 393e7e45df bug fixes #726 2018-09-12 09:56:20 -05:00
Shawn A 1e10ffa49a reworkgin examples 2018-09-07 16:16:44 -05:00
Shawn A 2610dcb2c5 change simple to basic clean up 2018-09-07 15:52:52 -05:00
Shawn A ed80635e32 non blocking examples 2018-09-07 15:43:43 -05:00
Shawn A c52186079a stopconfigportal public 2018-09-07 15:43:21 -05:00
Shawn A 7f12e202d4 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-09-07 14:53:11 -05:00
Shawn A 97e7d30c66 esp8266 2.3.0 compatability restored #576
asyncscannetworks not available in esp8266 2.3.0, adjusted server on to take cstr for backwards compatability
2018-09-07 14:53:08 -05:00
Shawn A 04552e40d8 some testing 2018-09-07 14:51:27 -05:00
tablatronix 0d8b96ebf3 update docblock to reflect setConfigPortalBlocking ignored configportaltimeout 2018-09-06 20:45:38 -05:00
Rodrigo Jose Carbajales 5827c2f8cb Swapping enableAP and softAPConfig
Swapping enableAP and softAPConfig for static IP STA
2018-09-06 12:11:38 +02:00
Shawn A 8871bdd311 logging 2018-09-04 16:39:16 -05:00
Shawn A 338544bc6a do savecallback on parmsave fo rnow #714 2018-09-04 16:39:00 -05:00
Shawn A 43051f9f51 fix 2018-09-04 16:37:14 -05:00
Shawn A 7ab5f6d5b2 clear wifi strings 2018-09-04 16:36:58 -05:00
Shawn A 3a0723cf66 skip connect if wifi empty 2018-09-04 16:36:47 -05:00
Shawn A 103c37d71f Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-09-04 08:14:12 -05:00
Shawn A 42241d6e36 fix nvs erase log 2018-09-04 08:13:30 -05:00
tablatronix b17c328f0f more debugging 2018-09-03 17:19:25 -05:00
tablatronix c1f018ca7c tentative fix for #720 2018-09-03 08:49:13 -05:00
Shawn A d6e091f587 test fix #702 2018-08-29 12:06:55 -05:00
Shawn A 8b579bb8a7 debug 2018-08-29 11:22:05 -05:00
Shawn A b2f6ff4a1f formatting 2018-08-29 10:39:28 -05:00
Shawn A 805072c4c4 adds checkboxes 2018-08-29 10:37:28 -05:00
Shawn A 247aecb2fc update requirements esp8266 2.4.0 2018-08-28 09:00:24 -05:00
Shawn A c78b76ba2e scan timing debugging 2018-08-27 12:30:28 -05:00
Shawn A 85d7f2a549 esp32 fix event cb to std::bind, adds async preload
esp32 does not have scan cb, must use event system and oncomplete to get scan count
2018-08-27 12:17:37 -05:00
Shawn A 16c37e5389 remove npt example, not esp32 compat 2018-08-27 12:16:14 -05:00
tablatronix b963e7f95a fix esp32 fatal, disabled async 2018-08-25 14:55:51 -05:00
tablatronix 1bf3fc04ea fixes #707 2018-08-24 13:37:15 -05:00
tablatronix 4f5e21647f fix res error 2018-08-24 13:02:34 -05:00
tablatronix f2bbb5f4e2 comments 2018-08-24 12:21:20 -05:00
tablatronix 34b7d1ea03 scan preload async
This changes the preload wifiscan to async and adds async support for wifi scans. preload async occursd on cp stsart and root loads(throttled)
2018-08-24 12:19:26 -05:00
tablatronix 28cf8eed16 adding async scannetworks 2018-08-23 16:46:17 -05:00
tablatronix 51432d0ef7 remove tests from example 2018-08-23 15:04:31 -05:00
tablatronix c651ab4b62 cleanup 2018-08-23 13:46:13 -05:00
tablatronix 3123eac5c8 typo 2018-08-23 13:36:08 -05:00
tablatronix 8f03b5df10 testing sta ap modes 2018-08-23 13:35:07 -05:00
tablatronix 2911bb33ee status debug 2018-08-23 13:04:18 -05:00
tablatronix 2074d85da7 cleanconnect 2018-08-23 12:54:48 -05:00
tablatronix 593eda9b87 oops again 2018-08-23 12:16:01 -05:00
tablatronix 3579733f5c refix #702 2018-08-23 12:09:46 -05:00
tablatronix 6d4c971b49 test for #702 2018-08-23 11:55:31 -05:00
tablatronix 1b8ce61522 well shit 2018-08-17 19:38:53 -05:00
tablatronix f1a1f44a08 #700 2018-08-15 19:11:53 -05:00
tablatronix 915023ccb9 fixes #619 unconfirmed needed 2018-08-10 13:49:15 -05:00
tablatronix 792ed84f4b debugging 2018-08-10 11:51:31 -05:00
tablatronix 5ee1ae78c0 fix callback order 2018-08-10 11:45:25 -05:00
tablatronix 4cceb95a42 debugging 2018-08-10 11:42:09 -05:00
tablatronix c6027058c9 added some debugging and testing 2018-08-09 15:21:12 -05:00
david gauchard 493a73c205 Merge branch 'master' of https://github.com/tzapu/WiFiManager into loop 2018-08-08 23:04:30 +02:00
tablatronix e9c4cdb2c6 disable setvalue on customhtml params 2018-08-07 14:06:31 -05:00
tablatronix 768a965810 remove custom ip from example 2018-08-07 13:57:10 -05:00
tablatronix c6ecad1b3a fixes #678 2018-08-07 13:55:45 -05:00
tablatronix 5a5f1c631b fix warning 2018-08-07 13:55:14 -05:00
tablatronix 573f8113ef fixes #691 2018-08-07 12:48:00 -05:00
tablatronix 440f312575 v 0.14 2018-08-05 11:06:15 -05:00
tablatronix dd7a686181 Merge branch 'hotfixes' 2018-08-05 11:05:56 -05:00
tablatronix 6a139688f3 ver .13 2018-08-05 11:03:39 -05:00
tablatronix b855c0a440 updating library managers 2018-08-05 10:48:23 -05:00
dontsovcmc 02de95c529 issuu #644 add utf-8 charset to head 2018-08-04 20:29:55 +03:00
Shawn A e18bc49a2a Wrong case 2018-07-23 07:06:22 -05:00
tablatronix 704a7ae393 hotfix WPS NO_EXTRA_4K_HEAP 2018-07-22 10:47:33 -05:00
tablatronix 2c41af00f5 fixes #671 2018-07-22 10:41:50 -05:00
Shawn A afbad01ee1 dev test sketch 2018-07-20 16:32:43 -05:00
Shawn A cba606b846 password invalid better error msg 2018-07-20 16:23:38 -05:00
Shawn A 8d5e9e3977 esp32 autoconnect is deprecated
https://github.com/espressif/esp-idf/issues/1960
2018-07-20 16:16:08 -05:00
Shawn A 24de319c7e issues with captive portals and preloadscan hammering 2018-07-19 16:54:38 -05:00
Shawn A ad623cb586 oops 2018-07-19 16:03:14 -05:00
Shawn A f2f0aabe3e dark theme tweaks 2018-07-19 14:02:02 -05:00
Shawn A 37cdda33c7 adds setClass(invert) black theme
adds class string to body, invert(black) is built in
` wm.setClass("invert");`
2018-07-19 13:10:37 -05:00
Shawn A c9ca210803 removing US default 2018-07-19 11:33:38 -05:00
Shawn A 2db93d28c7 clean up 2018-07-19 10:05:25 -05:00
Shawn A d140ccff84 adds setCountry, default US
accepts US JP CN, codes must be added to strings and WiFiSetCountry atm
2018-07-19 10:02:53 -05:00
Shawn A a51298ea54 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-07-19 08:40:48 -05:00
Shawn A f1fd553ac6 fix autoreconnect, forgot we use event for other stuff 2018-07-19 08:40:46 -05:00
Shawn A caa32c4bc2 Merge pull request #666 from 0x1abin/path-1
compat MacOS newline
2018-07-19 07:30:58 -05:00
0x1abin 0e6ed38986 compat macos newline 2018-07-19 14:36:18 +08:00
tablatronix a39b96be9c disable autoreconect esp32 2018-07-18 16:25:53 -05:00
tablatronix 713bf957c3 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-07-18 14:01:48 -05:00
tablatronix 74ceba7409 add non blocking example 2018-07-18 14:01:45 -05:00
Shawn A 08bb2322aa Oops 2018-07-16 17:07:31 -05:00
Shawn A 9ab4deaf5b clean up param length
Just changing to not modify argument, spacing
2018-07-16 08:06:03 -05:00
Shawn A 36ad6f80c4 Merge pull request #660 from liebman/do_param_save
Fix crasahes in doParamSave() &  WiFiManagerParameter::setValue
2018-07-16 07:55:39 -05:00
Christopher Liebman 2fac07cbf0 WiFiManagerParameter::setValue used length of default value for i
allocation and not passed length. Changed to use passed length or
length of default value if > passed length.
2018-07-15 14:39:11 -07:00
Christopher Liebman 85dd747949 Use hasParam() instead of checking server.arg() for NULL, it returns a String anyway.
Don't use .c_str() when its being assigned to a String anyway
2018-07-15 10:44:06 -07:00
Shawn A 32495668d8 Update ISSUE_TEMPLATE.md 2018-07-14 16:46:07 -05:00
tablatronix fc84e7a260 trying to fix param issues when param is out of scope
Ideally this should be done entirely different so params can follow wm scope and object lifetime..
2018-07-13 23:52:36 -05:00
tablatronix 933f86720a param was using user length for strncpy, causing overflows 2018-07-13 23:43:07 -05:00
tablatronix abbc110656 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-07-13 18:41:16 -05:00
tablatronix 17f2316ea8 fixes #655 2018-07-13 18:41:14 -05:00
tablatronix 24d317b9da fix #655 2018-07-13 18:27:50 -05:00
Shawn A 40d522d8b6 Merge pull request #649 from vincentVDB/patch-1
Update AutoConnectWithFSParameters.ino
2018-07-09 20:37:52 -05:00
vincentVDB 0f2ba754e2 Update AutoConnectWithFSParameters.ino
Close file !
2018-07-10 02:11:06 +02:00
Shawn A f65972aa55 Merge pull request #647 from liebman/fix_bad_progmem_access
fix bad progmem access
2018-07-08 11:02:49 -05:00
Chris Liebman e235a45d5a value is PROGMEM too.... 2018-07-08 08:32:41 -07:00
Christopher Liebman aeba5478ee fix bad progmem access introduced in https://github.com/tzapu/WiFiManager/pull/608 2018-07-08 07:14:11 -07:00
tablatronix b9f6b472a7 #645 comments 2018-07-07 09:45:24 -05:00
Shawn A b9fcc8fe22 Merge pull request #645 from liebman/only_support_wps_if_no_extra_4k_heap_defined
disable wps by default, enable if its enabled in core
2018-07-07 09:37:28 -05:00
Christopher Liebman 5a06f29c5b In https://github.com/esp8266/Arduino/pull/4889 the core was modified to
disable WPS by default.  Its only enabled if NO_EXTRA_4K_HEAP is defined.
To enable you must re-run the board manager with --noextra4kheap.
This addes #ifdef NO_EXTRA_4K_HEAP arround WPS usage so it won't generate
compiler errors.
2018-07-07 06:26:36 -07:00
tablatronix 4fdefaf67d example work 2018-07-02 10:10:09 -05:00
tablatronix 3a9d70f581 fix example 2018-06-30 13:42:33 -05:00
tablatronix 906a9d89cb advanced example testing 2018-06-29 16:52:20 -05:00
Shawn A c0187a60e1 fix esp32 usermode 2018-06-28 12:54:49 -05:00
Shawn A 0ab6f57239 fix esp32 resetsettings 2018-06-28 12:53:48 -05:00
Shawn A 9917f619b3 reworking examples 2018-06-28 12:53:36 -05:00
Shawn A 8f2791f908 fix esp32 fatal 2018-06-28 11:53:48 -05:00
Shawn A 6d92ae5a1f fixup examples 2018-06-28 11:52:50 -05:00
Shawn A 8d7da2fd8b FIx esp32 updates
Webserver now builtin to esp32 lib, esp32 persistent still not implemented properly, fixes erase again, fixes save again
2018-06-27 16:19:12 -05:00
Shawn A 94115006f6 Merge pull request #571 from liebman/remove_esp32_skiping_examples
enable all example builds for esp32
2018-06-19 12:51:05 -05:00
Shawn A 00b14d5d1c Merge pull request #608 from ohadcn/patch-1
add CORS headers
2018-06-19 12:46:45 -05:00
Shawn A bff3d75f91 Merge pull request #584 from cmarrin/development
Changed setAPCallback and setSaveConfigCallback to take std::function…
2018-06-19 11:35:18 -05:00
Shawn A e3d91a03ff add esp32 persistent test support
persistent support was added via a PR, but not very well, it is buggy.
2018-06-18 15:28:32 -05:00
Shawn A b3e19041ff fix esp32 erase w persistent 2018-06-18 15:27:47 -05:00
Shawn A 10088c71f3 Move all wifi functions out of constructor
Cannot use wifi in constructor on esp32, as it is not available yet,
2018-06-18 15:27:18 -05:00
Shawn A 01a5646317 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-06-18 11:40:05 -05:00
Shawn A 5066b86102 fix esp32 new bugs
esp32 only uses persistent on wifiLowLevelInit
        if(!persistent){
          esp_wifi_set_storage(WIFI_STORAGE_RAM);
        }
which only gets applied during certain functions, namely changing modes, or turning on wifi
2018-06-18 11:40:01 -05:00
Norbert f1e657e2b8 Fixed Waiting for connection result with time out issue 2018-06-04 13:51:29 +02:00
ohad 7f6039a6b7 Merge pull request #1 from ohadcn/patch-2
add CORS headers
2018-05-14 11:50:31 +03:00
ohad 24a25fc687 add CORS headers
this will allow external portal on the network to send credentials via browser.
2018-05-14 11:47:26 +03:00
ohad 128214a159 add CORS headers
this will allow external portal on the network to send credentials via browser.
2018-05-14 11:47:13 +03:00
tablatronix 718a8c8f4c fixing up setmenu docblocks 2018-04-26 20:46:00 -05:00
tablatronix 3c8af53440 comments, debugging 2018-04-25 11:12:12 -05:00
tablatronix 042640924f fix menu output
removed test menu output, removed ref , not sure why I put that there....
2018-04-19 19:01:50 -05:00
sidey79 428c9fcbd5 Updated for ESP32 - compile only tested 2018-04-13 21:51:36 +02:00
sidey79 9e265b44b5 Merge remote-tracking branch 'remotes/origin/development' into dev-ota-updater 2018-04-13 20:53:46 +02:00
sidey79 fe17307e09 Updated include for ota update lib for esp32 2018-04-11 22:11:44 +02:00
sidey79 3fafb3304a HTML Pages and generation for OAT Update adapted to current version of lib
Debug output corrected at some point
2018-04-10 23:07:56 +02:00
tablatronix f8ae461bfd fix savetimeout, too short, made optional 2018-04-09 19:48:31 -05:00
tablatronix d27fa7df61 hotfixing #425
this is a hotfix, there are numerous issues with this, development branch already addressed all of them.
2018-04-09 19:16:12 -05:00
sidey79 16bc717ceb Include Update.h for ESP32 2018-04-09 23:44:27 +02:00
sidey79 8065a1eaa4 Added OTA updater option from esp8266. Code is manly taken from KoljaWindeler but modified in some pieces to fit current library version 2018-04-09 23:08:43 +02:00
Chris Marrin 174bb615e6 Changed setAPCallback and setSaveConfigCallback to take std::function params
This allows Predicates and Lambdas to be passed. Still allows bare function pointers
so this patch is fully backward compatible. Tested on WiFiManager examples for
backward compatibility and on my own project (OfficeClock) for handling lambdas with
captured variables
2018-04-07 09:13:48 -07:00
Shawn A 82309e7a84 comment 2018-04-05 12:38:34 -05:00
Shawn A b682d8996b Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-04-05 12:34:56 -05:00
Shawn A c5b3637350 fixes #581
adds htmlentities to ssid outputs, limited replacements for now
2018-04-05 12:34:27 -05:00
Shawn A 5b3ac4236e fix some error logging 2018-04-05 12:29:42 -05:00
Shawn A 87c2eb42b6 fixup scnanetworks 2018-04-05 12:29:11 -05:00
Shawn A 10f17d0472 workaround for esp32 webserver parsearguments bug 2018-04-05 12:19:46 -05:00
tablatronix 7ec3b99020 clean up defines, removed stuff for memory 2018-03-31 12:42:06 -05:00
tablatronix 49104d4bbb adds chip revision efuse
not sure what use this is, as getChipRevision is usually the same anyway... shrug
2018-03-31 12:41:47 -05:00
Shawn A 41b29fa08c fix erroneous error debug 2018-03-28 09:38:07 -05:00
Shawn A ef70b49e98 fix nvs erase 2018-03-28 08:27:57 -05:00
Shawn A 4a6631511b fix handleerase add softapconfig catch fail 2018-03-28 08:23:04 -05:00
Shawn A a7b992450f Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-03-28 08:14:10 -05:00
Shawn A 10db048d61 getmodestr, handleerase(bool) 2018-03-28 08:13:53 -05:00
Shawn A 3ae0b40ad9 Merge pull request #575 from liebman/allow_disable_portal
allow automatic config portal to be disabled
2018-03-28 08:10:45 -05:00
Christopher Liebman 7495fe2999 add setEnableConfigPortal(boolean enable) - if false dont open condig portal from autoConnect() 2018-03-24 18:29:30 -07:00
Shawn A c9a7112cbb fix parenths #573 2018-03-21 13:46:53 -05:00
Shawn A 32ccac5936 ugh remove test example 2018-03-21 13:32:50 -05:00
Shawn A 32d6f11217 fixes #573 2018-03-21 13:30:53 -05:00
Christopher Liebman 13cd054c15 Merge branch 'master' into remove_esp32_skiping_examples 2018-03-21 10:31:55 -07:00
Shawn A c2cbe3015b refactor connectwifi, adds save timeout
wifi save now no longer uses settimeout timeout
2018-03-21 12:18:00 -05:00
Christopher Liebman 4e71d53c54 Merge branch 'development' into remove_esp32_skiping_examples 2018-03-21 09:13:16 -07:00
Shawn A 02c531a247 spiffs case 2018-03-21 11:05:05 -05:00
Christopher Liebman 6270630d1a enable all example builds for esp32 2018-03-21 07:18:31 -07:00
Shawn A 7279333a17 fix fsparam spiffs examples for esp32 2018-03-21 08:02:15 -05:00
Shawn A 6319955cdc Merge pull request #570 from liebman/fix_travis
Fix travis builds, add esp32 builds
2018-03-20 17:36:34 -05:00
Christopher Liebman 14cd0d563a Merge branch 'development' into fix_travis 2018-03-20 15:36:01 -07:00
Shawn A fd3f5bbb2d Delete OnDemandConfigPortal.ino.cpp
Sigh
2018-03-20 17:30:12 -05:00
Christopher Liebman 9e3061201e Merge branch 'development' into fix_travis 2018-03-20 15:19:40 -07:00
Christopher Liebman 208ae5c7ea Merge branch 'development' into fix_travis 2018-03-20 14:51:41 -07:00
Chris Liebman 56d3e6d737 make travis build again 2018-03-20 13:47:28 -07:00
Chris Liebman 5eea21afa9 add esp32 2018-03-20 13:17:09 -07:00
Chris Liebman e4605775a2 add esp32 2018-03-20 13:09:01 -07:00
Chris Liebman 9e5c1b5fe2 add esp32 2018-03-20 12:55:44 -07:00
Chris Liebman 3891c0a631 add esp32 2018-03-20 12:48:41 -07:00
Chris Liebman fe8f38aa59 add esp32 2018-03-20 12:07:35 -07:00
Shawn A 851a38e7fa ugh 2018-03-20 13:27:50 -05:00
Shawn A 7f6bd107e6 fix debug levels 2018-03-20 13:22:43 -05:00
Chris Liebman 28ed839274 add esp32 2018-03-20 11:16:58 -07:00
Chris Liebman c358378a27 add esp32 2018-03-20 11:16:49 -07:00
Shawn A d090dd3dd7 move menutokens 2018-03-20 13:14:50 -05:00
Chris Liebman 10d6deadc2 add esp32 2018-03-20 10:51:55 -07:00
Chris Liebman 19d578e04b add esp32 2018-03-20 10:43:22 -07:00
Shawn A 881f50fb7e fix compiler warnings 2018-03-20 12:35:01 -05:00
Shawn A 57fc15a20a fix section compile error 2018-03-20 12:31:49 -05:00
Shawn A 941865ec85 datatype fixes 2018-03-20 12:24:28 -05:00
Chris Liebman 6f84964894 fixing travis 2018-03-20 10:16:08 -07:00
Shawn A 88d2cfbff4 change varnames 2018-03-20 12:05:46 -05:00
Chris Liebman 839a421ff1 travis testing 2018-03-20 10:03:54 -07:00
Shawn A 7a57a1395d change setmenu to take vector or array of strnig tokens 2018-03-20 12:00:59 -05:00
Chris Liebman 31d53b18be travis testing 2018-03-20 09:58:34 -07:00
Shawn A 8d4f745abf Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-03-19 12:47:57 -05:00
Shawn A e970686064 fix debug blank 2018-03-19 12:47:56 -05:00
David Gauchard 159674bbba allow user loop while in AP mode 2018-03-17 19:05:11 +01:00
tablatronix 7ad6470adf oops 2018-03-17 10:45:48 -05:00
tablatronix de85162267 add bug workaround for esp8266 softap 2018-03-17 10:11:03 -05:00
tablatronix 8ddc86f470 adds handleClose 2018-03-17 10:10:46 -05:00
Shawn A c9e82ae920 menuids as vector to deal with size
This kind of makes it a pain in the ass for users, not sure how to make this easier, I can take in an array of string ids, with a count arg, makes it easier, but then users can pass nonsense in, this way its enum ids, but damn it sure is convoluted. Welcome to ideas here...

```c++
  std::vector<WiFiManager::menu_page_t> menu = {wm.MENU_WIFI,wm.MENU_INFO,wm.MENU_PARAM,wm.MENU_CLOSE,wm.MENU_SEP,wm.MENU_ERASE,wm.MENU_EXIT};
  wm.setMenu(menu);
```
2018-03-16 15:55:53 -05:00
Shawn A 0741dbde2e debug remove 2018-03-16 14:19:16 -05:00
Shawn A e3b7dc2641 kludge setmenu with size so it works
Prboably going to add a vector for this, I do not want to add the overhead of std::array for something optional
2018-03-16 14:18:48 -05:00
Shawn A d07f73263a showinfoerase toggle 2018-03-16 14:17:58 -05:00
Shawn A f60a1d1b06 adds section hrs 2018-03-16 10:56:28 -05:00
Shawn A 424f48f0a8 add setShowDnsFields, adds edge case force hide ip fields 2018-03-16 10:56:12 -05:00
Shawn A 03a40915ee minor layout fix to config 2018-03-15 16:34:37 -05:00
Shawn A b7d230cc40 remove testing 2018-03-15 16:15:38 -05:00
Shawn A 8cbd0fa54e oops 2018-03-15 16:08:48 -05:00
Shawn A 0749e1bdd7 Update README.md 2018-03-15 16:05:02 -05:00
Shawn A 655db109c1 comments 2018-03-15 15:51:47 -05:00
Shawn A 109dfa5c58 Merge pull request #561 from tzapu/pr560
Added Custom DNS, fix newlines
2018-03-15 15:41:07 -05:00
Shawn A 3cc1fabae7 fix tabs 2018-03-15 15:40:34 -05:00
Deb 81045e6433 Added Custom DNS, fix newlines 2018-03-15 15:29:34 -05:00
Shawn A 84752d8027 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-03-15 13:50:18 -05:00
Shawn A 36840fc712 add WM_RTC def for rtc.h 2018-03-15 13:50:17 -05:00
Shawn A 3378a4a846 Update README.md 2018-03-15 10:37:59 -05:00
Shawn A 21f1016d89 add esp shields 2018-03-15 10:36:26 -05:00
Shawn A 4f86945d7e Update ISSUE_TEMPLATE.md 2018-03-15 07:44:26 -05:00
Shawn A 278c320e22 added debug levels 2018-03-14 17:00:46 -05:00
Shawn A 29edaed0e7 fixes #555 oops 2018-03-14 12:59:51 -05:00
Shawn A 32e51ea37b notes 2018-03-14 12:52:50 -05:00
Shawn A 9346cee76c fix autoreconnect on auth failure 2018-03-14 10:46:08 -05:00
Shawn A 19d6101a1b fix up connection result for ondemand portal 2018-03-14 10:45:50 -05:00
Shawn A 68201cd965 remove serial.prints 2018-03-14 10:06:44 -05:00
tablatronix 1fade32d66 disable ssid input autoformatting
autocorrect='off' autocapitalize='none'
2018-03-08 22:36:14 -06:00
Shawn A 158dac1e68 fixes #551 2018-03-08 14:06:39 -06:00
Shawn A 721bb417bf remove debug 2018-03-07 15:41:47 -06:00
Shawn A 0c5e005866 fix customhtml parameters 2018-03-07 15:40:21 -06:00
Shawn A 0a1bd9f934 init params as null
I started gettting odd exceptions, so I thought this should be null and not on the stack or pointing to garbage. I might be totally in the wrong here.
2018-03-07 13:59:50 -06:00
Shawn A 5e487d6edc remove preallocation of params memory 2018-03-06 16:42:54 -06:00
Shawn A 1f9a13a42e oops fix constructor again 2018-03-06 16:14:13 -06:00
Shawn A 3796af5930 move routes to strings 2018-03-06 16:07:29 -06:00
Shawn A 8af108262c fix constructor 2018-03-06 16:07:18 -06:00
tablatronix b63e8b575b fixup #548 2018-03-05 22:01:47 -06:00
tablatronix a17fabd7fe Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-03-05 20:12:49 -06:00
tablatronix 5a34002d5d fix savecallback #543 2018-03-05 20:12:47 -06:00
Shawn A 6295d128aa adds opt erase flag 2018-03-05 16:35:26 -06:00
Shawn A 724447a654 oops 2018-03-05 16:26:59 -06:00
Shawn A 9f6cc23beb adds nvs erase
// #define WM_ERASE_NVS // esp32 erase() will erase NVS
2018-03-05 16:17:49 -06:00
Shawn A 6e1b2ed32c remove dnsserver from readme 2018-03-05 14:04:41 -06:00
Shawn A 8a17ef9c03 add debugging 2018-03-05 14:03:33 -06:00
Shawn A 3de9a34e3b Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-03-05 12:58:33 -06:00
Shawn A 4db3eca51e adds erase 2018-03-05 12:58:30 -06:00
tablatronix ca5609d8e6 oops #546 2018-03-03 10:42:25 -06:00
tablatronix 53df6ac612 #546 fix?
Since I do not know how to fix the delegated constructors properly, this should fix the issue for now
2018-03-03 10:33:04 -06:00
Shawn A 108af72d5f Update ISSUE_TEMPLATE.md 2018-03-02 12:42:20 -06:00
Shawn A 5ae132a7e9 #542 handler 2018-03-01 13:19:40 -06:00
Shawn A 5a6a365f0a Update CONTRIBUTING.md 2018-02-26 22:11:43 -06:00
Shawn A 92debb4bf8 comments 2018-02-24 10:45:58 -06:00
Shawn A ea9134afd2 fix webserver pointer 2018-02-24 09:13:20 -06:00
Shawn A bce3607504 add preloadscan enable 2018-02-24 08:54:40 -06:00
Shawn A 051966c856 fix order 2018-02-24 08:41:25 -06:00
Shawn A d0ed01433d add wifiscan preloading with cache
This uses core scan object and assumes its lifetime, I am not sure what the scope is or how long it lives, will have to convert to local copy if its being lost, caching for 60s after startweb portal and 10s after root load, refresh bypasses cache
2018-02-24 08:40:01 -06:00
Shawn A 7b4fd38b6b fix menuids 2018-02-24 07:51:07 -06:00
Shawn A 58d23513a1 comments 2018-02-23 23:57:12 -06:00
Shawn A 39da3e6d6c simplify debug 2018-02-23 23:49:23 -06:00
Shawn A 6749122eed change defs 2018-02-23 23:44:36 -06:00
Shawn A f210000c94 adds mdns support 2018-02-23 23:28:19 -06:00
Shawn A 327db84d18 fix resetsettings 2018-02-23 13:14:55 -06:00
Shawn A ff636abea8 fix menu and param save 2018-02-23 12:38:34 -06:00
Shawn A 951b39b088 fix param crash 2018-02-23 11:19:19 -06:00
Shawn A 6ba4a2523c fix up menus 2018-02-23 10:02:09 -06:00
Shawn A dfd48c2c81 add param help 2018-02-22 13:04:55 -06:00
Shawn A 3eb8d39565 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-02-22 08:54:17 -06:00
Shawn A ae95ca2c7b fix template 2018-02-22 08:54:12 -06:00
Shawn A edbaf5acdd finish up menu customization 2018-02-21 20:52:24 -06:00
Shawn A 7c4963fac2 fix bug 2018-02-21 20:12:54 -06:00
Shawn A c2bdbfafb9 adding menu control, in progress 2018-02-21 17:11:57 -06:00
Shawn A 4e57d74e87 fix some minor warnings 2018-02-21 10:52:55 -06:00
Shawn A 5e27194204 Merge branch 'master' into development 2018-02-21 08:41:22 -06:00
Shawn A b516085a3d Merge pull request #536 from d-a-v/warn
remove warning
2018-02-21 08:35:22 -06:00
David Gauchard f333f271e4 remove warning 2018-02-21 12:10:19 +01:00
Shawn A 35bf4a94bd change webserver pointer to using 2018-02-20 12:59:37 -06:00
Shawn A e01101eff1 #534 2018-02-20 11:54:14 -06:00
Shawn A 39f20a6adc #528 WL_DISCONNECTED support for testing 2018-02-20 11:13:46 -06:00
Shawn A 3d7074166c #528
using a static var for esp32 event for now to get this working and test. Probably not the best, not sure what the best option is here for esp32 onevent static member function callbacks
2018-02-20 08:49:54 -06:00
Shawn A 415f98d9fb debuggin esp32 auth fail events 2018-02-19 21:32:17 -06:00
Shawn A e5edf536a5 template update 2018-02-19 14:03:52 -06:00
Shawn A f9a8f5bdab allow empty ssids, bail earlier 2018-02-19 13:32:12 -06:00
Shawn A 64075bc7f9 feature #533 failure details 2018-02-19 13:31:43 -06:00
Shawn A 9eec7f97dd change some uneeded ints 2018-02-19 10:46:55 -06:00
Shawn A 0c6d4df7a7 remove debugging 2018-02-19 10:33:19 -06:00
Shawn A aaad9ca4c3 add result checking #527 2018-02-19 10:32:34 -06:00
Shawn A 7a5a72eed4 remove debugging 2018-02-19 10:12:25 -06:00
Shawn A 89cfdfc67f clean up 2018-02-19 10:04:40 -06:00
Shawn A 374e9f515f stability #527 2018-02-19 09:52:52 -06:00
Shawn A 9d16a68665 doc blocks, reformatting code 2018-02-19 08:37:12 -06:00
Shawn A ea994d5ccd adds getWiFiIsSaved() 2018-02-19 08:21:22 -06:00
Shawn A 97398d7ce2 fix #527 for esp8266 2018-02-18 20:23:04 -06:00
Shawn A 9f4156437b fixes #527 2018-02-18 20:15:55 -06:00
Shawn A cb7cbec1f8 testing #527 2018-02-18 12:27:20 -06:00
Shawn A f3db838ae1 fix info page and adds esp32 aphostname 2018-02-18 10:39:35 -06:00
Shawn A 1d6a7275e7 gitignore
no gitignore? add more stuff
2018-02-18 10:24:03 -06:00
Shawn A 1ee8f5a1a9 #528 adds getLastConxResult 2018-02-18 09:43:52 -06:00
Shawn A 076a355098 Merge pull request #515 from horendus/patch-1
Move more strings to FLASH to free up RAM
2018-02-15 18:15:28 -06:00
Shawn A 14c5169ac9 bugged 2018-02-15 16:59:16 -06:00
Shawn A b09cc31416 oops broke lock icons 2018-02-15 13:11:36 -06:00
Shawn A 41b4717148 more strings progmem 2018-02-15 12:23:20 -06:00
Shawn A d8d26b26c2 change wifiscan detaisl to css for toggling 2018-02-15 10:44:19 -06:00
Shawn A 98c78a2929 documenting source 2018-02-15 09:57:51 -06:00
Shawn A d86351dff4 Update ISSUE_TEMPLATE.md 2018-02-15 09:04:21 -06:00
Shawn A e9cf051cb2 Update ISSUE_TEMPLATE.md 2018-02-15 09:03:50 -06:00
Shawn A 08ae001a83 missed one file header 2018-02-15 08:37:14 -06:00
Shawn A b49849f8c0 file headers 2018-02-15 08:36:21 -06:00
Shawn A 603f2b5631 Merge pull request #490 from tzapu/esp32
Esp32 preliminary support
2018-02-15 08:06:47 -06:00
Shawn A 55b336e6d8 Merge branch 'development' into esp32 2018-02-15 07:49:24 -06:00
Shawn A 625c8e2f9e Merge branch 'esp32' of https://github.com/tzapu/WiFiManager into esp32 2018-02-15 07:48:15 -06:00
Shawn A 26ba373009 move authmode to progmem 2018-02-15 07:48:13 -06:00
Shawn A 8c1e070582 strings 2018-02-14 23:14:01 -06:00
Shawn A 3e66273c3e esp32 strings progmem 2018-02-14 23:08:59 -06:00
Shawn A 9da297f405 moved _wifissidprefix to progmem 2018-02-14 23:03:14 -06:00
Shawn A 18cb6af0e4 dup define 2018-02-14 22:43:55 -06:00
Shawn A a6dc373f5c typo 2018-02-14 22:41:06 -06:00
Shawn A 25b880cf9b comments 2018-02-14 22:39:56 -06:00
Shawn A 5730ce351a left in debug 2018-02-14 22:36:36 -06:00
Shawn A 62f5ce6e0c more string cleanup 2018-02-14 16:42:10 -06:00
Shawn A 91383f9bc1 refix memsketch 2018-02-14 16:03:09 -06:00
Shawn A ca3a726e88 Merge branch 'development' into esp32
Merge branch 'development' into esp32

# Conflicts:
#	WiFiManager.cpp
#	WiFiManager.h
#	strings_en.h
2018-02-14 15:55:29 -06:00
Shawn A 43a035091e more strings cleanup 2018-02-14 14:11:19 -06:00
Shawn A d98a59cca3 editing strings 2018-02-14 14:09:55 -06:00
Shawn A a247a5ecb4 fix sketch size 2018-02-14 14:09:39 -06:00
Shawn A c43551f85a some more strings in progmem 2018-02-14 13:24:00 -06:00
Shawn A cbb32fdd61 cleanup 2018-02-14 12:53:52 -06:00
Shawn A bc4c07f315 defaulting to icons 2018-02-14 12:50:05 -06:00
Shawn A 369b627b3b oops 2018-02-14 12:43:30 -06:00
Shawn A 089c487576 adds toggle for scan quality as percentage
`setScanDispPerc` until we have decent remplating
2018-02-14 12:42:21 -06:00
Shawn A ba3a2c8451 moved all tokens to strings.h 2018-02-14 12:41:38 -06:00
Shawn A 8e7663b52b ugh aliases 2018-02-14 11:13:28 -06:00
Shawn A 78f7de38ad publicized debug helpers 2018-02-14 10:54:04 -06:00
Shawn A 3d3518a10a adds disconnect method for users
non persistent disconnect
2018-02-14 10:50:57 -06:00
Shawn A e342fd9b71 refactor ip form outputs 2018-02-14 10:33:28 -06:00
Shawn A addb045a0c moved strings to flash 2018-02-14 09:36:09 -06:00
Shawn A bab1201dcb fix esp32 esp8266 bug 2018-02-13 11:40:19 -06:00
Shawn A 611246bd75 rename 2018-02-13 07:55:41 -06:00
Shawn A 3dcf3c0927 rename 2018-02-13 07:55:32 -06:00
Shawn A 7f2fdee9c8 Create ISSUE_TEMPLATE.md 2018-02-13 07:42:23 -06:00
Shawn A 1c890c0c49 Create contributing.md 2018-02-13 07:40:55 -06:00
Jasper 5243036dbf Update WiFiManager.cpp 2018-02-13 20:00:17 +08:00
Jasper a94d897ee4 Update WiFiManager.cpp 2018-02-13 19:52:38 +08:00
Jasper aa734eb606 Update WiFiManager.cpp 2018-02-13 17:18:26 +08:00
Jasper a863167b23 Lower RAM usage of library
Place remaining debug messages into Flash using F().
2018-02-13 11:16:37 +08:00
Shawn A 79eb0fee47 Merge branch 'development' of https://github.com/tzapu/WiFiManager into development 2018-02-12 19:23:52 -06:00
Shawn A 3e10f984e1 template 2018-02-12 19:23:51 -06:00
Shawn A 17410d38c2 readme 2018-02-12 13:46:03 -06:00
Shawn A 1f7dc79b20 added webserver precompiler warning
updates readme
2018-02-12 13:03:13 -06:00
Shawn A 95b48454e8 Merge branch 'development' into esp32 2018-02-12 12:31:31 -06:00
Shawn A 4424e66222 infohelp align html 2018-02-12 12:31:16 -06:00
Shawn A 75d007d1c8 Merge branch 'development' into esp32 2018-02-12 11:05:12 -06:00
Shawn A 46929e0ee6 change uptime 2018-02-12 10:59:50 -06:00
Shawn A 8e28011f13 fix some html bugs 2018-02-12 10:57:59 -06:00
Shawn A 617e52cb84 implemented info strings for esp32 2018-02-12 10:54:51 -06:00
Shawn A 2c735ab999 Merge branch 'development' into esp32
Merge branch 'development' into esp32

# Conflicts:
#	README.md
#	WiFiManager.cpp
#	WiFiManager.h
#	examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
2018-02-12 08:47:28 -06:00
Shawn A fc4942db6e all tokens now in strings 2018-02-09 12:35:43 -06:00
Shawn A 3914fee227 converting token strings, in progress broken 2018-02-08 17:05:35 -06:00
Shawn A ffc85a81fe remove reset, no reason for it 2018-02-08 13:18:08 -06:00
Shawn A 1c4011bfb4 adds webclient checking for timeout delay 2018-02-08 12:31:31 -06:00
Shawn A 57ef33a7fc readme 2018-02-08 11:00:54 -06:00
Shawn A 9a76b3d94d camelcase _staShowStaticFields 2018-02-08 09:36:50 -06:00
Shawn A 0af804a2f1 Merge branch 'master' into esp32 2018-02-07 10:13:11 -06:00
Shawn A 4d715890f6 Update README.md
Esp32 warning
2018-02-06 19:16:41 -06:00
Shawn A f5fa886c93 Merge branch 'master' into development 2018-02-06 11:28:51 -06:00
Shawn A e49335d811 Merge pull request #505 from Loufylouf/master
Bug fix for problem discovered when setting length to 1 for additiona…
2018-02-06 11:25:27 -06:00
Shawn A 8e07025e38 fix esp32 wifi.ssid 2018-02-06 10:19:52 -06:00
Shawn A 7cc86e57be fix esp32 examples 2018-02-06 09:50:33 -06:00
Shawn A b22686c8a1 make debug funcs public 2018-02-06 09:50:03 -06:00
Shawn A 2b9ddea331 debugsoftapconfig for esp32 2018-02-06 09:49:49 -06:00
Laurent Louf 6aaa83a266 Bug fix for problem discovered when setting length to 1 for additional parameters
The initialization of the buffer holding the value stopped before the last character and storage did not take into account the extra-byte for end of string.
2018-02-06 14:12:13 +01:00
Shawn A b1b34a3c97 ajax test 2018-02-02 14:38:40 -06:00
Shawn A 44c85a2315 fixup merge 2018-02-01 13:16:26 -06:00
Shawn A da66231e47 Merge branch 'development' into esp32 2018-02-01 11:45:20 -06:00
Shawn A 2e08e7de32 #454 adds WIFI_MANAGER_OVERRIDE_STRINGS
I dont feel like resolving conflicts
2018-02-01 10:05:39 -06:00
Shawn A ebdfa063a7 Merge branch 'master' into development 2018-02-01 09:41:42 -06:00
Shawn A a3a04f1f9a Merge pull request #487 from mtiutiu/master
make WIFI_MANAGER_MAX_PARAMS customizable
2018-02-01 09:40:40 -06:00
Shawn A cfb0d2bc5f doh... 2018-02-01 08:51:08 -06:00
Shawn A e8d1ea17cb fix paramscount, oops 2018-02-01 08:04:34 -06:00
Shawn A 0d5ebde9af more string tokens 2018-01-31 16:44:58 -06:00
Shawn A 6894c89441 moved all html strings out of code 2018-01-31 16:37:53 -06:00
Shawn A b0c61688d6 cleanup 2018-01-31 14:07:38 -06:00
Shawn A 68762e1741 typo 2018-01-31 14:03:33 -06:00
Shawn A a21f8cbc39 moved http strings to include, added token flags 2018-01-31 13:54:54 -06:00
Shawn A 19d533b7d5 adds exit to readme 2018-01-31 13:07:34 -06:00
Shawn A ccfddefaa1 oops 2018-01-31 12:57:49 -06:00
Shawn A 95253e834d Merge branch 'master' into development 2018-01-31 12:50:24 -06:00
Shawn A 53a27f154e Merge pull request #467 from lukepalmer/master
Document that parameter id cannot contain spaces
2018-01-31 12:50:04 -06:00
Shawn A 53c8addfdc debugging clean 2018-01-31 12:48:11 -06:00
Shawn A e5c263c414 fixes paramid issues
paramid must be alphanumeric and adds {I} token support to use ids as input names if we make that optional.
2018-01-31 12:23:25 -06:00
Shawn A e015efe8d0 fixup debugging 2018-01-31 09:30:46 -06:00
Shawn A 5f78d38f46 fix up parameters 2018-01-31 09:30:37 -06:00
Shawn A fa04972cb1 fix tabs 2018-01-30 14:07:21 -06:00
Shawn A 8697cab0ae clean up .h file 2018-01-30 14:02:01 -06:00
Shawn A c8d89db529 oops 2018-01-30 14:00:39 -06:00
Shawn A ff973e1639 clean up parameters 2018-01-30 13:47:13 -06:00
Shawn A d61d9a67b1 Merge branch 'master' into development
conflicts resolved
2018-01-30 13:31:47 -06:00
Shawn A a4795b77f7 Merge pull request #374 from liebman/allocate-params-array
use malloc/free for WiFiManagerParameter* array instead of hard coding.
2018-01-30 12:29:30 -06:00
Shawn A 46a9431475 Merge branch 'master' into development 2018-01-30 12:10:13 -06:00
Shawn A a832af02ca Merge pull request #468 from liebman/param-value-memory-leak
WiFiManagerParameter allocates but never frees __value!
2018-01-30 12:08:31 -06:00
Shawn A d4540f1197 update library.properties 2018-01-29 14:09:18 -06:00
Shawn A d1639e228a update library.json
I thnk think this is correct
2018-01-29 14:05:59 -06:00
Shawn A fdfaecce8a Fix examples 2018-01-29 13:13:14 -06:00
Shawn A 380a63d519 attempt resetsettings fix 2018-01-29 11:36:10 -06:00
Shawn A 7e1455778d adds esp debugplatforminfo 2018-01-28 09:58:52 -06:00
Shawn A 00fb96aa29 Merge branch 'development' into esp32 2018-01-28 09:57:44 -06:00
Shawn A 7fb35a9540 adds debug platform info 2018-01-28 09:57:20 -06:00
Shawn A cb02e72123 fix esp8366 bug 2018-01-27 14:31:28 -06:00
Shawn A 85317530e8 fix esp8266 bug WEBSERVERSHIM 2018-01-27 14:28:07 -06:00
Shawn A e55741f201 Merge branch 'development' into esp32 2018-01-27 11:45:49 -06:00
Shawn A 8595ea5d2c oops 2018-01-27 11:45:38 -06:00
Shawn A 9a3f501a24 Merge branch 'development' into esp32 2018-01-27 11:42:02 -06:00
Shawn A 3b6d5f790a replace esp.reset with restart 2018-01-27 11:41:42 -06:00
Shawn A dbb091d1b7 fix info page 2018-01-27 11:40:05 -06:00
Shawn A 867eb4e689 oops 2018-01-27 08:49:55 -06:00
Shawn A 42cd1aeb8d fix for erase config when STA disabled 2018-01-27 08:31:17 -06:00
Shawn A a3678c6c22 millis typo 2018-01-27 08:19:54 -06:00
Shawn A 0fb86c3d8c fix deprecated warnings 2018-01-25 21:22:02 -06:00
Shawn A 4db69a3790 rework def WEBSERVERSHIM
testing libraries with esp8266 name or webserver
2018-01-25 16:05:55 -06:00
Shawn A 2761656d78 change wifi_ssid ret to string, fix info 2018-01-25 13:58:39 -06:00
Shawn A e56d22cfb1 fix esp32 enablesta toggle 2018-01-25 13:47:00 -06:00
Shawn A c13c076b46 quiet timeout logging 2018-01-25 13:09:19 -06:00
Shawn A f820dc78be fix esp32 SSID tokens 2018-01-25 13:08:56 -06:00
Shawn A af507d798e add bbx10 to authors 2018-01-25 12:48:09 -06:00
Shawn A a52740ecff fix esp32 erase flash 2018-01-24 21:24:21 -06:00
Shawn A 1f691ae35c typo 2018-01-24 17:08:24 -06:00
Shawn A 65c06c6e2b esp32 auto ssid 2018-01-24 16:09:30 -06:00
Shawn A 3777fcc846 esp32 about page 2018-01-24 16:09:17 -06:00
Shawn A de2deb8e69 oops 2018-01-24 15:24:05 -06:00
Shawn A 7189e36c59 clean up defines, remove esp31b 2018-01-24 13:54:58 -06:00
Shawn A 8dbe045655 remove system_event_info_t arg 2018-01-24 13:36:34 -06:00
Shawn A ead2b7353c enable autoreconnect 2018-01-24 13:16:06 -06:00
Shawn A ceaf53f604 adds esp32 autoreconnector
Using static event cb for now, feel free to improve, this functionality should be fixed in core soon
2018-01-24 13:13:25 -06:00
Shawn A e5879b2101 fix esp32 autoconnect 2018-01-24 11:05:28 -06:00
Shawn A 2a50d797a0 fix esp32 softap numclients 2018-01-24 08:50:24 -06:00
Shawn A 2af1c62bd1 redo esp32 disconnect 2018-01-24 08:27:56 -06:00
Shawn A f3be7c7c0b it compiles 2018-01-23 14:07:33 -06:00
Shawn A 90024b8603 adding def blocks, nonworking
adding conditionals for all module types, there has been requests for other module support in addition to esp32, so I ma just gonna go ahead and avoid else fallbacks for now. Not working yet.
2018-01-23 13:28:49 -06:00
Shawn A d883ce8ae1 Merge pull request #489 from tablatronix/development
added some esp abstraction to make ports easier
2018-01-23 11:41:34 -06:00
Shawn A 8364a6a85d added some esp abstraction to make ports easier 2018-01-23 11:39:12 -06:00
Tiutiu Marius Cristian 8c906af563 make WIFI_MANAGER_MAX_PARAMS customizable 2018-01-22 12:42:23 +02:00
Shawn A 5aafb89a3f Merge pull request #313 from tablatronix/development
Development and cleanup
2018-01-17 10:54:37 -06:00
Shawn A b266cd5934 fix open tag on info 2018-01-10 10:52:36 -06:00
Shawn A 1a61362f74 typo 2018-01-10 10:05:07 -06:00
Shawn A 7625680daf adds test of setCaptivePortalEnable to example 2018-01-10 10:04:26 -06:00
Shawn A d7976381e6 fix setCaptivePortalEnable 2018-01-10 10:02:46 -06:00
Christopher Liebman 5c6252fe45 should use delete[] not delete 2017-12-09 08:37:35 -08:00
Christopher Liebman a5ff5cb9e4 Add WiFiManagerParameter destructor to free new'd _value, it was allocated but never free'd 2017-12-09 06:24:15 -08:00
Christopher Liebman d66cd47df8 use realloc() when increasing the size of _params. addParameter() now returns bool
indicating the status of adding the parameter where false indicates it failed to
increase the size of _params and did not add the parameter.
2017-12-09 06:04:07 -08:00
Luke Palmer eb560629d6 Document parameters 2017-12-04 19:54:59 -05:00
Shawn A 0897c5800c update examples w setConfigPortalTimeout 2017-11-28 17:01:27 -06:00
Shawn A 648274ab3d oops left wrap test in 2017-11-21 12:51:43 -06:00
Shawn A 2f4015e797 fix token replace invalid html 2017-11-21 12:24:25 -06:00
Shawn A a702fa6c75 html validation fizes 2017-11-21 11:53:30 -06:00
Shawn A 9a571226cd Added some info panel changes
adds connect info to root info and wifi, minimal wordyness
2017-11-16 14:06:36 -06:00
Shawn A fa05d2c574 fix for configportal on wifisave fail
disocnnect STA on save failures
move reset out of configportal loop
2017-11-16 11:59:22 -06:00
Shawn A 0ae9ca3d55 adds _debugport stream ref
pass stream reference via constructor to use for _debugPort in DEBUG_WM, if someone needs dynamic we can add pointer setter, but seems overkill
2017-11-16 10:02:03 -06:00
Shawn A d6aec20bc3 add debug 2 argument function 2017-11-15 16:14:52 -06:00
Shawn A 3fdf53bf06 adding debug for configportalhastimeout 2017-11-15 11:41:47 -06:00
Shawn A a1050d014f fix some returns 2017-11-03 16:41:17 -05:00
Shawn A 52d5427654 testing erase config polyfill
this is getting rediculous, dev on 2_3_0 has to stop there are so many bugs.
2017-11-01 06:39:30 -05:00
Shawn A e8c0b52470 added ease, stabilize persistent modes, rename some functions 2017-10-28 21:38:13 -05:00
Shawn A 4763783fe1 rename some functions 2017-10-28 11:51:26 -05:00
Shawn A ad6b8bdc86 add local enableSTA for toggling 2017-10-27 20:01:19 -05:00
Shawn A d09aff2f6d fixing some reliability issues, testing 2017-10-27 17:19:43 -05:00
Chris Liebman 0b6341bea4 cleanup readme (removed hint about alternate constructor) 2017-10-26 16:10:34 -07:00
Chris Liebman 6465d72f6e Refactored to use only a default constructor and automatically resize the parameter array each time the size limit is reached.
I used the initial size (WIFI_MANAGER_MAX_PARAMS) as the increment when resizing.
Existing data is coppied to the new array and the old one is free'd.
2017-10-26 15:23:47 -07:00
Chris Liebman 33704176e0 Merge remote-tracking branch 'upstream/master' into allocate-params-array 2017-10-25 18:59:23 -07:00
Shawn A df5857464a adds verbose connection status enum strings 2017-10-18 11:00:02 -05:00
Shawn A eb434a0187 clean up handlexit feature 2017-10-18 09:37:21 -05:00
Shawn A d7e3c8d005 Merge pull request #5 from mrbig/development
uninitialized abort caused immediate exit
2017-10-18 09:02:01 -05:00
Shawn A 3d2453acc5 html for exit 2017-10-18 08:59:35 -05:00
Nagy Attila Gabor 342eacfe37 autoConnect did not return true on successfull connection
This seems like a simple typo to me
2017-10-17 00:20:19 +02:00
Nagy Attila Gabor cf51018512 uninitialized abort caused immediate exit
In some cases this caused the config portal to exit right after
start
2017-10-16 23:16:03 +02:00
Shawn A db2a1336e9 adds exit functionality to shutdown configportal/webportal 2017-09-25 14:11:36 -05:00
Shawn A b151c19b3c add ondemandwebportal example 2017-09-18 12:58:31 -05:00
Shawn A 2aef1344b4 use ip as title if not in captiveportal 2017-09-18 10:19:38 -05:00
Shawn A 4592914fad test ondemand webportal 2017-09-18 08:42:09 -05:00
Shawn A 8e710b9d92 disable ios safari tel links
some numbers might auto link as telephone numbers, this disables it.
2017-09-16 11:07:57 -05:00
Shawn A eee3fb72b2 #418 even more info 2017-09-16 11:02:37 -05:00
Shawn A 12de39135d comments 2017-09-16 10:46:44 -05:00
Shawn A 80470fb553 addd token precheck flags
This helps skip token replacements that are not even used, replace is slow, this is an optimization mostly for large sets of params or aps.
2017-09-16 10:39:51 -05:00
Shawn A 31ab2b67d0 ability to disable captiveportal
Sometimes the redirect to captive portal is unwanted or a nuisance, eg wehn using as a webserver etc.
2017-09-14 17:09:17 -05:00
Shawn A 4d18bfb113 abstracted outputters 2017-09-14 16:34:16 -05:00
Shawn A 37dbd667f4 add staticfield setter 2017-09-14 15:38:42 -05:00
Shawn A e43a7d0b75 modify templates, remove placeholders
adds labels to all inputs, deprecates {p} placeholders, adds {t} to ttitles
2017-09-14 15:38:12 -05:00
Shawn A c6f7ac0012 added uptime to info
still subject to rollover
2017-09-14 10:26:51 -05:00
Shawn A 64798ebbf1 pimped out info pagee
We can simply this later, or make an option string to display specific things
2017-09-10 21:17:07 -05:00
Shawn A 985f8118dd style lists /info 2017-09-08 22:28:13 -05:00
Shawn A 69ddda0ee4 Merge remote-tracking branch 'remotes/tzapu/development' into tzapu/development
removed autoconnect params, still testing valeus are always empty
2017-09-08 17:08:18 -05:00
Shawn A f59c150729 Merge pull request #365 from vyruz1986/master
Allow showing static IP config without predefined value
2017-09-08 16:19:15 -05:00
Shawn A 14ce25081a Merge remote-tracking branch 'remotes/tzapu/development' into tzapu/development 2017-09-08 16:15:20 -05:00
Shawn A 81b37dfffc adds some style, clean up css, adds new tokens
#415
2017-09-08 16:08:35 -05:00
Shawn A 1f4a8fe499 Merge pull request #251 from ayomawdb/development
Adding WiFiManagerParameter implementation with labelPlacement parameter
2017-09-08 15:54:46 -05:00
Germán Martín 7b9804d5a2 Merge branch 'master' into resetConfigCallback 2017-09-04 21:05:49 +02:00
Shawn A a93b601cd7 again 2017-08-31 13:57:23 -05:00
Shawn A 6525a0bd3d fixed comment wording 2017-08-31 13:57:11 -05:00
Shawn A 2c357d7e86 changing non form back to GET
for now #409
2017-08-31 10:21:21 -05:00
Shawn A 5f28843843 Cleaned some html csss 2017-08-30 14:01:37 -05:00
Shawn A 6e43c1eb41 change all forms to POST
#409
2017-08-30 10:24:04 -05:00
Shawn A 66c653ff94 convert to post 2017-08-30 10:00:48 -05:00
Shawn A 606a1c3128 removed escaped quotes 2017-08-30 10:00:29 -05:00
Shawn A 63dd714805 oops missed one pr#244 2017-08-30 09:22:40 -05:00
Shawn A 9160b5bd3b maxlength null string fix
pr#244
2017-08-30 09:15:36 -05:00
Shawn A 04a9dda74b testing mode and persistent presrvation
You should be able to have sta+softap mode with your own softap, and starting config portal will not overwrite your default softap, but i cannot find a way to reconnect other than rebooting the device
2017-08-29 16:31:59 -05:00
Shawn A d1ab6ec6db left in debug 2017-08-28 21:00:15 -05:00
Shawn A b62f488b6b Merge remote-tracking branch 'origin/feature-icons' into development
adds feature icons
2017-08-28 19:18:20 -05:00
Shawn A 8185eaa002 add blocking setter
@todo add example
2017-08-27 11:04:05 -05:00
Shawn A 8592647cbf fraking tabs 2017-08-27 10:57:43 -05:00
Shawn A f2580463e4 fix const char corruptions
#400
 fixing non blocking, non blocking does not handle timeouts for the user
2017-08-27 10:55:26 -05:00
Shawn A c4563802f3 renable blocking 2017-08-27 09:32:31 -05:00
Shawn A 68e3eb5bc8 Merge branch 'master' into development 2017-08-27 09:13:00 -05:00
Shawn A cadf6b4a80 Merge remote-tracking branch 'upstream/master' 2017-08-27 09:05:52 -05:00
Shawn A 75f34d9b59 Merge remote-tracking branch 'tzapu/master' 2017-08-27 08:48:35 -05:00
Shawn A 47d9082e18 testing non blocking portal
calling process in loop not fast enough results in corrupt webpages, not sure why.
2017-08-27 00:11:04 -05:00
Shawn A 0aecffc822 fix configportal loop flow
removed returns for better flow
2017-08-26 23:26:48 -05:00
Shawn A 179c0309a5 comments, autoconnect fix
fix sta+ap mode preservaton in autoconnect
2017-08-26 23:13:37 -05:00
tzapu 89af31245b Merge pull request #398 from Derek123456/Derek123456-patch-1
Fix for issue https://github.com/tzapu/WiFiManager/issues/392
closes #392
thank you very much
2017-08-22 10:12:29 +03:00
Derek123456 68e32a10c0 Update WiFiManager.cpp
https://github.com/tzapu/WiFiManager/issues/392
Increased size of parLength to 5 so the custom parameter length variable can be up to 9999 long.
2017-08-22 10:32:52 +08:00
Derek123456 cee18a7ce3 Update WiFiManager.h
Changed <input ... length={l}>to <input ... maxlength={l}>
2017-08-22 10:30:53 +08:00
tzapu f9c4c87c61 Merge pull request #386 from denisvm/readme-wishlist
Improve wishlist in README
2017-07-13 09:39:40 +03:00
tzapu 06d75bf7b1 Update README.md 2017-07-13 09:39:28 +03:00
Dênis Volpato Martins 9637d9473e Improve wishlist in README 2017-07-12 22:07:33 -03:00
tzapu 0de9d12930 Merge pull request #363 from suculent/fix-content-length
fix for #362 - Setting Content-length explicitly - https://github.com…
2017-07-10 13:41:07 +03:00
tzapu eb4594c8e4 Merge pull request #383 from scop/spelling
Spelling fixes
thanks
2017-07-10 09:38:21 +03:00
Ville Skyttä 58eb7113e7 Spelling fixes 2017-07-09 17:11:31 +03:00
Chris Liebman 898768092c removed un-needed constructor declaration 2017-06-27 16:35:48 -07:00
Chris Liebman c4905c23b7 remove init function as its not needed with one constructor 2017-06-27 16:27:37 -07:00
Chris Liebman 3950a3b859 use single constructor with default value for size 2017-06-27 16:24:23 -07:00
Germán Martín 8f90e0f5d7 Add a callback when reset settings is triggered 2017-06-26 15:04:57 +02:00
vyruz1986 0fc051a445 Merge remote-tracking branch 'refs/remotes/tzapu/master' 2017-06-12 21:21:10 +02:00
tzapu 5e9248651f Merge pull request #334 from camelmasa/fix-broken-links
Fix broken link
2017-06-06 16:04:16 +03:00
Chris Liebman 362a561a35 use malloc/free for WiFiManagerParameter* array instead of hard coding.
add alternate constructor to specifiy max parameter count
origional default constructor uses old hard codded value
2017-06-04 06:41:27 -07:00
Alex Goris 136c0c9cba Also show static IP fields when static IP is passed
Regardless of the boolean, we should always show static IP fields if
actual static IP value is passed. This ensures backwards compatibility
2017-05-04 22:04:05 +02:00
Alex Goris 486ea7db2c Allow showing static IP config without predefined value
Previously a valid predefined static IP had to be passed before the
config page would show the IP, gateway and subnet fields. This did not
allow the config page to show 'optional' static IP fields.
Now a boolean can be passed to the autoConnect() function which will
specify whether the static IP fields should be shown or not.
When this boolean is true but no predefined values are passed and fields
are left blank in config page, wifiManager will revert to DHCP. This
allows user to choose between static IP or DHCP without changing code
2017-05-04 21:59:17 +02:00
Matěj Sychra ada93b721a fix for #362 - Setting Content-length explicitly - https://github.com/tzapu/WiFiManager/issues/362 2017-05-03 14:56:31 +02:00
camelmasa 29b2f02ae4 Fix broken links 2017-03-20 12:58:49 +09:00
Shawn A 004f222f40 do not wait for conx is no ssid 2017-02-10 17:05:07 -06:00
Shawn A 612e18be35 oops deleted a function 2017-02-10 15:40:31 -06:00
Shawn A 0b0eb6159c moving blocks 2017-02-10 15:29:32 -06:00
Shawn A 1a44dd53e6 move apcallback to proper location
This was actually being called before the ap was setup!
2017-02-10 15:21:48 -06:00
Shawn A 65349cb546 fix WL_IDLE_STATUS return values for compatibility
This might need better handling in future, since we only get back a bool
of wether or not we are connected, not if configportal was saved etc.
might be a problem.
2017-02-10 15:13:48 -06:00
Shawn A e9b36f9084 fix breakafterconfig 2017-02-10 15:05:45 -06:00
Shawn A bd9c3b31fb refactoring some larger functions
* broke large functions into smaller , to allow new features to be
hooked in easier
* added persistent test to constructor destructor
* testing turn off sta during portal , causes issues
2017-02-10 14:07:52 -06:00
Shawn A c819d46902 allow for empty password 2017-02-09 17:10:15 -06:00
Shawn A 2edd37eeb8 oops typo 2017-02-09 17:02:33 -06:00
Shawn A 45a325bd34 fix validippassword
abstracted ap password validation
passing a invalid password should be fatal , not fallback to null, but
could be an optional define
2017-02-09 16:57:34 -06:00
Shawn A 9c72bf98f7 cleaning up source, comments 2017-02-09 16:33:10 -06:00
Alex T 628307dbf7 Merge branch 'master' into development 2017-02-09 15:56:51 +02:00
Shawn A c8455f5cd0 Merge remote-tracking branch 'refs/remotes/tzapu/master' 2017-02-08 12:05:04 -06:00
Shawn A 7360be5f60 Merge remote-tracking branch 'refs/remotes/origin/feature_308_configportaltimeouts' 2017-02-08 12:03:32 -06:00
tzapu 3135bc5e89 Merge pull request #310 from tablatronix/feature_308_configportaltimeouts
Feature 308 configportaltimeouts
fixes #308 
thank you very much
2017-02-08 08:55:15 -08:00
Shawn A c810633ee3 reset configportal timeouts after ap disconnect
configportaltimeout now starts at configportalstart if no sta clients,
or after last client disconnects. Will never timeout if ap has sta
client! handle edge case in user code.
2017-02-08 10:34:41 -06:00
Shawn A 0ddb835072 feature #308
only timeout when ap has no client, do not timeout configportal when
user is connected.
2017-02-08 08:18:59 -06:00
Shawn A a8c13a7c96 Merge remote-tracking branch 'refs/remotes/tzapu/master' 2017-02-08 08:07:01 -06:00
Alex T 7a17c98828 Merge branch 'master' into development 2017-02-03 06:17:42 +02:00
tzapu 8ffb4cbfa9 Merge pull request #284 from robertoostenveld/master
use setAPStaticIPConfig instead  of (old?) setAPConfig in first example
2017-02-02 02:57:55 -08:00
tzapu 0cc4487e42 Merge pull request #297 from jorgecis/patch-1
Quotes are missing creating issues.
2017-02-02 02:57:16 -08:00
tzapu b696b2c29a Merge pull request #286 from vyruz1986/master
Don't add custom parameters if array size is exceeded
2017-02-02 02:56:56 -08:00
Jorge Cisneros bd0da6c7a6 Quotes are missing creating issues. 2017-01-16 22:48:09 -06:00
Alex Goris 1f500fddd1 Don't add custom parameters if array size is exceeded
array containing custom parameters is initialised at class
initialization time with a fixed value. When we later try to add more
parameters than the array allows we will now discard the offending
parameters and make a debug logging so the developer knows what's going
on.

Might be further improved as per this answer on StackOverflow:
http://stackoverflow.com/a/12271501
This would allow the array size to be specified at initialisation time,
and would give flexibility to the developer to decide how big the array
should be.

closes tzapu/WiFiManager#285
2017-01-08 23:31:53 +01:00
Robert Oostenveld a231ae5deb use setAPStaticIPConfig instead of (old?) setAPConfig in first example 2017-01-07 22:10:00 +01:00
Ayoma Wijethunga 5f8f1ce5e6 Adding WiFiManagerParameter implementation with labelPlacement parameter 2016-11-26 20:17:41 +05:30
tzapu 022b15d2c8 Merge pull request #250 from ivankravets/patch-5
Update platforms compatibility
Thank you very much
2016-11-22 12:51:52 +02:00
Ivan Kravets 2a0ac55f87 Update platforms compatibility 2016-11-22 12:50:55 +02:00
Alex T abedb61ca1 parameter label 2016-10-15 12:07:48 +03:00
tzapu fd15f986d3 Merge pull request #210 from TaaraLabs/patch-1
startConfigPortal() without any parameters

thank you very much
2016-10-15 08:04:13 +03:00
Alex T 60c22d672f Merge commit 'e0b8acb8dd8e419e378e71abed77fe926c2e5b54' 2016-09-08 13:08:09 +03:00
Alex T 1b261f2371 intial html template parser 2016-09-08 13:07:51 +03:00
TaaraLabs 31887ff36a startConfigPortal() without parameters 2016-08-06 12:45:22 +03:00
TaaraLabs c3d01d33e1 startConfigPortal() without any parameters
startConfigPortal() without any parameters uses auto generated name ESP + ChipID
2016-08-06 12:38:26 +03:00
tzapu e0b8acb8dd Merge pull request #188 from bakrus/patch-1
Fix to allow 5 digit 'mqtt_port'
2016-07-02 15:25:29 +03:00
bakrus 039702327e Fix to allow 5 digit 'mqtt_port'
'WiFiManagerParameter custom_mqtt_port' made consistent with declaration of 'mqtt_port'
2016-07-02 13:27:59 +02:00
Alex T fac1575c96 attempt codecov 2016-06-15 14:35:43 +03:00
tzapu 560d4113f9 Merge pull request #168 from gitgrimbo/staticip-example-improved-comments
Improve comments for AutoConnectWithStaticIP example
thank you very much
2016-05-24 08:32:28 +03:00
gitgrimbo c93cd80f58 Improve comments for AutoConnectWithStaticIP example 2016-05-11 08:21:23 +01:00
Alex T 04d47882a7 ver bump 2016-05-08 11:25:03 +03:00
Alex T 028bdeeb17 removed 204 header response https://github.com/tzapu/WiFiManager/issues/114 2016-05-08 10:14:11 +03:00
Alex T 44e828e77a reverted std::sort that caused problems with isnan and other none namespeced used function calls 2016-05-08 10:07:32 +03:00
Alex T 801ae82ef5 removed extraneous headers 2016-05-08 09:41:06 +03:00
Alex T a209509d98 0.11 readme and ver bump 2016-04-05 09:28:13 +03:00
Shawn A 74bccc04f7 adds better retina support
adds template and layer png master
2016-03-25 14:17:28 -05:00
Shawn A fd27cef1ae remove debug 2016-03-25 09:31:07 -05:00
Shawn A 6708ddf37b remove debug 2016-03-25 08:48:49 -05:00
Shawn A 83c271fed4 initial commit, signal meter and secure icons
Adds sprite based icons, added some accessibility support since this
uses background images.

Can use classes `left` or `right` on parent div to align on either side
of SSID, parent div `invert` css filters the icons to white.

base64 image string has been formatted for easy replacement
2016-03-25 08:19:47 -05:00
Shawn A 8a375ec340 Merge remote-tracking branch 'refs/remotes/tzapu/master' 2016-03-18 14:47:57 -05:00
Alex T f99156e29f added setter for removing duplicate APs 2016-03-16 20:42:47 +02:00
tzapu 413b76cd81 Merge pull request #124 from tablatronix/remove-duplicate-aps
Remove duplicate aps
2016-03-16 20:35:05 +02:00
Alex T d11c763bce update travis yml
another ci test

ci fix

ci attempt 6

stable package json

fixe prefs

fix lib folder

debug

alalalalaalal

try with 1.6.5

try with 1.6.7

verbose build

1.6.7 again

back to 1.6.5

escaped : in url

no save pref

no save pref, one line

and back to working 1.6.5

getting all examples built

added sh include

fix sh

added build

build examples

aded debug output

going insane

beautify

added lib ArduinoJson

try again

1.6.8

get arduino json from github

back to 1.6.5
2016-03-16 18:30:29 +02:00
Alex Tudorache f9cc4b641f added boards manager 2016-03-16 10:43:10 +02:00
Alex Tudorache 852d90beec travis ci 2016-03-16 10:21:53 +02:00
Shawn A 745c3a91fd typo, shrug 2016-03-09 16:13:16 -06:00
Shawn A 276795079e add remove duplicate ap feature fixes #26 2016-03-09 16:03:51 -06:00
Shawn A faf307c7bb Merge remote-tracking branch 'refs/remotes/tzapu/master' 2016-03-09 11:03:50 -06:00
Alex Tudorache 566bcbe063 attempt to fix not connecting issues and endless loops 2016-03-08 07:46:06 +02:00
Alex Tudorache b99487785d fix for auto connect racing issue 2016-03-05 17:47:12 +02:00
Alex Tudorache 0962d718ec Merge commit 'e6217a18fc694b0cd176177d69c500156c3dbacf'
# Conflicts:
#	WiFiManager.h
2016-03-05 17:42:33 +02:00
Alex Tudorache 7f11a5d144 added custom head element, like style/css 2016-03-04 15:01:12 +02:00
Alex Tudorache e6217a18fc added custom head element, like style/css 2016-03-04 15:00:49 +02:00
Alex Tudorache ae007befd0 Merge commit '33a5e5b3cb81e960e10d7ae8d4b3a2940d38660b' 2016-03-04 09:12:39 +02:00
Alex Tudorache 43d8d94dd2 Merge branch 'tablatronix-tablatronix-patch-jumptoform' 2016-03-03 13:46:33 +02:00
Alex Tudorache 53733447ae Merge branch 'tablatronix-patch-jumptoform' of git://github.com/tablatronix/WiFiManager into tablatronix-tablatronix-patch-jumptoform 2016-03-03 13:44:47 +02:00
Alex Tudorache 6f727ff2df new sort 2016-03-02 16:39:03 +02:00
Alex Tudorache 3660ccdda5 updated readme 2016-03-01 15:32:21 +02:00
Shawn A f775d9c22c changing to just #p for now 2016-02-26 16:42:00 -06:00
Shawn A 99031ce133 Jump to form for password entry
If you have a long list of APs, the password field gets focuses on click, but this happens below the fold, this jumps to the form so you can see it. Added id to form instead of jumping to the #p field because it makes the input too close to the top of page, a well known issue of anchor links.
2016-02-26 16:02:35 -06:00
Shawn A b306a5ca72 Merge pull request #2 from tzapu/master
merge in
2016-02-26 15:57:36 -06:00
Pablo Sanchez 33a5e5b3cb Added an option to the WiFiManagerParameter so that a parameter can be read-only. This is done in a way that does not break an existing
program by having a constructor for either way. If a "1" is added to the end of the parameter list then the field becomes readonly.
The HTML will add the "readonly" option.
2016-02-18 23:29:00 -05:00
Alex Tudorache 2582dd8735 version 0.10
ordered networks based on signal quality
2016-02-16 18:24:12 +02:00
Alex Tudorache f82141c98c changed styling 2016-02-16 14:46:18 +02:00
Alex Tudorache 9cde9a8170 added a new version of wait for connect result
added setConnectTimeout
renamed setTimeout to setConfigPortalTimeout
2016-02-16 11:17:34 +02:00
Alex Tudorache 3f617c7455 fixed all pages so they don t return unknown content length, much faster now 2016-02-14 15:46:01 +02:00
Alex Tudorache 6f0c16d74f added flash chip real size to info page 2016-02-14 15:04:20 +02:00
Alex Tudorache 7b23c89204 fixed library manager name 2016-02-09 08:58:35 +02:00
Alex Tudorache 55c751c133 removed some warnings 2016-02-07 12:51:32 +02:00
Alex Tudorache 0f75d745fe 0.9 fixed encoding problems 2016-02-04 14:38:48 +02:00
Alex Tudorache ba1aa5496d added more examples,
updated readme
made it compile on older versions
2016-02-01 12:34:29 +02:00
Alex Tudorache 6217ef8e6a bump ver 2016-01-29 08:48:27 +02:00
Alex Tudorache 6e65f39895 added rescan option
added reset option
added info page
precomposed page for A LOT faster page sending
2016-01-25 10:51:25 +02:00
Alex Tudorache 031b7c97bc added ability of returning even if connection fails
added example that resets after configuration if connection is unsuccessful
2016-01-25 09:25:51 +02:00
Alex Tudorache bdc7da660a updated examples 2016-01-24 14:46:20 +02:00
Alex Tudorache f33cb4fb32 added feedback through LED blink example 2016-01-23 11:35:27 +02:00
Alex Tudorache c1038ea371 fixed check for gateway and subnet 2016-01-22 10:28:31 +02:00
tzapu 7b7a94bb51 Merge pull request #76 from ivankravets/patch-4
Update library.json
2016-01-19 17:25:45 +02:00
tzapu f840442549 Merge pull request #77 from ivankravets/patch-3
Delete typo file
2016-01-19 17:25:28 +02:00
Ivan Kravets 1208e03e61 Update library.json 2016-01-19 17:19:49 +02:00
Ivan Kravets 62c621f783 Delete typo file
Sorry, it was my typo. The file should be named as `library.json`
2016-01-19 17:19:27 +02:00
tzapu f83a482fb3 Merge pull request #74 from ivankravets/patch-1
@PlatformIO Library Registry manifest file
hi guys, 
thanks for this, need to get on the bandwagon 
:d
cheers
alex
2016-01-19 17:12:57 +02:00
Ivan Kravets 5691eb1604 @PlatformIO Library Registry manifest file
* This library in Web Registry: http://platformio.org/#!/lib/show/566/WifiManager
* Specification: [library.json](http://docs.platformio.org/en/latest/librarymanager/config.html)
* Library Manager:  http://docs.platformio.org/en/latest/librarymanager/index.html
2016-01-19 16:19:58 +02:00
tzapu 3eaa24b15a Merge pull request #73 from joagyl/patch-1
Fixed typo in  library.json

thank you.

need to get on platform io myself, so many good things i ve heard about it.

could you tell me how you go about using the lib with platform io without submitting it to them?
2016-01-19 15:36:03 +02:00
Joakim G e71b985c0d Fixed typo in library.json
Added missing comma that made the JSON invalid. Noticed this while trying to use the lib in platformio.
2016-01-19 13:51:48 +01:00
Alex Tudorache 823767cb8b char array would cut off strings that were too small in size 2016-01-18 16:34:25 +02:00
Alex Tudorache 0b06e465ce updated example due to memory issues
added more readme
2016-01-18 15:33:45 +02:00
Alex Tudorache 478d291bd2 more readme 2016-01-18 11:37:00 +02:00
Alex Tudorache 13fa4ffa3a added example on how to save static ip to FS config.json
added static ip to config portal, if set
2016-01-18 11:20:15 +02:00
Alex Tudorache e2bbd527d1 added static mode
thanks @jonathanendersby
renamed private variables for more clarity
readme update
2016-01-17 13:27:24 +02:00
Jonathan Endersby 598baf4451 Adding Static IP Support 2016-01-17 07:40:26 +02:00
Alex Tudorache b4e688a543 changed template
fix for web server returning empty pages in latest github
2016-01-14 20:29:58 +02:00
Alex Tudorache 217faa43a3 0.6 release
updated readme
2016-01-13 11:48:52 +02:00
Alex Tudorache f84d973236 change icon and fonts
thanks @markaswift
2016-01-12 23:12:04 +02:00
Alex Tudorache 1351245d09 added signal quality filter 2016-01-11 13:06:12 +02:00
Alex Tudorache 17dd3a4689 merge @riccibitti pull request
on demand better example
thanks
2016-01-11 10:57:40 +02:00
tzapu dfbb819e59 Merge pull request #54 from joe-average/master
Do not show clear text password in form input field
Thank you @joe-average
2016-01-11 09:04:15 +02:00
tzapu ab4f334723 Merge pull request #55 from franklinvv/master
perfect :D
thank you
2016-01-11 08:52:38 +02:00
Franklin van Velthuizen c77e9cbcc9 To show the config portal SSID in the callback, a global reference to the WiFiManager object was needed. To solve this, a pointer to the WiFiManager object is now passed to the callback. The feedback example is edited accordingly. 2016-01-10 00:28:39 +01:00
joe-average 93a7d280f1 Do not show clear text password in form input field 2016-01-09 23:17:58 +01:00
Alberto Ricci Bitti 5587532f01 Manually reverted to current tzapu/master after messing with git commits 2016-01-09 20:11:04 +01:00
Alberto Ricci Bitti 1150a76035 Merge commit '90bac5d5803dec56b53dbb396acf0fb94cfac591'
Conflicts:
	examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
2016-01-09 19:41:49 +01:00
Alberto Ricci Bitti 3a79c6eb99 Merge commit '0780115c7bd861cb8565d40ef1d1e254fe934f28' 2016-01-09 19:08:18 +01:00
Alberto Ricci Bitti 9111febd19 Merge commit '1db01f08e6c3cd627ea5decab31c687dee10c6e6' 2016-01-09 19:07:29 +01:00
Alberto Ricci Bitti 687dc20f3e Changed to make it work on ESP-01 boards
(on ESP-01 pin cannot be checked at setup as its only available pins, gpio0 and gpio2, are shared with the bootloader)
- moved triggering of configuration portal into Arduino's loop() function
- changed pin from 4 to 0 (and made it  #define-able)
2016-01-09 18:52:42 +01:00
Alex Tudorache ec40e32c3f cleanup and get said name as per https://github.com/tzapu/WiFiManager/pull/52
added example of above
2016-01-09 18:54:42 +02:00
Alberto Ricci Bitti 7137082e74 Removed redundant #include 2016-01-09 17:50:09 +01:00
Alex Tudorache 90bac5d580 on demand example fixed 2016-01-09 18:28:23 +02:00
Franklin van Velthuizen 0780115c7b Renamed getConfigurationSSID() to getConfigPortalSSID() 2016-01-09 01:24:48 +01:00
Franklin van Velthuizen 1db01f08e6 Added method getConfigurationSSID(), so the config portal SSID that is created by the ESP8266 can be used in the callback (e.g. for output to a screen) 2016-01-09 01:17:16 +01:00
Alex Tudorache b05dff34b7 added example for on demand config portal
cleanup
2016-01-08 21:04:37 +02:00
Alex Tudorache 0bef4467b3 cleanup
moved ap creation logic to new function so it can be called on demand
implemented changes and suggestions from @riccibitti , thanks

Merge branch 'master' of https://github.com/riccibitti/WiFiManager

# Conflicts:
#	WiFiManager.cpp
#	WiFiManager.h
2016-01-08 18:42:27 +02:00
Alex Tudorache 53489e9c3d resolved conflicts with other libraries that might have used DEBUG_PRINT
thanks @SebiPanther
2016-01-08 13:18:23 +02:00
tzapu 92fe78f213 Merge pull request #51 from tzapu/dev
custom parameters thanks to @rpseng
2016-01-08 12:55:43 +02:00
Alex Tudorache 83177e9c55 a bit of cleanup
removed write on every connect of parameters, now it only writes parameters to FS if config portal is started and connection is successful
2016-01-08 12:51:10 +02:00
Alex Tudorache ab5902e273 added html template to repo 2016-01-08 11:44:50 +02:00
SebiPanther 5dfb2e9ad6 Fixed incompatibilities with DHT Library from https://github.com/adafruit/DHT-sensor-library 2016-01-07 22:18:28 +01:00
Alex Tudorache e0548dc4b4 modified custom parameters feature so user can provide their own storage mechanism
added FS json storage of parameters example
2016-01-07 17:52:29 +02:00
tzapu be2a9737ae Merge pull request #48 from rpseng/master
allow custom parameters by @rpseng 
thank you
2016-01-06 09:56:31 +02:00
Rafael de Pelegrini Soares 2bd9e7dd99 missing load parameters 2016-01-05 23:38:12 -02:00
Rafael de Pelegrini Soares f29d63018c Added support for additional parameters 2016-01-05 23:31:10 -02:00
Rafael de Pelegrini Soares c1d8249b10 Added support for additional parameters 2016-01-05 23:28:56 -02:00
Alex Tudorache 311c80d475 added Boards Manager instructions 2016-01-05 08:28:02 +02:00
Alberto Ricci Bitti 0c04092300 Merge commit '99f37db88ec59cf1b6738f500a8cfeda920b9da7' 2016-01-04 18:31:03 +01:00
Alex Tudorache 99f37db88e Merge branch 'master' of https://github.com/tzapu/WiFiManager 2016-01-04 16:48:33 +02:00
Alex Tudorache 2ad6d0897c changed category
fixed keywords
2016-01-04 16:48:17 +02:00
Alex Tudorache caa808c265 changed category 2016-01-04 16:42:35 +02:00
Alex Tudorache d8683d9f50 updated to 0.5 2016-01-04 16:32:32 +02:00
Alberto Ricci Bitti 807933270b Added "forceAP" parameter to autoconnect (defaulted to false, which leaves previous behaviour unchanged).
If true, starts the configuration portal anyway (in my case I have a physical button to enter configuration)
2016-01-04 13:17:06 +01:00
Alberto Ricci Bitti ead84aea36 Removed unused/commented code 2016-01-04 10:57:43 +01:00
Alberto Ricci Bitti 9fd11f13b6 connectWifi() now returns connection status, making its use more straightforward 2016-01-04 10:44:56 +01:00
Alex Tudorache 1a58897ab4 added some more thanks 2016-01-02 09:49:47 +02:00
tzapu 7ba1f3ada5 Merge pull request #41 from domonetic/patch-4
add library.json
thank you
2016-01-02 09:44:44 +02:00
tzapu e6cbb8fa05 Merge pull request #40 from domonetic/patch-5
add library.properties
THANK YOU, you are amazing
2016-01-02 09:44:00 +02:00
tzapu 81d48d7612 Merge pull request #39 from domonetic/patch-3
add keywords.txt 
THANK YOU GUYS
2016-01-02 09:42:41 +02:00
Maximiliano Duarte ab23ca7b18 change category 2015-12-31 09:53:35 -03:00
Maximiliano Duarte 94eef239eb change space for tabs 2015-12-30 12:49:53 -03:00
Maximiliano Duarte 30f5a220ce add library.properties
to standardize the library and appear in Library Manager
2015-12-30 12:16:42 -03:00
Maximiliano Duarte 9350856d33 add library.json
to standardize the library and appear in Library Manager
2015-12-30 12:14:22 -03:00
Maximiliano Duarte a69c5e2b93 add keywords.txt
to standardize the library and appear in Library Manager
2015-12-30 12:12:57 -03:00
Alex Tudorache 777c2fab1b presentation tweaks 2015-12-28 18:07:02 +02:00
Alex Tudorache ec1a55bffc new padlock icon 2015-12-28 14:32:36 +02:00
Alex Tudorache ffdc117a6e added AP quality
added padlock for secured networks
moved more stuff to PROGMEM
2015-12-27 11:17:29 +02:00
Alex Tudorache 44419e10a2 moved most stuff to PROGMEM
added warning for invalid password
2015-12-23 18:15:58 +02:00
Alex Tudorache a0237d80f6 updated readme 2015-12-19 21:25:06 +02:00
tzapu 41990177ce Merge pull request #23 from j0hnlittle/master
Added password option to AP wifiManager.autoConnect("apname","password")
thank you j0hnlittle
2015-12-19 13:41:25 +02:00
Alex Tudorache acc6624406 information about access point callback 2015-12-17 19:14:50 +02:00
John Little c2f11e8bd9 Synced my changes with tzapu's 2015-12-17 14:59:56 +00:00
John Little c44d3643a8 Added password option to AP wifiManager.autoConnect("apname","password") 2015-12-17 14:05:20 +00:00
Alex Tudorache e9dd81d163 cleanup 2015-12-17 15:30:19 +02:00
Alex Tudorache 6ff9712b65 added config mode callback 2015-12-17 09:25:09 +02:00
tzapu f9b6db797f Merge pull request #20 from alltheblinkythings/for-upstream
Allocate the DNSServer and ESP8266WebServer on the heap at begin() time and free them when autoConnect() terminates. thanks @alltheblinkythings ;)
2015-12-15 18:25:22 +02:00
Christopher Pascoe d3274bc5b9 Allocate the DNSServer and ESP8266WebServer on the heap at begin() time and free them when autoConnect() terminates.
This reduces the likelihood of a stack overflow when WifiManager is instantiated in setup(),
and lowers memory usage (after wifi is connected) when it's instantiated globally.
2015-12-13 16:03:13 -08:00
Alex Tudorache e36f7959c7 examples updated 2015-12-09 09:37:23 +02:00
55 changed files with 11339 additions and 736 deletions
+23
View File
@@ -0,0 +1,23 @@
name: Build
on:
push:
pull_request:
permissions:
contents: read
jobs:
compile-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
environment: ["esp8266", "esp32"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install --upgrade platformio==6.1.19
- run: ./scripts/compile-check.sh --platform ${{ matrix.environment }}
+23
View File
@@ -0,0 +1,23 @@
name: Publish release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install --upgrade platformio==6.1.19
- run: ./scripts/prepare-release.sh "$GITHUB_REF_NAME"
- run: gh release create "$GITHUB_REF_NAME" --generate-notes --title "$GITHUB_REF_NAME"
env:
GH_TOKEN: ${{ github.token }}
+35
View File
@@ -0,0 +1,35 @@
# PlatformIO
.pio/
.pioenvs/
.piolibdeps/
.vscode/
.cache/
*.pyc
*.pyo
*.pyd
__pycache__/
# IDE
.idea/
*.sublime-project
*.sublime-workspace
.vscode/
!.vscode/extensions.json
# PlatformIO project overrides
/platformio_override.ini
/build_output/
# OS
.DS_Store
Thumbs.db
# Build artifacts
*.o
*.elf
*.hex
*.bin
*.log
# Misc
node_modules/
+24
View File
@@ -0,0 +1,24 @@
# Changelog
## 3.0.3
## 3.0.4
- Set the package's deep PlatformIO dependency-discovery mode so WiFiManager's asynchronous web/TCP children remain available when it is consumed through DeviceFramework.
- Declare the ESP8266 and ESP32 async TCP libraries explicitly in the PlatformIO package manifest so clean consumers resolve the headers required by the asynchronous portal.
## 3.0.2
- Update the pinned DFTE dependency to the iterator-lifecycle and configuration-safe 1.0.2 release.
## 3.0.1
- Redact WiFi, AP, portal-form, and custom-parameter values from diagnostic logs.
## 3.0.0
- Establish `device-framework` as the independently maintained canonical branch.
- Add safe default parameter construction and allocation-failure handling.
- Pin the DFTE dependency used by PlatformIO builds.
+9
View File
@@ -20,3 +20,12 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
This is a fork of tzapu/WiFiManager (https://github.com/tzapu/WiFiManager)
Original work Copyright (c) 2015 tzapu
This software has been modified and includes contributions Copyright (c) 2024
Alex Hope-O'Connor (https://github.com/alexhopeoconnor). The original
license and copyright notice above must be preserved in all copies as required
by the MIT License.
+253 -66
View File
@@ -1,90 +1,277 @@
# WiFiManager
ESP8266 WiFi Connection manager with fallback web configuration portal
The configuration portal is of the captive variety, so on various devices it will present the configuration dialogue as soon as you connect to the created access point.
This repository is a **breaking fork** of upstream [`tzapu/WiFiManager`](https://github.com/tzapu/WiFiManager).
It is not a drop-in replacement for upstream behavior, APIs, templates, or portal customization patterns.
First attempt at a library. Lots more changes and fixes to do. Contributions are welcome.
If you are evaluating this fork, assume that core web-portal architecture has changed and review the code before adopting it in an existing upstream-based project.
## How It works
- when your ESP starts up, it sets it up in Station mode and tries to connect to a previously saved Access Point
- if this is unsuccessful (or no previous network saved) it moves the ESP into Access Point mode and spins up a DNS and WebServer (default ip 192.168.4.1)
- using any wifi enabled device with a browser (computer, phone, tablet) connect to the newly created Access Point
- because of the Captive Portal and the DNS server you will either get a 'Join to network' type of popup or get any domain you try to access redirected to the configuration portal
- choose one of the access points scanned, enter password, click save
- ESP will try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure.
**This repository:** [alexhopeoconnor/WiFiManager](https://github.com/alexhopeoconnor/WiFiManager)
**Upstream:** [tzapu/WiFiManager](https://github.com/tzapu/WiFiManager)
## Still left to do
- ~~remove dependency on EEPROM library~~
- move HTML Strings to PROGMEM
- cleanup and streamline code
- if timeout is set, extend it when a page is fetched in AP mode
- add ability to configure more parameters than ssid/password
- maybe allow setting ip of ESP after reboot
## Basic provisioning
This works with the ESP8266 Arduino platform https://github.com/esp8266/Arduino
For a standalone Arduino project, create one long-lived `WiFiManager` and call
`autoConnect` during setup. It first tries saved station credentials; when that
fails it starts the configuration portal with the supplied AP name and password.
## Releases
> v0.3 removed the need for EEPROM and works with the 2.0.0 and above stable release of the ESP8266 for Arduino IDE package
> **v0.2 and newer need the latest staging version (or at least a recent release of the staging version) to work**
> v0.1 works with the staging release ver. 1.6.5-1044-g170995a, built on Aug 10, 2015 of the ESP8266 Arduino library.
## Quick Start
- Make sure you have a recent package of the ESP8266 for Arduino IDE
- Checkout library to your Arduino libraries folder
- Include in your sketch
```cpp
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <Arduino.h>
#include <WiFiManager.h>
WiFiManager wifi;
void setup() {
Serial.begin(115200);
wifi.setConfigPortalTimeout(180); // seconds; 0 leaves it open
if (!wifi.autoConnect("Device Setup", "change-me")) {
ESP.restart();
}
}
void loop() {
// Normal application work after WiFi is connected.
}
```
- Initialise library, in your setup function add
The AP password must meet the Wi-Fi password requirements. For applications
built on DeviceFramework, configure `setConfigDevicePassword(...)` instead:
DeviceFramework passes the same validated password to WiFiManager, Arduino OTA,
HTTP Basic authentication, and WebSerial.
## Breaking Changes
This fork intentionally modernizes and restructures the configuration portal.
Notable differences from upstream include:
- The portal now serves a **single HTML shell** from `GET /`.
- Client navigation is handled as a **SPA with hash routing**.
- Interactive behavior is exposed through **JSON APIs under `/api/...`** plus firmware upload at **`POST /u`**.
- Legacy multi-page portal routes and legacy root-template override paths have been removed.
- The portal rendering pipeline is built around **DFTE** instead of upstream's monolithic HTML string assembly.
- JSON endpoints are expected to be **data-first**, not derived from generated HTML fragments.
## Current Improvements And Modernization
This fork currently includes the following architectural improvements:
- A **single-shell portal architecture** with embedded bootstrap JSON and embedded application JS.
- A **SPA-based configuration UI** for WiFi setup, parameters, info views, device actions, and OTA flow.
- A **clean API surface** for WiFi scanning, WiFi save, parameters, info, status, restart, erase, portal exit, and captive-portal close behavior.
- **Captive portal redirect handling** retained while removing duplicate legacy UI architecture.
- **Data-first JSON generation** for portal APIs, including info/device/about data, instead of HTML-to-JSON parsing.
- **Capability-driven UI flags** in bootstrap/API payloads so features like info, update, erase, and action visibility can be controlled by backend state.
- **Portal bootstrap contract v2**: nested `brand`, `context`, `pages`, `actions`, `layout`, `extraHomeCards`; Wi-Fi meta params include `kind` (`field` | `html`) for first-class custom HTML parameters.
- **SPA-native feedback UX** using in-DOM dialog/toast behavior rather than page-based action flows.
- **Connect-on-save handoff**: when portal save triggers a station connect, `/api/wifi/connect-status` now reports a brief success state with `stationIp` and `redirectUrl` so the SPA can show the new address and redirect before the AP shuts down.
- **Request-scoped shell rendering**: the root portal page is built for each `GET /` from `WM_ROOT_SHELL_TEMPLATE` using a fresh placeholder registry. Shell inputs are `%PAGE_TITLE%`, `%STYLES%`, `%BOOTSTRAP_JSON%`, `%PORTAL_APP_JS%`, and `%PORTAL_APPEND_JS%` — filled in `WiFiManagerHandlers` from WiFiManager state and embedded assets (not from a server-wide template registry).
- **Customization via WiFiManager `portal*` APIs** (`portalSetBrandTitle`, `portalSetPageInfoVisible`, `portalSetLayoutParamsLocation`, `portalAddParameter`, asset hooks, etc.) and JSON under `/api/...`, not by exposing placeholder-registry mutation to consumers.
- A clearer separation between:
- shell rendering (handlers + SPA bootstrap)
- JSON API responses
- captive portal behavior
- OTA handling
- Updated tests focused on the **shell contract**, **bootstrap payloads**, and **API JSON shapes** rather than removed legacy portal pages.
## Portal Customization Boundary
Stable, supported portal customization is intentionally scoped:
- `portalSetBrand*` for title, intro text, and logo SVG, plus `portalSetContextIdentityText(...)` for the user-facing runtime identity string on the home view.
- `portalSetPage*`, `portalSetAction*`, `portalSetLayout*`, and `portalSetBehavior*` for built-in portal capabilities and runtime behavior.
- `portalAddParameter(...)` for first-class custom parameters, including raw HTML blocks inside parameter-rendering surfaces (`#/wifi` or `#/setup`).
- `portalAddInfoSection(...)` and `portalAddHomeCard(...)` for structured extra content rendered by the built-in SPA.
- `portalAppendCss(...)`, `portalOverrideCss(...)`, and `portalAppendJs(...)` for light theming and enhancement hooks.
Not part of the stable API:
- arbitrary HTML injection into home/info/nav/shell
- replacing built-in SPA routing or action flow
- depending on undocumented DOM IDs or route internals
- treating `include/templates/*` as a supported consumer override surface
Appended JS should enhance rather than replace the built-in SPA. The documented hook contract is:
- `wm:ready` with `detail.boot`
- `wm:view-changed` with `detail.route`
If a consumer needs custom live widgets, new primary navigation concepts, or new backend-to-frontend workflows, that is considered **fork territory** rather than portal customization.
## Portal Customization Example
```cpp
WiFiManager wifiManager;
WiFiManager wm;
wm.portalSetBrandTitle("Solar Battery Monitor Setup");
wm.portalSetContextIdentityText("Solar Battery Monitor");
wm.portalSetBrandHomeIntro(
"Connect your monitor to WiFi, then review battery and inverter settings."
);
wm.portalSetBrandLogoSvg(
"<svg viewBox='0 0 24 24' aria-hidden='true'>"
"<path d='M12 2L4 12h5l-1 10 8-10h-5z'></path>"
"</svg>"
);
wm.portalSetPageInfoVisible(true);
wm.portalSetPageUpdateVisible(false);
wm.portalSetActionEraseVisible(false);
wm.portalSetActionRestartVisible(true);
wm.portalSetLayoutParamsLocation(PortalParamsLocation::SetupPage);
wm.portalSetBehaviorCaptivePortalEnabled(true);
wm.portalSetBehaviorConnectOnSave(true);
wm.portalSetBehaviorExitAllowed(true);
wm.portalSetFieldPasswordPlaceholderMode(PortalPasswordPlaceholderMode::Masked);
wm.portalSetFieldStaticIpVisibility(PortalFieldVisibility::Auto);
wm.portalSetFieldStaticDnsVisibility(PortalFieldVisibility::Auto);
WiFiManagerParameter mqttHost(
"mqtt_host",
"MQTT host",
"broker.local",
64,
"placeholder='broker.local'"
);
wm.portalAddParameter(&mqttHost);
// Raw HTML remains first-class for custom parameters, but only inside the
// parameter-rendering surfaces (#/wifi or #/setup), not arbitrary portal regions.
WiFiManagerParameter gpsHelp(
"<div class='wm-callout wm-callout--info'>"
"<p>GPS options below apply only when a GPS module is connected.</p>"
"</div>"
);
wm.portalAddParameter(&gpsHelp);
PortalInfoSection battery;
battery.id = "battery";
battery.title = "Battery";
battery.items.push_back({"soc", "State of charge", "84%"});
battery.items.push_back({"voltage", "Voltage", "13.2V"});
wm.portalAddInfoSection(battery);
PortalHomeCard solar;
solar.id = "solar";
solar.title = "Solar summary";
solar.kind = PortalHomeCardKind::KeyValue;
solar.items.push_back({"pv", "PV input", "420W"});
solar.items.push_back({"load", "Load", "180W"});
wm.portalAddHomeCard(solar);
wm.portalAppendCss(
".wm-brand-logo svg{width:40px;height:40px;display:block;}"
".wm-hero-intro{max-width:42ch;}"
);
wm.portalAppendJs(
"document.addEventListener('wm:ready', function(e){"
" console.log('Portal booted', e.detail.boot);"
"});"
);
```
- Also in the setup function add
```cpp
//parameter is name of access point
wifiManager.autoConnect("AP-NAME");
```
or if you want to use and auto generated name from 'ESP' and the esp's Chip ID use
```cpp
wifiManager.autoConnect();
## WiFi Connect Status API
When `portalSetBehaviorConnectOnSave(true)` is enabled, saving WiFi credentials queues a station join and the SPA polls `GET /api/wifi/connect-status`.
Response shape:
```json
{
"state": "waiting | success | failed",
"message": "human readable status",
"wifiStatus": "WL_CONNECTED",
"stationIp": "192.168.1.42",
"redirectUrl": "http://192.168.1.42/"
}
```
After you write your sketch and start the ESP, it will try to connect to WiFi. If it fails it starts in Access Point mode.
While in AP mode, connect to it then open a browser to the gateway IP, default 192.168.4.1, configure wifi, save and it should reboot and connect.
Notes:
Also see examples.
- `stationIp` and `redirectUrl` are present only after a successful station join.
- If the portal HTTP server is not on port `80`, `redirectUrl` includes the active port.
- On success, WiFiManager keeps the portal alive briefly so the client can read the success payload and navigate to the new device address before the captive AP is shut down.
- This improves the handoff on typical home networks, but it is not a universal guarantee: client captive-portal helpers, browser behavior, DHCP timing, and network isolation can still affect whether the redirect completes automatically.
### Timeout
If you need to set a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure, you can add
```cpp
wifiManager.setTimeout(180);
```
which will wait 3 minutes (180 seconds). When the time passes, the autoConnect function will return, no matter the outcome.
Check for connection and if it's still not established do whatever is needed (on some modules I restart them to retry, on others I enter deep sleep)
## Dependencies
### Debug
Debug is enabled by default on Serial. To disable add before autoConnect
```cpp
wifiManager.setDebugOutput(false);
This fork depends on **DFTE** ([Device Framework Template Engine](https://github.com/alexhopeoconnor/DFTE)) and **ESP32Async/ESPAsyncWebServer**.
The published `library.json` resolves DFTE from the maintained, pinned
`v1.0.2` Git tag. No sibling checkout is required to consume WiFiManager.
When developing both libraries together, use a local `symlink://` or
`file://` dependency in your own ignored PlatformIO override.
## Installation
Use the release tag and list the asynchronous web/TCP packages at project level.
PlatformIO installs the manifest dependencies automatically, but its dependency
finder requires these headers to be direct project dependencies before it adds
their include paths:
```ini
[common]
lib_deps =
WiFiManager=https://github.com/alexhopeoconnor/WiFiManager.git#v3.0.4
ESP32Async/ESPAsyncWebServer@3.9.1
[env:esp8266]
extends = common
platform = espressif8266
board = d1_mini
framework = arduino
lib_deps =
${common.lib_deps}
ESP32Async/ESPAsyncTCP@2.0.0
[env:esp32]
extends = common
lib_deps =
platform = espressif32
board = esp32dev
framework = arduino
${common.lib_deps}
ESP32Async/AsyncTCP@3.4.9
```
### Custom IP Configuration
This will set your captive portal to a specific IP should you need/want such a feature. Add the following snippet before `autoConnect()`
```cpp
//set custom ip for portal
wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
The text after `#` is a Git ref. PlatformIO clones the repository and checks
out that tag; it does not download a GitHub Release asset. A tag gives a
reproducible library input. Use a local checkout only while actively changing
the library:
```ini
lib_deps =
WiFiManager=file:///path/to/WiFiManager
```
#### Inspiration
- http://www.esp8266.com/viewtopic.php?f=29&t=2520
## Tests and releases
To be continued...
The CI workflow compiles a minimal clean consumer project for both supported
targets. These commands need no connected board:
```bash
./scripts/compile-check.sh --platform esp8266
./scripts/compile-check.sh --platform esp32
```
Before publishing a version, update `library.json`, `CHANGELOG.md`, and this
README, run both checks, then create the annotated tag:
```bash
./scripts/prepare-release.sh vMAJOR.MINOR.PATCH --tag
```
Push the branch and tag. GitHub Actions validates the PlatformIO package again
and creates the GitHub Release from that tag.
## AI Assistance Notice
Parts of this codebase have been developed and refactored with the aid of AI coding agents under human direction and review.
## License
See [LICENSE](LICENSE).
-463
View File
@@ -1,463 +0,0 @@
/**************************************************************
* WiFiManager is a library for the ESP8266/Arduino platform
* (https://github.com/esp8266/Arduino) to enable easy
* configuration and reconfiguration of WiFi credentials and
* store them in EEPROM.
* inspired by:
* http://www.esp8266.com/viewtopic.php?f=29&t=2520
* https://github.com/chriscook8/esp-arduino-apboot
* https://github.com/esp8266/Arduino/tree/esp8266/hardware/esp8266com/esp8266/libraries/DNSServer/examples/CaptivePortalAdvanced
* Built by AlexT https://github.com/tzapu
* Licensed under MIT license
**************************************************************/
#include "WiFiManager.h"
//DNSServer dnsServer;
// Web server
//ESP8266WebServer server(80);
WiFiManager::WiFiManager() : server(80) {
}
void WiFiManager::begin() {
begin("NoNetESP");
}
void WiFiManager::begin(char const *apName) {
DEBUG_PRINT("");
_apName = apName;
start = millis();
DEBUG_PRINT("Configuring access point... ");
DEBUG_PRINT(_apName);
//optional soft ip config
if (_ip) {
DEBUG_PRINT("Custom IP/GW/Subnet");
WiFi.softAPConfig(_ip, _gw, _sn);
}
WiFi.softAP(_apName);//TODO: add password option
delay(500); // Without delay I've seen the IP address blank
DEBUG_PRINT("AP IP address: ");
DEBUG_PRINT(WiFi.softAPIP());
/* Setup the DNS server redirecting all the domains to the apIP */
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
dnsServer.start(DNS_PORT, "*", WiFi.softAPIP());
/* Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */
server.on("/", std::bind(&WiFiManager::handleRoot, this));
server.on("/wifi", std::bind(&WiFiManager::handleWifi, this, true));
server.on("/0wifi", std::bind(&WiFiManager::handleWifi, this, false));
server.on("/wifisave", std::bind(&WiFiManager::handleWifiSave, this));
server.on("/generate_204", std::bind(&WiFiManager::handle204, this)); //Android/Chrome OS captive portal check.
server.on("/fwlink", std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
server.onNotFound (std::bind(&WiFiManager::handleNotFound, this));
server.begin(); // Web server start
DEBUG_PRINT("HTTP server started");
}
boolean WiFiManager::autoConnect() {
String ssid = "ESP" + String(ESP.getChipId());
return autoConnect(ssid.c_str());
}
boolean WiFiManager::autoConnect(char const *apName) {
DEBUG_PRINT("");
DEBUG_PRINT("AutoConnect");
// read eeprom for ssid and pass
String ssid = getSSID();
String pass = getPassword();
//use SDK functions to get SSID and pass
//String ssid = WiFi.SSID();
//String pass = WiFi.psk();
WiFi.mode(WIFI_STA);
connectWifi(ssid, pass);
int s = WiFi.status();
if (s == WL_CONNECTED) {
DEBUG_PRINT("IP Address:");
DEBUG_PRINT(WiFi.localIP());
//connected
return true;
}
// delay(1000);
//not connected
//setup AP
WiFi.mode(WIFI_AP);
connect = false;
begin(apName);
bool looping = true;
//while(1) {
while(timeout == 0 || millis() < start + timeout) {
//DNS
dnsServer.processNextRequest();
//HTTP
server.handleClient();
/*if(connect) {
delay(5000);
ESP.reset();
delay(1000);
}*/
if(connect) {
delay(2000);
DEBUG_PRINT("Connecting to new AP");
connect = false;
//ssid = getSSID();
//pass = getPassword();
connectWifi(_ssid, _pass);
int s = WiFi.status();
if (s != WL_CONNECTED) {
DEBUG_PRINT("Failed to connect.");
//not connected, should retry everything
//ESP.reset();
//delay(1000);
//return false;
} else {
//connected
WiFi.mode(WIFI_STA);
return true;
}
}
yield();
}
return WiFi.status() == WL_CONNECTED;
}
void WiFiManager::connectWifi(String ssid, String pass) {
DEBUG_PRINT("Connecting as wifi client...");
//WiFi.disconnect();
WiFi.begin(ssid.c_str(), pass.c_str());
int connRes = WiFi.waitForConnectResult();
DEBUG_PRINT ("Connection result: ");
DEBUG_PRINT ( connRes );
}
String WiFiManager::getSSID() {
if (_ssid == "") {
DEBUG_PRINT("Reading EEPROM SSID");
_ssid = WiFi.SSID();//getEEPROMString(0, 32);
DEBUG_PRINT("SSID: ");
DEBUG_PRINT(_ssid);
}
return _ssid;
}
String WiFiManager::getPassword() {
if (_pass == "") {
DEBUG_PRINT("Reading EEPROM Password");
_pass = WiFi.psk();//getEEPROMString(32, 64);
DEBUG_PRINT("Password: " + _pass);
//DEBUG_PRINT(_pass);
}
return _pass;
}
/*
void WiFiManager::setSSID(String s) {
_ssid = s;
setEEPROMString(0, 32, _ssid);
}
void WiFiManager::setPassword(String p) {
DEBUG_PRINT("Save password:");
DEBUG_PRINT(p);
_pass = p;
setEEPROMString(32, 64, _pass);
}*/
/*
String WiFiManager::getEEPROMString(int start, int len) {
EEPROM.begin(512);
delay(10);
String string = "";
for (int i = _eepromStart + start; i < _eepromStart + start + len; i++) {
//DEBUG_PRINT(i);
string += char(EEPROM.read(i));
}
EEPROM.end();
return string;
}
*/
/*
void WiFiManager::setEEPROMString(int start, int len, String string) {
EEPROM.begin(512);
delay(10);
int si = 0;
for (int i = _eepromStart + start; i < _eepromStart + start + len; i++) {
char c;
if (si < string.length()) {
c = string[si];
//DEBUG_PRINT("Wrote: ");
//DEBUG_PRINT(c);
} else {
c = 0;
}
EEPROM.write(i, c);
si++;
}
EEPROM.end();
DEBUG_PRINT("Wrote " + string);
}*/
String WiFiManager::urldecode(const char *src)
{
String decoded = "";
char a, b;
while (*src) {
if ((*src == '%') &&
((a = src[1]) && (b = src[2])) &&
(isxdigit(a) && isxdigit(b))) {
if (a >= 'a')
a -= 'a' - 'A';
if (a >= 'A')
a -= ('A' - 10);
else
a -= '0';
if (b >= 'a')
b -= 'a' - 'A';
if (b >= 'A')
b -= ('A' - 10);
else
b -= '0';
decoded += char(16 * a + b);
src += 3;
} else if (*src == '+') {
decoded += ' ';
*src++;
} else {
decoded += *src;
*src++;
}
}
decoded += '\0';
return decoded;
}
void WiFiManager::resetSettings() {
//need to call it only after lib has been started with autoConnect or begin
//setEEPROMString(0, 32, "-");
//setEEPROMString(32, 64, "-");
DEBUG_PRINT("settings invalidated");
WiFi.disconnect();
delay(200);
}
void WiFiManager::setTimeout(unsigned long seconds) {
timeout = seconds * 1000;
}
void WiFiManager::setDebugOutput(boolean debug) {
_debug = debug;
}
void WiFiManager::setAPConfig(IPAddress ip, IPAddress gw, IPAddress sn) {
_ip = ip;
_gw = gw;
_sn = sn;
}
/** Handle root or redirect to captive portal */
void WiFiManager::handleRoot() {
DEBUG_PRINT("Handle root");
if (captivePortal()) { // If caprive portal redirect instead of displaying the page.
return;
}
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
String head = HTTP_HEAD;
head.replace("{v}", "Options");
server.sendContent(head);
server.sendContent(HTTP_SCRIPT);
server.sendContent(HTTP_STYLE);
server.sendContent(HTTP_HEAD_END);
server.sendContent(
"<form action=\"/wifi\" method=\"get\"><button>Configure WiFi</button></form><br/>"
);
server.sendContent(
"<form action=\"/0wifi\" method=\"get\"><button>Configure WiFi (No Scan)</button></form>"
);
server.sendContent(HTTP_END);
server.client().stop(); // Stop is needed because we sent no content length
}
/** Wifi config page handler */
void WiFiManager::handleWifi(bool scan) {
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
String head = HTTP_HEAD;
head.replace("{v}", "Config ESP");
server.sendContent(head);
server.sendContent(HTTP_SCRIPT);
server.sendContent(HTTP_STYLE);
server.sendContent(HTTP_HEAD_END);
if (scan) {
int n = WiFi.scanNetworks();
DEBUG_PRINT("Scan done");
if (n == 0) {
DEBUG_PRINT("No networks found");
server.sendContent("<div>No networks found. Refresh to scan again.</div>");
}
else {
for (int i = 0; i < n; ++i)
{
DEBUG_PRINT(WiFi.SSID(i));
DEBUG_PRINT(WiFi.RSSI(i));
String item = HTTP_ITEM;
item.replace("{v}", WiFi.SSID(i));
server.sendContent(item);
yield();
}
}
}
server.sendContent(HTTP_FORM);
server.sendContent(HTTP_END);
server.client().stop();
DEBUG_PRINT("Sent config page");
}
/** Handle the WLAN save form and redirect to WLAN config page again */
void WiFiManager::handleWifiSave() {
DEBUG_PRINT("WiFi save");
//server.arg("s").toCharArray(ssid, sizeof(ssid) - 1);
//server.arg("p").toCharArray(password, sizeof(password) - 1);
//SAVE/connect here
//setSSID(urldecode(server.arg("s").c_str()));
//setPassword(urldecode(server.arg("p").c_str()));
_ssid = urldecode(server.arg("s").c_str());
_pass = urldecode(server.arg("p").c_str());
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
String head = HTTP_HEAD;
head.replace("{v}", "Credentials Saved");
server.sendContent(head);
server.sendContent(HTTP_SCRIPT);
server.sendContent(HTTP_STYLE);
server.sendContent(HTTP_HEAD_END);
server.sendContent(HTTP_SAVED);
server.sendContent(HTTP_END);
server.client().stop();
DEBUG_PRINT("Sent wifi save page");
//saveCredentials();
connect = true; //signal ready to connect/reset
}
void WiFiManager::handle204() {
DEBUG_PRINT("204 No Response");
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send ( 204, "text/plain", "");
}
void WiFiManager::handleNotFound() {
if (captivePortal()) { // If captive portal redirect instead of displaying the error page.
return;
}
String message = "File Not Found\n\n";
message += "URI: ";
message += server.uri();
message += "\nMethod: ";
message += ( server.method() == HTTP_GET ) ? "GET" : "POST";
message += "\nArguments: ";
message += server.args();
message += "\n";
for ( uint8_t i = 0; i < server.args(); i++ ) {
message += " " + server.argName ( i ) + ": " + server.arg ( i ) + "\n";
}
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send ( 404, "text/plain", message );
}
/** Redirect to captive portal if we got a request for another domain. Return true in that case so the page handler do not try to handle the request again. */
boolean WiFiManager::captivePortal() {
if (!isIp(server.hostHeader()) ) {
DEBUG_PRINT("Request redirected to captive portal");
server.sendHeader("Location", String("http://") + toStringIp(server.client().localIP()), true);
server.send ( 302, "text/plain", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
server.client().stop(); // Stop is needed because we sent no content length
return true;
}
return false;
}
template <typename Generic>
void WiFiManager::DEBUG_PRINT(Generic text) {
if(_debug) {
Serial.print("*WM: ");
Serial.println(text);
}
}
/** Is this an IP? */
boolean WiFiManager::isIp(String str) {
for (int i = 0; i < str.length(); i++) {
int c = str.charAt(i);
if (c != '.' && (c < '0' || c > '9')) {
return false;
}
}
return true;
}
/** IP to String? */
String WiFiManager::toStringIp(IPAddress ip) {
String res = "";
for (int i = 0; i < 3; i++) {
res += String((ip >> (8 * i)) & 0xFF) + ".";
}
res += String(((ip >> 8 * 3)) & 0xFF);
return res;
}
-118
View File
@@ -1,118 +0,0 @@
/**************************************************************
* WiFiManager is a library for the ESP8266/Arduino platform
* (https://github.com/esp8266/Arduino) to enable easy
* configuration and reconfiguration of WiFi credentials and
* store them in EEPROM.
* inspired by http://www.esp8266.com/viewtopic.php?f=29&t=2520
* https://github.com/chriscook8/esp-arduino-apboot
* Built by AlexT https://github.com/tzapu
* Licensed under MIT license
**************************************************************/
#ifndef WiFiManager_h
#define WiFiManager_h
#include <ESP8266WiFi.h>
//#include <EEPROM.h>
//#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
class WiFiManager
{
public:
WiFiManager();
void begin();
void begin(char const *apName);
boolean autoConnect();
boolean autoConnect(char const *apName);
boolean hasConnected();
String beginConfigMode(void);
void startWebConfig();
String getSSID();
String getPassword();
void setSSID(String s);
void setPassword(String p);
void resetSettings();
//for conveniennce
String urldecode(const char*);
//sets timeout before webserver loop ends and exits even if there has been no setup.
//usefully for devices that failed to connect at some point and got stuck in a webserver loop
//in seconds
void setTimeout(unsigned long seconds);
void setDebugOutput(boolean debug);
//sets a custom ip /gateway /subnet configuration
void setAPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
int serverLoop();
private:
DNSServer dnsServer;
ESP8266WebServer server;
const int WM_DONE = 0;
const int WM_WAIT = 10;
const String HTTP_404 = "HTTP/1.1 404 Not Found\r\n\r\n";
const String HTTP_200 = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
const String HTTP_HEAD = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/><title>{v}</title>";
const String HTTP_STYLE = "<style>div,input {margin-bottom: 5px;} body{width:200px;display:block;margin-left:auto;margin-right:auto;} button{padding:0.75rem 1rem;border:0;border-radius:0.317rem;background-color:#1fa3ec;color:#fff;line-height:1.5;cursor:pointer;}</style>";
const String HTTP_SCRIPT = "<script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();}</script>";
const String HTTP_HEAD_END = "</head><body>";
const String HTTP_ITEM = "<div><a href='#' onclick='c(this)'>{v}</a></div>";
const String HTTP_FORM = "<form method='get' action='wifisave'><input id='s' name='s' length=32 placeholder='SSID'><input id='p' name='p' length=64 placeholder='password'><br/><button type='submit'>save</button></form>";
const String HTTP_SAVED = "<div>Credentials Saved<br />Trying to connect ESP to network.<br />If it fails reconnect to AP to try again</div>";
const String HTTP_END = "</body></html>";
//const char HTTP_END[] PROGMEM = R"=====(
//</body></html>
//)=====";
int _eepromStart;
const char* _apName = "no-net";
String _ssid = "";
String _pass = "";
unsigned long timeout = 0;
unsigned long start = 0;
IPAddress _ip;
IPAddress _gw;
IPAddress _sn;
String getEEPROMString(int start, int len);
void setEEPROMString(int start, int len, String string);
bool keepLooping = true;
int status = WL_IDLE_STATUS;
void connectWifi(String ssid, String pass);
void handleRoot();
void handleWifi(bool scan);
void handleWifiSave();
void handleNotFound();
void handle204();
boolean captivePortal();
// DNS server
const byte DNS_PORT = 53;
boolean isIp(String str);
String toStringIp(IPAddress ip);
boolean connect;
boolean _debug = true;
template <typename Generic>
void DEBUG_PRINT(Generic text);
};
#endif
-39
View File
@@ -1,39 +0,0 @@
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
#include <EEPROM.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifi;
//reset saved settings
//wifi.resetSettings();
//set custom ip for portal
//wifi.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
//fetches ssid and pass from eeprom and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
wifi.autoConnect("AutoConnectAP");
//or use this for auto generated name ESP + ChipID
//wifi.autoConnect();
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
void loop() {
// put your main code here, to run repeatedly:
}
@@ -1,50 +0,0 @@
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
//#include <EEPROM.h>
//#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
//this intitilises the library, parameter is eeprom start
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifi;
//reset settings - for testing
wifi.resetSettings();
//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds
wifi.setTimeout(180);
//fetches ssid and pass from eeprom and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if(!wifi.autoConnect("AutoConnectAP")) {
Serial.println("failed to connect and hit timeout");
delay(3000);
//reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(5000);
}
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
void loop() {
// put your main code here, to run repeatedly:
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,45 @@
/**
* WiFiManagerDfteLogger.h
*
* @author alexhopeoconnor
* @license MIT
*
* Optional bridge from DFTE's logging hooks to WiFiManager::log.
* Enabled only when the sketch / library build defines WM_DFTE_LOGGING.
*/
#ifndef WiFiManagerDfteLogger_h
#define WiFiManagerDfteLogger_h
#if defined(ESP8266) || defined(ESP32)
#include <DeviceFrameworkTemplateEngineDebug.h>
#include "WiFiManager.h"
/**
* Forwards DeviceFrameworkTemplateEngineLogger calls to WiFiManager logging
* with subsystem WM/DFTE.
*/
class WiFiManagerDfteLogger : public DeviceFrameworkTemplateEngineLogger {
public:
explicit WiFiManagerDfteLogger(WiFiManager* wm) : _wm(wm) {}
void error(const String& msg) override { logLine(WiFiManagerLogLevel::Error, msg); }
void warn(const String& msg) override { logLine(WiFiManagerLogLevel::Warn, msg); }
void info(const String& msg) override { logLine(WiFiManagerLogLevel::Debug, msg); }
void debug(const String& msg) override { logLine(WiFiManagerLogLevel::Trace, msg); }
private:
WiFiManager* _wm;
void logLine(WiFiManagerLogLevel level, const String& msg) {
if (!_wm) {
return;
}
_wm->log(level, "WM/DFTE", msg);
}
};
#endif // ESP8266 || ESP32
#endif // WiFiManagerDfteLogger_h
@@ -0,0 +1,123 @@
/**
* WiFiManagerHandlers.h
*
* HTTP request handlers for WiFiManager: single HTML shell + JSON APIs.
*
* @author alexhopeoconnor
* @license MIT
*/
#ifndef WiFiManagerHandlers_h
#define WiFiManagerHandlers_h
#if defined(ESP8266) || defined(ESP32)
#include <ESPAsyncWebServer.h>
#include <memory>
#include "WiFiManager.h"
#ifndef WM_TEMPLATE_REGISTRY_CAPACITY
#define WM_TEMPLATE_REGISTRY_CAPACITY 16
#endif
// Portal UI customization is driven by WiFiManager `portal*` APIs and JSON (/api/...) — not by mutating template
// placeholder registries.
// -----------------------------------------------------------------------------------------------
// FORM FIELD NAMES (for IP configuration forms)
const char S_ip[] PROGMEM = "ip";
const char S_gw[] PROGMEM = "gw";
const char S_sn[] PROGMEM = "sn";
const char S_dns[] PROGMEM = "dns";
// -----------------------------------------------------------------------------------------------
// HTTP HEADERS
const char HTTP_HEAD_CT[] PROGMEM = "text/html";
const char HTTP_HEAD_CT2[] PROGMEM = "text/plain";
const char HTTP_HEAD_CORS[] PROGMEM = "Access-Control-Allow-Origin";
const char HTTP_HEAD_CORS_ALLOW_ALL[] PROGMEM = "*";
class WiFiManagerHandlers {
public:
WiFiManagerHandlers(WiFiManager* wm);
void handleRoot(AsyncWebServerRequest *request);
void handleNotFound(AsyncWebServerRequest *request);
void handleRequest(AsyncWebServerRequest *request);
void handleUpdating(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final);
void handleUpdateDone(AsyncWebServerRequest *request);
void handleApiBootstrap(AsyncWebServerRequest *request);
void handleApiWifiScanStatus(AsyncWebServerRequest *request);
void handleApiWifiScan(AsyncWebServerRequest *request);
void handleApiWifiMeta(AsyncWebServerRequest *request);
void handleApiWifiSave(AsyncWebServerRequest *request);
void handleApiWifiConnectStatus(AsyncWebServerRequest *request);
void handleApiParamsGet(AsyncWebServerRequest *request);
void handleApiParamsSave(AsyncWebServerRequest *request);
void handleApiInfo(AsyncWebServerRequest *request);
void handleApiStatus(AsyncWebServerRequest *request);
void handleApiDeviceRestart(AsyncWebServerRequest *request);
void handleApiDeviceErase(AsyncWebServerRequest *request, boolean optionalErase = false);
void handleApiPortalClose(AsyncWebServerRequest *request);
void handleApiPortalExit(AsyncWebServerRequest *request);
boolean captivePortal(AsyncWebServerRequest *request);
void stopCaptivePortal();
/** True when the HTTP Host header does not match the portal’s canonical host:port (captive redirect needed). */
static bool shouldRedirectCaptiveForHost(const String& requestHost, const String& serverLocWithPort);
void doParamSave(WiFiManager::WiFiManagerRequestArgs requestArgs);
/** Portal bootstrap JSON (same payload as GET /api/bootstrap). Public for tests and host integration. */
String buildPortalBootstrapJson();
/** Same JSON body as GET /api/wifi/meta (tests + embedding). */
String buildApiWifiMetaJson();
/** Same JSON body as GET /api/info (tests + embedding). */
String buildApiInfoJson();
/** Same JSON body as GET /api/params (tests + embedding). */
String buildApiParamsGetJson();
/** Same JSON body as GET /api/status (tests + embedding). */
String buildApiStatusJson();
/** GET /api/wifi/connect-status (portal connect progress). */
String buildApiWifiConnectStatusJson();
/** Fixed JSON bodies for POST action endpoints (single source for handlers + tests). */
static String jsonApiWifiScanAccepted();
static String jsonApiDeviceRestartScheduled();
static String jsonApiParamsSaveOk();
static String jsonApiPortalCloseOk();
static String jsonApiPortalExitOk();
static String jsonApiPortalExitForbidden();
static String jsonApiOtaUpdateSuccess();
static String jsonApiEraseResponse(boolean success);
private:
WiFiManager* _wm;
void collectVisibleScanResults(std::vector<const WiFiManager::WiFiScanNetwork*>& networks);
void appendVisibleScanResultsJson(String& json, const std::vector<const WiFiManager::WiFiScanNetwork*>& networks);
void applyWifiAndParamsFromRequest(AsyncWebServerRequest *request);
void buildPlainStatusSummary(String& out);
void appendPortalJsonStaticFields(String& json, bool& first);
void appendPortalJsonCustomParams(String& json, bool& first);
String composePortalStylesheet() const;
void appendPortalExtraInfoSectionsJson(String& json, bool& first);
void appendPortalExtraHomeCardsJson(String& json, bool& first);
void appendJsonKvItem(String& json, bool& first, const char* key, const String& label, const String& value);
void appendOneInfoItemForId(String& json, bool& first, const char* id);
void appendInfoSectionFromIds(String& json, const char* const* ids, size_t count, bool& first);
void appendApiInfoActionsJson(String& json);
static void sendApiJson(AsyncWebServerRequest *request, int code, const String& json);
};
#endif // defined(ESP8266) || defined(ESP32)
#endif // WiFiManagerHandlers_h
@@ -0,0 +1,35 @@
/**
* WiFiManagerLogLevel.h
*
* @author alexhopeoconnor
* @license MIT
*
* Compile-time and runtime log levels for WiFiManager. Higher numeric values
* mean more verbose output. Matches the old 0..5 tier model for build flags.
*/
#ifndef WiFiManagerLogLevel_h
#define WiFiManagerLogLevel_h
#include <Arduino.h>
/** Default subsystem tag for core WiFiManager messages (macro for C++11 embedded toolchains). */
#define kWiFiMgrLogSubsystem "WM"
enum class WiFiManagerLogLevel : uint8_t {
Silent = 0,
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
};
/** Full line delivered to Print or WiFiManagerLogSink (prefix and tags included). */
struct WiFiManagerLogMessage {
WiFiManagerLogLevel level;
const char* subsystem;
String line;
};
#endif
@@ -0,0 +1,22 @@
/**
* WiFiManagerLogSink.h
*
* @author alexhopeoconnor
* @license MIT
*
* Optional host-provided sink for WiFiManager log output. When set, logs are
* delivered here instead of the configured Print stream (usually Serial).
*/
#ifndef WiFiManagerLogSink_h
#define WiFiManagerLogSink_h
#include "WiFiManagerLogLevel.h"
class WiFiManagerLogSink {
public:
virtual void log(const WiFiManagerLogMessage& msg) = 0;
virtual ~WiFiManagerLogSink() = default;
};
#endif
@@ -0,0 +1,48 @@
/**
* WiFiManagerLogTemplates.h
*
* @author alexhopeoconnor
* @license MIT
*
* Template implementations for WiFiManager::log(...). Included at the end of WiFiManager.h.
*/
#ifndef WiFiManagerLogTemplates_h
#define WiFiManagerLogTemplates_h
#include "WiFiManagerLogLevel.h"
#include <IPAddress.h>
#include <WString.h>
#if defined(ESP8266) || defined(ESP32)
inline String wmLogStringifyArg(const __FlashStringHelper* v) {
return String(v);
}
inline String wmLogStringifyArg(const IPAddress& v) {
return v.toString();
}
template<typename T>
inline String wmLogStringifyArg(const T& v) {
return String(v);
}
template<typename T>
inline void WiFiManager::log(WiFiManagerLogLevel level, const char* subsystem, T&& text) {
#ifndef WM_NO_LOG
emitLogImpl(level, subsystem, wmLogStringifyArg(text), String());
#endif
}
template<typename T, typename U>
inline void WiFiManager::log(WiFiManagerLogLevel level, const char* subsystem, T&& a, U&& b) {
#ifndef WM_NO_LOG
emitLogImpl(level, subsystem, wmLogStringifyArg(a), wmLogStringifyArg(b));
#endif
}
#endif // ESP8266 || ESP32
#endif // WiFiManagerLogTemplates_h
@@ -0,0 +1,64 @@
/**
* WiFiManagerParameter.h
*
* @author alexhopeoconnor
* @license MIT
*/
#ifndef WiFiManagerParameter_h
#define WiFiManagerParameter_h
#include <Arduino.h>
class WiFiManager;
#ifndef WIFI_MANAGER_MAX_PARAMS
#define WIFI_MANAGER_MAX_PARAMS 5 // params will autoincrement and realloc by this amount when max is reached
#endif
#define WFM_LABEL_BEFORE 1
#define WFM_LABEL_AFTER 2
#define WFM_NO_LABEL 0
#define WFM_LABEL_DEFAULT 1
class WiFiManagerParameter {
public:
/**
Create custom parameters that can be added to the WiFiManager setup web page
@id is used for HTTP queries and must not contain spaces nor other special characters
*/
WiFiManagerParameter();
explicit WiFiManagerParameter(const char *custom);
WiFiManagerParameter(const char *id, const char *label);
WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length);
WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom);
WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement);
virtual ~WiFiManagerParameter();
WiFiManagerParameter(const WiFiManagerParameter&) = delete;
WiFiManagerParameter& operator=(const WiFiManagerParameter&) = delete;
const char *getID() const;
const char *getValue() const;
const char *getLabel() const;
const char *getPlaceholder() const; // @deprecated, use getLabel
int getValueLength() const;
int getLabelPlacement() const;
virtual const char *getCustomHTML() const;
void setValue(const char *defaultValue, int length);
protected:
void init(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement);
const char *_id;
const char *_label;
char *_value;
int _length;
int _labelPlacement;
const char *_customHTML;
friend class WiFiManager;
};
#endif // WiFiManagerParameter_h
@@ -0,0 +1,96 @@
/**
* WiFiManagerServer.h
*
* @author alexhopeoconnor
* @license MIT
*
* HTTP server for the config portal: single HTML shell (GET /), JSON under /api/..., OTA POST /u,
* captive-portal redirects, and 404 handling. No legacy page routes.
*
* Supported surface (authoritative; registerRoutes mirrors this):
* GET /
* GET /api/bootstrap
* GET /api/wifi/scan-status
* POST /api/wifi/scan
* GET /api/wifi/meta
* POST /api/wifi/save
* GET /api/wifi/connect-status
* GET /api/params
* POST /api/params/save
* GET /api/info
* GET /api/status
* POST /api/device/restart
* POST /api/device/erase
* POST /api/portal/close
* POST /api/portal/exit
* POST /u (multipart firmware upload; JSON completion response)
* notFound -> captive redirect or 404
*/
#ifndef WiFiManagerServer_h
#define WiFiManagerServer_h
#if defined(ESP8266) || defined(ESP32)
#include <ESPAsyncWebServer.h>
#include <DNSServer.h>
#include <functional>
#include <memory>
class WiFiManager;
class WiFiManagerHandlers;
#ifdef WM_DFTE_LOGGING
class WiFiManagerDfteLogger;
#endif
// -----------------------------------------------------------------------------------------------
// HTTP routes (portal API only; no legacy /wifi, /info, … page URLs)
const char R_root[] PROGMEM = "/";
const char R_api_bootstrap[] PROGMEM = "/api/bootstrap";
const char R_api_wifi_scan_status[] PROGMEM = "/api/wifi/scan-status";
const char R_api_wifi_scan[] PROGMEM = "/api/wifi/scan";
const char R_api_wifi_meta[] PROGMEM = "/api/wifi/meta";
const char R_api_wifi_save[] PROGMEM = "/api/wifi/save";
const char R_api_wifi_connect_status[] PROGMEM = "/api/wifi/connect-status";
const char R_api_params[] PROGMEM = "/api/params";
const char R_api_params_save[] PROGMEM = "/api/params/save";
const char R_api_info[] PROGMEM = "/api/info";
const char R_api_status[] PROGMEM = "/api/status";
const char R_api_device_restart[] PROGMEM = "/api/device/restart";
const char R_api_device_erase[] PROGMEM = "/api/device/erase";
const char R_api_portal_close[] PROGMEM = "/api/portal/close";
const char R_api_portal_exit[] PROGMEM = "/api/portal/exit";
const char R_updatedone[] PROGMEM = "/u";
class WiFiManagerServer {
public:
WiFiManagerServer(WiFiManager* wm);
~WiFiManagerServer();
void createServer(uint16_t port);
void registerRoutes();
void setupDNSD();
void processDNS();
void shutdownServer();
AsyncWebServer* getServer() { return server.get(); }
DNSServer* getDNSServer() { return dnsServer.get(); }
private:
WiFiManager* _wm;
std::unique_ptr<WiFiManagerHandlers> _handlers;
std::unique_ptr<AsyncWebServer> server;
std::unique_ptr<DNSServer> dnsServer;
#ifdef WM_DFTE_LOGGING
std::unique_ptr<WiFiManagerDfteLogger> _dfteLogger;
bool _wmOwnsDfteLogSink = false;
#endif
};
#endif // defined(ESP8266) || defined(ESP32)
#endif // WiFiManagerServer_h
+106
View File
@@ -0,0 +1,106 @@
/**
* WiFiManagerUtils.h
* Pure utility functions for WiFiManager
* String conversions, HTML encoding, and helper calculations
* These functions have no dependency on WiFiManager instance state
*
* @author alexhopeoconnor
* @license MIT
*/
#ifndef _WIFI_MANAGER_UTILS_H_
#define _WIFI_MANAGER_UTILS_H_
#include <Arduino.h>
// Forward declaration
class IPAddress;
namespace WiFiManagerUtils {
// -----------------------------------------------------------------------------------------------
// WIFI STATUS ARRAYS (for status string conversion)
extern const char * const WIFI_STA_STATUS[] PROGMEM;
extern const char * const WIFI_MODES[] PROGMEM;
#ifdef ESP32
extern const char * const AUTH_MODE_NAMES[] PROGMEM;
#elif defined(ESP8266)
extern const char * const AUTH_MODE_NAMES[] PROGMEM;
#endif
// -----------------------------------------------------------------------------------------------
// STRING CONVERSION UTILITIES
/**
* Convert WiFi status code to readable string
* @param status WiFi status code
* @return Status string or "Unknown" if invalid
*/
String getStatusString(uint8_t status);
/**
* Convert WiFi mode code to readable string
* @param mode WiFi mode code
* @return Mode string or "Unknown" if invalid
*/
String getModeString(uint8_t mode);
/**
* Convert encryption/auth mode to readable string
* @param authmode Encryption type code
* @return Encryption type string
*/
String getEncryptionString(uint8_t authmode);
// -----------------------------------------------------------------------------------------------
// HTML UTILITIES
/**
* Encode HTML entities in a string
* @param str String to encode
* @param whitespace If true, also encode spaces as &#160;
* @return Encoded string
*/
String htmlEntities(const String& str, bool whitespace = false);
// -----------------------------------------------------------------------------------------------
// IP/STRING UTILITIES
/**
* Check if string is a valid IP address
* @param str String to check
* @return true if valid IP address
*/
bool isValidIP(const String& str);
/**
* Convert IPAddress to String
* @param ip IPAddress to convert
* @return IP address string
*/
String ipToString(IPAddress ip);
/**
* Validate AP password format (8-63 characters)
* @param password Password to validate
* @return true if valid
*/
bool isValidAPPassword(const String& password);
// -----------------------------------------------------------------------------------------------
// HELPER CALCULATIONS
/**
* Convert RSSI value to quality percentage (0-100)
* @param rssi RSSI value in dBm
* @return Quality percentage (0-100)
*/
int rssiToQuality(int rssi);
} // namespace WiFiManagerUtils
#endif // _WIFI_MANAGER_UTILS_H_
+207
View File
@@ -0,0 +1,207 @@
/**
* CSS.h
*
* @author alexhopeoconnor
* @license MIT
*
* CSS stylesheet for WiFiManager web interface.
* Embedded styles to avoid external file dependencies.
*/
#ifndef _CSS_TEMPLATES_H_
#define _CSS_TEMPLATES_H_
#include <Arduino.h>
const char CSS_STYLE[] PROGMEM = "<style>"
/* Design tokens */
":root{"
"--wm-bg:#f0f4f8;"
"--wm-surface:#ffffff;"
"--wm-text:#0f172a;"
"--wm-muted:#64748b;"
"--wm-border:#e2e8f0;"
"--wm-brand:#0ea5e9;"
"--wm-brand-hover:#0284c7;"
"--wm-danger:#dc2626;"
"--wm-danger-hover:#b91c1c;"
"--wm-success:#16a34a;"
"--wm-radius:12px;"
"--wm-radius-sm:8px;"
"--wm-shadow:0 1px 3px rgba(15,23,42,.08),0 4px 16px rgba(15,23,42,.06);"
"--wm-font:system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;"
"}"
"body.invert{"
"--wm-bg:#0c1222;"
"--wm-surface:#151d2e;"
"--wm-text:#f1f5f9;"
"--wm-muted:#94a3b8;"
"--wm-border:#334155;"
"--wm-brand:#38bdf8;"
"--wm-brand-hover:#7dd3fc;"
"--wm-danger:#f87171;"
"--wm-danger-hover:#fca5a5;"
"--wm-success:#4ade80;"
"--wm-shadow:0 4px 24px rgba(0,0,0,.45);"
"}"
/* Base */
"*,*::before,*::after{box-sizing:border-box}"
"body.portal{margin:0;min-height:100vh;background:var(--wm-bg);color:var(--wm-text);"
"font-family:var(--wm-font);font-size:16px;line-height:1.5;-webkit-text-size-adjust:100%;text-align:left}"
"a{color:var(--wm-brand);font-weight:600;text-decoration:none}"
"a:hover{color:var(--wm-brand-hover);text-decoration:underline}"
/* Layout shell */
".wm-layout{width:100%;max-width:420px;margin:0 auto;padding:16px 18px 28px;}"
"h1,h2,h3{margin:0 0 .35em;font-weight:700;letter-spacing:-.02em}"
"h1{font-size:1.5rem}"
"h2{font-size:1.15rem}"
"h3{font-size:1rem}"
"p{margin:.5em 0}"
/* Top navigation — single row; overflow scrollable but scrollbar hidden (touch still pans) */
".wm-nav{display:flex;flex-wrap:nowrap;align-items:stretch;gap:4px;margin:0 0 20px;padding:4px 6px;"
"overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;-ms-overflow-style:none;"
"background:var(--wm-surface);border-radius:var(--wm-radius);box-shadow:var(--wm-shadow);border:1px solid var(--wm-border)}"
".wm-nav::-webkit-scrollbar{display:none;width:0;height:0}"
".wm-nav-link{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:6px 8px;border-radius:var(--wm-radius-sm);"
"font-size:.8rem;font-weight:600;color:var(--wm-muted);text-decoration:none;border:1px solid transparent;white-space:nowrap}"
".wm-nav-link:hover{color:var(--wm-brand);background:rgba(14,165,233,.08);text-decoration:none}"
"body.invert .wm-nav-link:hover{background:rgba(56,189,248,.12)}"
".wm-nav-link--active{color:var(--wm-text);background:rgba(14,165,233,.15);border-color:rgba(14,165,233,.35)}"
"body.invert .wm-nav-link--active{background:rgba(56,189,248,.2);border-color:rgba(56,189,248,.4)}"
".wm-nav .wm-icon-label{gap:4px}"
".wm-nav .wm-icon{width:.95rem;height:.95rem;flex:0 0 .95rem}"
".wm-icon-label{display:inline-flex;align-items:center;gap:8px;min-width:0}"
".wm-icon{display:inline-flex;align-items:center;justify-content:center;width:1.1rem;height:1.1rem;flex:0 0 1.1rem;color:currentColor}"
".wm-icon svg{display:block;width:100%;height:100%}"
/* Hero / page chrome */
".wm-hero{margin-bottom:20px}"
".wm-hero-title{font-size:1.65rem;line-height:1.2;margin-bottom:.25em}"
".wm-hero-sub{font-size:1rem;color:var(--wm-muted);font-weight:500;margin:0}"
".wm-brand-logo{margin-bottom:12px;line-height:0}"
".wm-brand-logo svg{display:block;max-width:160px;height:auto}"
".wm-hero-intro{font-size:.95rem;color:var(--wm-muted);margin:.5em 0 0;line-height:1.45;max-width:42ch}"
".wm-page-head{margin-bottom:16px}"
".wm-page-head h1{font-size:1.45rem}"
".wm-page-desc{font-size:.95rem;color:var(--wm-muted);margin:.35em 0 0}"
/* Cards */
".wm-card{background:var(--wm-surface);border:1px solid var(--wm-border);border-radius:var(--wm-radius);"
"box-shadow:var(--wm-shadow);padding:18px 16px;margin-bottom:16px;text-align:left}"
".wm-card-title{font-size:1rem;margin:0 0 12px;padding-bottom:10px;border-bottom:1px solid var(--wm-border);"
"color:var(--wm-text)}"
".wm-card-subtitle{margin:-4px 0 12px;font-size:.9rem;line-height:1.45;color:var(--wm-muted)}"
".wm-lead{margin:0 0 8px;font-size:.95rem;color:var(--wm-muted);line-height:1.5}"
".wm-home-summary{margin:0 0 14px;font-size:1rem;font-weight:600;line-height:1.45;color:var(--wm-text)}"
/* Callout / status */
".wm-callout{padding:12px 14px;border-radius:var(--wm-radius-sm);border:1px solid var(--wm-border);"
"background:rgba(14,165,233,.06);margin-bottom:16px}"
"body.invert .wm-callout{background:rgba(56,189,248,.08)}"
".wm-callout--info{border-left:4px solid var(--wm-brand)}"
".wm-info-summary{font-weight:600;color:var(--wm-text)}"
".wm-status{margin:0 0 12px;padding:10px 12px;font-size:.92rem;font-weight:700;color:var(--wm-brand);"
"text-align:center;border-radius:var(--wm-radius-sm);background:rgba(14,165,233,.08);border:1px solid rgba(14,165,233,.18)}"
".wm-status--warning{color:#c2410c;background:rgba(249,115,22,.12);border-color:rgba(249,115,22,.28)}"
".wm-status--caution{color:#a16207;background:rgba(234,179,8,.14);border-color:rgba(234,179,8,.3)}"
".wm-status--danger{color:var(--wm-danger);background:rgba(220,38,38,.12);border-color:rgba(220,38,38,.28)}"
"body.invert .wm-status{background:rgba(56,189,248,.12);border-color:rgba(56,189,248,.22)}"
"body.invert .wm-status--warning{background:rgba(249,115,22,.18);border-color:rgba(249,115,22,.34)}"
"body.invert .wm-status--caution{background:rgba(234,179,8,.18);border-color:rgba(234,179,8,.34)}"
"body.invert .wm-status--danger{background:rgba(220,38,38,.18);border-color:rgba(220,38,38,.34)}"
/* Form fields */
".wm-field{margin-bottom:14px;text-align:left}"
".wm-field:last-child{margin-bottom:0}"
".wm-field label{display:block;font-size:.82rem;font-weight:600;color:var(--wm-muted);margin-bottom:6px}"
"input[type=text],input[type=password],input[type=number],input[type=email],select{"
"display:block;width:100%;padding:12px 14px;font-size:1rem;font-family:inherit;"
"color:var(--wm-text);background:var(--wm-bg);border:1px solid var(--wm-border);border-radius:var(--wm-radius-sm);"
"-webkit-appearance:none;appearance:none}"
"input:focus,select:focus{outline:2px solid var(--wm-brand);outline-offset:0;border-color:var(--wm-brand)}"
"input[type=radio],input[type=checkbox]{width:auto;margin-right:8px;accent-color:var(--wm-brand)}"
".wm-checkbox-row{display:flex;align-items:center;gap:8px;margin:12px 0;font-size:.92rem}"
".wm-checkbox-row label{display:inline;margin:0;font-weight:500;color:var(--wm-text)}"
".wm-form-actions{margin-top:16px}"
/* Buttons */
".wm-btn{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 18px;"
"font-size:1rem;font-weight:600;font-family:inherit;border-radius:var(--wm-radius-sm);border:0;cursor:pointer;"
"transition:background .15s,transform .1s,opacity .15s}"
".wm-btn:disabled{opacity:.5;cursor:not-allowed}"
".wm-btn:active{transform:scale(.98)}"
"a.wm-btn{box-sizing:border-box;text-decoration:none}"
".wm-btn .wm-icon-label{justify-content:center}"
".wm-btn--block{width:100%}"
".wm-btn--primary{background:var(--wm-brand);color:#fff}"
".wm-btn--primary:hover{background:var(--wm-brand-hover)}"
".wm-btn--secondary{background:var(--wm-bg);color:var(--wm-text);border:1px solid var(--wm-border)}"
".wm-btn--secondary:hover{border-color:var(--wm-brand);color:var(--wm-brand)}"
".wm-btn--danger{background:var(--wm-danger);color:#fff}"
".wm-btn--danger:hover{background:var(--wm-danger-hover)}"
"input[type=file]{width:100%;padding:10px;border:1px dashed var(--wm-border);border-radius:var(--wm-radius-sm);"
"background:var(--wm-bg);font-size:.9rem}"
/* Legacy: unclassed submit in forms */
"button[type=submit],.wm-form-actions .wm-btn--primary{background:var(--wm-brand);color:#fff}"
"button[type=submit]:hover{background:var(--wm-brand-hover)}"
/* Device actions / button stack */
".wm-actions-stack{display:flex;flex-direction:column;gap:10px;margin-top:4px}"
".wm-btn-group{display:flex;flex-direction:column;gap:10px}"
/* WiFi scan list */
".wm-scan-list{margin:0 0 12px;border:1px solid var(--wm-border);border-radius:var(--wm-radius-sm);"
"overflow:hidden;background:var(--wm-bg)}"
".wm-scan-row{display:flex;align-items:center;gap:10px;min-height:48px;padding:10px 12px;"
"border-bottom:1px solid var(--wm-border);text-decoration:none;color:inherit;cursor:pointer}"
".wm-scan-row:last-child{border-bottom:0}"
".wm-scan-row:hover{background:rgba(14,165,233,.1)}"
"body.invert .wm-scan-row:hover{background:rgba(56,189,248,.12)}"
".wm-scan-ssid{flex:1;min-width:0;font-weight:600;font-size:.95rem;text-align:left;word-break:break-word}"
".wm-scan-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex-shrink:0;min-width:78px}"
".wm-scan-signal{display:block;flex-shrink:0;font-size:.8rem;color:var(--wm-muted);font-weight:600;min-width:38px;text-align:right}"
".wm-scan-lock,.wm-scan-bars{display:block;flex:0 0 16px}"
// quality icons
".q{position:relative;height:16px;width:16px;margin:0;padding:0;flex-shrink:0}.q.q-0:after{background-position-x:0}.q.q-1:after{background-position-x:-16px}.q.q-2:after{background-position-x:-32px}.q.q-3:after{background-position-x:-48px}.q.q-4:after{background-position-x:-64px}.q.l:before{background-position-x:-80px}.ql .q{float:left}.q:after,.q:before{content:'';position:absolute;left:0;top:0;width:16px;height:16px;display:block;background-repeat:no-repeat;background-position:16px 0;"
"background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAMAAADeZIrLAAAAJFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAIjN3iJmqu8zd7vF8pzcAAABsSURBVHja7Y1BCsAwCASNSVo3/v+/BUEiXnIoXkoX5jAQMxTHzK9cVSnvDxwD8bFx8PhZ9q8FmghXBhqA1faxk92PsxvRc2CCCFdhQCbRkLoAQ3q/wWUBqG35ZxtVzW4Ed6LngPyBU2CobdIDQ5oPWI5nCUwAAAAASUVORK5CYII=');}"
".wm-scan-lock:after,.wm-scan-bars:before{content:none}"
"@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.q:before,.q:after {"
"background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALwAAAAgCAMAAACfM+KhAAAALVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAESIzRGZ3iJmqu8zd7gKjCLQAAACmSURBVHgB7dDBCoMwEEXRmKlVY3L//3NLhyzqIqSUggy8uxnhCR5Mo8xLt+14aZ7wwgsvvPA/ofv9+44334UXXngvb6XsFhO/VoC2RsSv9J7x8BnYLW+AjT56ud/uePMdb7IP8Bsc/e7h8Cfk912ghsNXWPpDC4hvN+D1560A1QPORyh84VKLjjdvfPFm++i9EWq0348XXnjhhT+4dIbCW+WjZim9AKk4UZMnnCEuAAAAAElFTkSuQmCC');"
"background-size: 95px 16px;}}"
// messages from firmware / server
".msg{padding:16px;margin:12px 0;border-radius:var(--wm-radius-sm);border:1px solid var(--wm-border);"
"border-left-width:4px;border-left-color:var(--wm-muted);background:var(--wm-surface);text-align:left}"
".msg h4{margin:0 0 8px;font-size:1rem}"
".msg.P{border-left-color:var(--wm-brand)}.msg.P h4{color:var(--wm-brand)}"
".msg.D{border-left-color:var(--wm-danger)}.msg.D h4{color:var(--wm-danger)}"
".msg.S{border-left-color:var(--wm-success)}.msg.S h4{color:var(--wm-success)}"
"dt{font-weight:700;font-size:.85rem;color:var(--wm-muted)}dd{margin:2px 0 12px 0;padding:0;font-size:.95rem}"
"td{vertical-align:top}"
".h{display:none}"
/* Info page key-value grid */
".wm-kv{margin:0;padding:0}"
".wm-kv dt{padding-top:10px}"
".wm-kv dt:first-of-type{padding-top:0}"
".wm-kv dd{margin-left:0;padding-bottom:4px;border-bottom:1px solid var(--wm-border)}"
".wm-kv dd:last-of-type{border-bottom:0}"
/* Feedback areas */
"#wm-wifi-msg,#wm-param-msg{font-size:.9rem;margin-top:12px;min-height:1.2em;color:var(--wm-muted)}"
"#wm-ota-log{font-size:.8rem;background:var(--wm-bg);padding:12px;border-radius:var(--wm-radius-sm);"
"border:1px solid var(--wm-border);overflow:auto;max-height:160px}"
// invert legacy body
"body.invert{background-color:var(--wm-bg)}"
"body.invert .msg{border-color:var(--wm-border)}"
"body.invert .q[role=img]{-webkit-filter:invert(1);filter:invert(1)}"
":disabled{opacity:.55}"
// toast + modal
".wm-toast{position:fixed;left:50%;top:12px;transform:translateX(-50%);z-index:10001;max-width:92%;padding:12px 16px;border-radius:var(--wm-radius-sm);"
"box-shadow:var(--wm-shadow);font-size:.95rem;text-align:center;font-weight:600}"
".wm-toast.ok{background:rgba(22,163,74,.15);border:1px solid var(--wm-success);color:var(--wm-text)}"
".wm-toast.err{background:rgba(220,38,38,.12);border:1px solid var(--wm-danger);color:var(--wm-text)}"
".wm-dialog{position:fixed;inset:0;z-index:10000;display:none;align-items:center;justify-content:center;padding:16px;box-sizing:border-box}"
".wm-dialog-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.5)}"
".wm-dialog-panel{position:relative;z-index:1;background:var(--wm-surface);border-radius:var(--wm-radius);padding:20px 18px;max-width:400px;width:100%;"
"box-shadow:var(--wm-shadow);border:1px solid var(--wm-border);text-align:left}"
".wm-dialog-msg{margin:0 0 16px;line-height:1.45;color:var(--wm-text)}"
".wm-dialog-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}"
".wm-dialog-actions .wm-btn{min-width:108px}"
".wm-dialog-ok,.wm-btn.wm-dialog-ok{background:var(--wm-brand)!important;color:#fff!important}"
".wm-dialog-ok:hover{background:var(--wm-brand-hover)!important}"
"body.invert .wm-toast.ok{background:rgba(22,163,74,.2)}"
"body.invert .wm-toast.err{background:rgba(220,38,38,.2)}"
"</style>";
#endif // _CSS_TEMPLATES_H_
@@ -0,0 +1,800 @@
/**
* PortalAppJS.h
*
* @author alexhopeoconnor
* @license MIT
*
* Embedded SPA for WiFiManager config portal (hash routing + JSON APIs).
*/
#ifndef _WM_PORTAL_APP_JS_H_
#define _WM_PORTAL_APP_JS_H_
#include <Arduino.h>
const char PORTAL_APP_JS[] PROGMEM = R"rawliteral(
(function(){
'use strict';
var boot={};
try{var el=document.getElementById('wm-bootstrap');if(el&&el.textContent)boot=JSON.parse(el.textContent);}catch(e){boot={};}
// --- Core / DOM ---
function $(id){return document.getElementById(id);}
function esc(t){if(!t)return'';return String(t).replace(/[&<>"']/g,function(c){return({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]);});}
// --- Toast / dialog ---
var _wmToastTimer=null;
var _wmPortalTimeoutTimer=null;
function showToast(msg,isErr){
var el=$('wm-toast');
if(!el)return;
el.textContent=msg||'';
el.className='wm-toast '+(isErr?'err':'ok');
el.style.display='block';
if(_wmToastTimer)clearTimeout(_wmToastTimer);
_wmToastTimer=setTimeout(function(){el.style.display='none';el.textContent='';},4500);
}
function showConfirm(msg,onOk){
var dlg=$('wm-dialog'),dmsg=$('wm-dialog-msg'),bk=$('wm-dialog-backdrop'),ok=$('wm-dialog-ok'),cancel=$('wm-dialog-cancel');
if(!dlg||!dmsg||!ok||!cancel){if(onOk)onOk();return;}
dmsg.textContent=msg||'';
dlg.style.display='flex';
dlg.setAttribute('aria-hidden','false');
function hide(){
dlg.style.display='none';
dlg.setAttribute('aria-hidden','true');
ok.onclick=null;
cancel.onclick=null;
if(bk)bk.onclick=null;
}
function onCancel(){hide();}
cancel.onclick=onCancel;
if(bk)bk.onclick=onCancel;
ok.onclick=function(){hide();if(onOk)onOk();};
}
function bindPortalChromeEvents(){
var back=$('wm-nav-back');
if(back){
back.addEventListener('click', function(ev){ ev.preventDefault(); history.back(); });
}
var r=$('wm-restart-btn'), e=$('wm-exit-btn'), c=$('wm-close-captive-btn'), er=$('wm-erase-btn');
if(r && window.portalRestart) r.addEventListener('click', window.portalRestart);
if(e && window.portalExit) e.addEventListener('click', window.portalExit);
if(c && window.portalCloseCaptive) c.addEventListener('click', window.portalCloseCaptive);
if(er && window.portalErase) er.addEventListener('click', window.portalErase);
}
function bindFormSubmitHandlers(){
var wf=$('wm-wifi-form'), pf=$('wm-param-form'), of=$('wm-ota-form');
if(wf && window.portalWifiSave) wf.addEventListener('submit', window.portalWifiSave);
if(pf && window.portalParamSave) pf.addEventListener('submit', window.portalParamSave);
if(of && window.portalOtaSubmit) of.addEventListener('submit', window.portalOtaSubmit);
}
// --- View shell ---
function stopPortalTimeoutCountdown(){
if(_wmPortalTimeoutTimer){
clearInterval(_wmPortalTimeoutTimer);
_wmPortalTimeoutTimer=null;
}
}
function setView(html){
var a=$('app');
if(!a)return;
stopPortalTimeoutCountdown();
stopWifiScanPolling();
stopWifiConnectPolling();
a.innerHTML="<div class='wm-layout'>"+html+"</div>";
bindPortalChromeEvents();
bindFormSubmitHandlers();
}
function formatDurationSeconds(totalSeconds){
totalSeconds=Math.max(0,Math.floor(totalSeconds||0));
var hours=Math.floor(totalSeconds/3600);
var minutes=Math.floor((totalSeconds%3600)/60);
var seconds=totalSeconds%60;
if(hours>0){
return hours+":"+String(minutes).padStart(2,'0')+":"+String(seconds).padStart(2,'0');
}
return minutes+":"+String(seconds).padStart(2,'0');
}
function startPortalTimeoutCountdown(initialSeconds){
var el=$('wm-portal-timeout');
var remaining=Math.max(0,Math.floor(initialSeconds||0));
if(!el||remaining<=0)return;
function levelClass(seconds){
if(seconds<10)return'wm-status--danger';
if(seconds<30)return'wm-status--caution';
if(seconds<60)return'wm-status--warning';
return'';
}
function render(){
if(!el)return;
el.className='wm-status'+(levelClass(remaining)?' '+levelClass(remaining):'');
el.textContent='Captive portal timeout: '+formatDurationSeconds(remaining);
}
render();
_wmPortalTimeoutTimer=setInterval(function(){
remaining=Math.max(0,remaining-1);
render();
if(remaining<=0)stopPortalTimeoutCountdown();
},1000);
}
// --- Field render (WiFi / params meta) ---
function renderStandardField(f){
var id=f.id||f.name||'';
var nm=f.name||f.id||'';
var domId=(id==='s')?'wm-s':(id==='p')?'wm-p':('wm-f-'+id);
var t=f.type||'text';
var h='<div class="wm-field">';
h+='<label for="'+domId+'">'+esc(f.label||'')+'</label>';
h+='<input id="'+domId+'" name="'+esc(nm)+'" type="'+esc(t)+'"';
if(f.maxlength)h+=' maxlength="'+f.maxlength+'"';
if(f.value!==undefined&&f.value!==null)h+=' value="'+esc(f.value)+'"';
if(f.placeholder)h+=' placeholder="'+esc(f.placeholder)+'"';
if(f.customAttrs)h+=' '+f.customAttrs;
h+='/>';
h+='</div>';
return h;
}
function renderMetaField(f){
if(!f)return'';
if(f.kind==='html')return f.html||'';
if(f.kind==='field' || !f.kind)return renderStandardField(f);
return '';
}
function renderFieldList(arr){
if(!arr||!arr.length)return'';
var h='',i;
for(i=0;i<arr.length;i++)h+=renderMetaField(arr[i]);
return h;
}
function iconSvg(name){
var body='';
switch(name){
case 'home':
body="<path d='M3 10.5 12 3l9 7.5'/><path d='M5 9.5V20h14V9.5'/>";
break;
case 'wifi':
body="<path d='M4.5 9.5a12 12 0 0 1 15 0'/><path d='M7.5 12.5a7.5 7.5 0 0 1 9 0'/><path d='M10.5 15.5a3.5 3.5 0 0 1 3 0'/><circle cx='12' cy='19' r='1.2' fill='currentColor' stroke='none'/>";
break;
case 'setup':
body="<line x1='5' y1='6' x2='19' y2='6'/><circle cx='9' cy='6' r='2'/><line x1='5' y1='12' x2='19' y2='12'/><circle cx='15' cy='12' r='2'/><line x1='5' y1='18' x2='19' y2='18'/><circle cx='11' cy='18' r='2'/>";
break;
case 'info':
body="<circle cx='12' cy='12' r='9'/><line x1='12' y1='10.5' x2='12' y2='16.5'/><circle cx='12' cy='7.2' r='1' fill='currentColor' stroke='none'/>";
break;
case 'update':
body="<path d='M12 4v10'/><path d='m8.5 10.5 3.5 3.5 3.5-3.5'/><path d='M5 19h14'/>";
break;
case 'back':
body="<path d='M10 6 4 12l6 6'/><path d='M4 12h16'/>";
break;
case 'restart':
body="<path d='M20 12a8 8 0 1 1-2.3-5.7'/><path d='M20 4v5h-5'/>";
break;
case 'exit':
body="<path d='M10 6H6v12h4'/><path d='M14 8l4 4-4 4'/><path d='M9 12h9'/>";
break;
case 'close':
body="<path d='M4 12a8 8 0 1 0 16 0A8 8 0 1 0 4 12'/><path d='m8.5 8.5 7 7'/>";
break;
case 'erase':
body="<path d='M5 7h14'/><path d='M9 7V5h6v2'/><path d='M8 7l1 12h6l1-12'/><path d='M10 10v6'/><path d='M14 10v6'/>";
break;
case 'status':
body="<circle cx='12' cy='12' r='9'/><path d='M12 7v5l3 2'/>";
break;
case 'device':
body="<rect x='7' y='7' width='10' height='10' rx='1.5'/><path d='M9 1v4M15 1v4M9 19v4M15 19v4M1 9h4M1 15h4M19 9h4M19 15h4'/>";
break;
case 'diagnostics':
body="<path d='M4 17h3l2-5 3 3 2-7 2 9h4'/>";
break;
case 'about':
body="<circle cx='12' cy='12' r='9'/><path d='M12 10.5v5.5'/><circle cx='12' cy='7.2' r='1' fill='currentColor' stroke='none'/>";
break;
case 'actions':
body="<path d='M12 3v18'/><path d='M3 12h18'/><path d='m6.5 6.5 11 11'/><path d='m17.5 6.5-11 11'/>";
break;
case 'scan':
body="<path d='M4 7h16'/><path d='M4 12h10'/><path d='M4 17h7'/><path d='m16 15 4 4'/><circle cx='14' cy='13' r='4'/>";
break;
case 'save':
body="<path d='M5 4h11l3 3v13H5z'/><path d='M8 4v5h8'/><path d='M9 19v-5h6v5'/>";
break;
case 'connect':
body="<path d='M4.5 12a7.5 7.5 0 0 1 7.5-7.5'/><path d='m17 6 2 2-2 2'/><path d='M12 4.5H19'/>";
break;
case 'upload':
body="<path d='M12 20V8'/><path d='m8.5 11.5 3.5-3.5 3.5 3.5'/><path d='M5 20h14'/>";
break;
}
if(!body)return'';
return "<span class='wm-icon wm-icon--"+name+"' aria-hidden='true'><svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'>"+body+"</svg></span>";
}
function labelWithIcon(name,label){
return "<span class='wm-icon-label'>"+iconSvg(name)+"<span>"+esc(label||'')+"</span></span>";
}
function cardTitleHtml(name,title){
return "<h2 class='wm-card-title'>"+labelWithIcon(name,title)+"</h2>";
}
function sectionCardHtml(name,title,subtitle,rows){
if(!rows||!rows.length)return'';
var h="<div class='wm-card'>"+cardTitleHtml(name,title);
if(subtitle)h+="<p class='wm-card-subtitle'>"+esc(subtitle)+"</p>";
h+="<dl class='wm-kv'>";
for(var i=0;i<rows.length;i++){
h+="<dt>"+esc(rows[i].label)+"</dt><dd>"+rows[i].value+"</dd>";
}
h+="</dl></div>";
return h;
}
function rowsWithoutKeys(rows,blocked){
if(!rows||!rows.length)return[];
var out=[],i,row,key;
for(i=0;i<rows.length;i++){
row=rows[i];
if(!row)continue;
key=row.key||'';
if(blocked.indexOf(key)!==-1)continue;
out.push(row);
}
return out;
}
function navBar(active){
active=active||'home';
var pages=boot.pages||{};
var layout=boot.layout||{};
var actions=boot.actions||{};
var pinWifi=(layout.paramsLocation||'wifi')==='wifi';
var ps=pages.setup||{};
var pi=pages.info||{};
var pu=pages.update||{};
var h="<nav class='wm-nav' aria-label='Configuration'>";
h+="<a class='wm-nav-link"+(active==='home'?' wm-nav-link--active':'')+"' href='#/'>"+labelWithIcon('home','Home')+"</a>";
h+="<a class='wm-nav-link"+(active==='wifi'?' wm-nav-link--active':'')+"' href='#/wifi'>"+labelWithIcon('wifi','WiFi')+"</a>";
if(!pinWifi && ps.visible!==false){h+="<a class='wm-nav-link"+(active==='setup'?' wm-nav-link--active':'')+"' href='#/setup'>"+labelWithIcon('setup','Setup')+"</a>";}
if(pi.visible!==false){h+="<a class='wm-nav-link"+(active==='info'?' wm-nav-link--active':'')+"' href='#/info'>"+labelWithIcon('info','Info')+"</a>";}
if(pu.visible){h+="<a class='wm-nav-link"+(active==='update'?' wm-nav-link--active':'')+"' href='#/update'>"+labelWithIcon('update','Update')+"</a>";}
if(actions.back&&actions.back.visible){h+="<a href='#' class='wm-nav-link' id='wm-nav-back'>"+labelWithIcon('back','Back')+"</a>";}
h+="</nav>";
return h;
}
function deviceActionsHtml(){
var actions=boot.actions||{};
var h='', ok=false;
if(actions.restart&&actions.restart.visible){h+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-restart-btn'>"+labelWithIcon('restart','Restart device')+"</button>";ok=true;}
if(actions.exitPortal&&actions.exitPortal.visible){h+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-exit-btn'>"+labelWithIcon('exit','Exit portal')+"</button>";ok=true;}
if(actions.closeCaptive&&actions.closeCaptive.visible){h+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-close-captive-btn'>"+labelWithIcon('close','Stop captive portal')+"</button>";ok=true;}
if(!ok)return'';
return "<div class='wm-card'>"+cardTitleHtml('device','Device')+"<p class='wm-card-subtitle'>Quick device-level actions while the portal is open.</p><div class='wm-btn-group'>"+h+"</div></div>";
}
function renderExtraHomeCards(cards){
if(!cards||!cards.length)return'';
var out='',i,c,j,k,cls;
for(i=0;i<cards.length;i++){
c=cards[i];
if(!c)continue;
out+="<div class='wm-card'>";
if(c.title){out+="<h2 class='wm-card-title'>"+esc(c.title)+"</h2>";}
if(c.kind==='text'||c.kind==='callout'){
cls=c.kind==='callout'?'wm-callout wm-callout--info':'wm-lead';
out+="<p class='"+cls+"'>"+esc(c.text||'')+"</p>";
}else{
out+="<dl class='wm-kv'>";
if(c.items){for(j=0;j<c.items.length;j++){k=c.items[j];out+="<dt>"+esc(k.label)+"</dt><dd>"+esc(k.value)+"</dd>";}}
out+="</dl>";
}
out+="</div>";
}
return out;
}
function viewHome(){
var brand=boot.brand||{};
var ctx=boot.context||{};
var t=esc(brand.title||'WiFiManager');
var ident=ctx.identityText?esc(ctx.identityText):'';
var summary=ctx.statusSummary||'';
var timeoutSeconds=ctx.portalTimeoutSecondsRemaining||0;
var html=navBar('home');
html+="<header class='wm-hero'>";
if(brand.logoSvg){html+="<div class='wm-brand-logo'>"+brand.logoSvg+"</div>";}
html+="<h1 class='wm-hero-title'>"+t+"</h1>";
if(ident){html+="<p class='wm-hero-sub'>"+ident+"</p>";}
if(brand.homeIntro){html+="<p class='wm-hero-intro'>"+esc(brand.homeIntro)+"</p>";}
html+="</header>";
html+="<div class='wm-card'>"+cardTitleHtml('status','Status');
if(summary){html+="<p class='wm-home-summary'>"+esc(summary)+"</p>";}
if(timeoutSeconds>0){html+="<p class='wm-status' id='wm-portal-timeout'></p>";}
html+="<p class='wm-lead'>Use <strong>WiFi</strong> to scan networks and connect. Open <strong>Info</strong> for addresses and firmware actions.</p>";
html+="</div>";
html+=renderExtraHomeCards(boot.extraHomeCards||[]);
html+=deviceActionsHtml();
setView(html);
if(timeoutSeconds>0)startPortalTimeoutCountdown(timeoutSeconds);
}
// --- HTTP ---
function api(path, opt){
opt=opt||{};
return fetch(path,{method:opt.method||'GET',headers:opt.headers,body:opt.body,credentials:'same-origin'})
.then(function(r){return r.text().then(function(t){return {ok:r.ok,status:r.status,body:t};});});
}
// --- WiFi scan view ---
var _wmWifiScanPollTimer=null;
var _wmWifiScanPollToken=0;
function getScanResultsBox(){
return $('wm-scan-results');
}
function setScanRefreshEnabled(enabled){
var btn=$('wm-refresh-scan');
if(btn)btn.disabled=(enabled===false);
}
function stopWifiScanPolling(){
_wmWifiScanPollToken++;
if(_wmWifiScanPollTimer){
clearTimeout(_wmWifiScanPollTimer);
_wmWifiScanPollTimer=null;
}
setScanRefreshEnabled(true);
}
function startWifiScanPolling(box){
stopWifiScanPolling();
setScanRefreshEnabled(false);
var token=++_wmWifiScanPollToken;
function poll(){
api('/api/wifi/scan-status').then(function(res){
if(token!==_wmWifiScanPollToken)return;
var d={};
try{d=JSON.parse(res.body);}catch(e){return;}
box=getScanResultsBox()||box;
if(box)box.innerHTML=renderScanList(d);
if(!d.scanning){
stopWifiScanPolling();
return;
}
_wmWifiScanPollTimer=setTimeout(poll,800);
}).catch(function(){
if(token!==_wmWifiScanPollToken)return;
stopWifiScanPolling();
box=getScanResultsBox()||box;
if(box)box.innerHTML=renderScanError('Portal became unreachable while scanning.');
});
}
poll();
}
function renderScanList(data){
if(!data||data.scanning){
return "<div class='wm-scan-list'><p class='wm-lead' style='margin:0;padding:14px 12px'>Scanning for networks…</p></div>";
}
if(data.error==='timeout'){
return "<div class='wm-scan-list'><p class='wm-lead' style='margin:0;padding:14px 12px'>Scan timed out. Try Scan again.</p></div>";
}
if(data.error==='failed'){
return "<div class='wm-scan-list'><p class='wm-lead' style='margin:0;padding:14px 12px'>Scan failed.</p></div>";
}
if(!data.networks||data.count===0){
return "<div class='wm-scan-list'><p class='wm-lead' style='margin:0;padding:14px 12px'>No networks found.</p></div>";
}
var html="<div class='wm-scan-list'>",i,n,pct,qi,enc;
for(i=0;i<data.networks.length;i++){
n=data.networks[i];
pct=(n.quality||0)+'%';
qi=Math.round((n.quality/100)*3)+1;if(qi<1)qi=1;if(qi>4)qi=4;
html+="<a class='wm-scan-row' href='#p' data-ssid='"+esc(n.ssid)+"'>";
html+="<span class='wm-scan-ssid'>"+esc(n.ssid)+"</span>";
html+="<span class='wm-scan-meta'>";
if(n.encrypted){html+="<span class='wm-scan-lock q l' aria-hidden='true'></span>";}
html+="<span role='img' aria-label='"+pct+"' title='"+pct+"' class='wm-scan-bars q q-"+qi+"'></span>";
html+="<span class='wm-scan-signal'>"+pct+"</span>";
html+="</span>";
html+="</a>";
}
html+="</div>";
return html;
}
function renderScanError(msg){
return "<div class='wm-scan-list'><p class='wm-lead' style='margin:0;padding:14px 12px'>"+esc(msg||'Failed to reach portal while scanning.')+"</p></div>";
}
function shouldAutoStartWifiScan(data){
if(!data)return true;
if(data.scanning)return false;
if((data.lastscan||0)>0)return false;
if(data.results_valid)return false;
if(data.error==='timeout' || data.error==='failed')return false;
return true;
}
function wifiRefresh(){
var box=getScanResultsBox();
if(!box)return;
setScanRefreshEnabled(false);
box.innerHTML="<div class='wm-scan-list'><p class='wm-lead' style='margin:0;padding:14px 12px'>Starting scan…</p></div>";
api('/api/wifi/scan',{method:'POST'}).then(function(res){
box=getScanResultsBox()||box;
if(!res.ok){
setScanRefreshEnabled(true);
if(box)box.innerHTML=renderScanError('Failed to start WiFi scan.');
showToast('Failed to start WiFi scan.',true);
return;
}
startWifiScanPolling(box);
}).catch(function(){
stopWifiScanPolling();
box=getScanResultsBox()||box;
if(box)box.innerHTML=renderScanError('Failed to reach portal while starting scan.');
showToast('Failed to reach portal while starting scan.',true);
});
}
function bindWifiViewEvents(){
var refreshBtn=$('wm-refresh-scan');
if(refreshBtn){
refreshBtn.addEventListener('click', wifiRefresh);
}
var showPass=$('wm-showpass');
if(showPass){
showPass.addEventListener('change', function(){
var p=$('wm-p');
if(p)p.type=this.checked?'text':'password';
});
}
var scanResults=$('wm-scan-results');
if(scanResults){
scanResults.addEventListener('click', function(ev){
var el=ev.target;
while(el && el !== scanResults){
if(el.tagName==='A' && el.getAttribute('data-ssid')){
ev.preventDefault();
var inp=$('wm-s');
var pass=$('wm-p');
if(inp)inp.value=el.getAttribute('data-ssid')||'';
if(pass){
if(pass.scrollIntoView)pass.scrollIntoView({behavior:'smooth',block:'center'});
if(pass.focus)pass.focus();
}else if(inp){
if(inp.scrollIntoView)inp.scrollIntoView({behavior:'smooth',block:'center'});
if(inp.focus)inp.focus();
}
return;
}
el=el.parentElement;
}
});
}
}
function viewWifi(){
setView(navBar('wifi')+"<div class='wm-card'><p class='wm-lead'>Loading WiFi options…</p></div>");
api('/api/wifi/meta').then(function(res){
try{var m=JSON.parse(res.body);}catch(e){m={};}
var html=navBar('wifi');
html+="<div class='wm-page-head'><h1>WiFi</h1><p class='wm-page-desc'>Pick a network below, confirm SSID and password, then connect.</p></div>";
html+="<div class='wm-card'>"+cardTitleHtml('scan','Networks nearby');
html+="<div id='wm-scan-results'></div>";
html+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-refresh-scan'>"+labelWithIcon('scan','Scan again')+"</button></div>";
html+="<div class='wm-card'>"+cardTitleHtml('wifi','Network details');
html+="<form id='wm-wifi-form'>";
html+=renderFieldList(m.wifiFields||[]);
var wf=m.wifiFields||[];
var hasPass=false;
var i;
for(i=0;i<wf.length;i++){if(wf[i]&&wf[i].id==='p'){hasPass=true;break;}}
if(hasPass){
html+="<div class='wm-checkbox-row'><input type='checkbox' id='wm-showpass'/> <label for='wm-showpass'>Show password</label></div>";
}
html+=renderFieldList(m.staticFields||[]);
html+=renderFieldList(m.params||[]);
html+="<div class='wm-form-actions'><button type='submit' class='wm-btn wm-btn--primary wm-btn--block'>"+labelWithIcon('connect','Save and connect')+"</button></div></form>";
html+="<div id='wm-wifi-msg'></div></div>";
setView(html);
bindWifiViewEvents();
setScanRefreshEnabled(true);
api('/api/wifi/scan-status').then(function(r2){
try{var d=JSON.parse(r2.body);}catch(e){d={};}
var box=getScanResultsBox();
if(shouldAutoStartWifiScan(d)){
wifiRefresh();
return;
}
if(box)box.innerHTML=renderScanList(d);
if(d&&d.scanning){startWifiScanPolling(box);}
}).catch(function(){
var box=getScanResultsBox();
if(box)box.innerHTML=renderScanError('Failed to reach portal while loading scan status.');
setScanRefreshEnabled(true);
});
}).catch(function(){
setView(navBar('wifi')+"<div class='wm-card'><p class='wm-lead'>Failed to load WiFi options. Reconnect to the portal and try again.</p></div>");
});
}
// --- WiFi connect polling ---
var _wmWifiConnectPollTimer=null;
var _wmWifiConnectPollToken=0;
var _wmWifiConnectPending=false;
function stopWifiConnectPolling(){
_wmWifiConnectPollToken++;
if(_wmWifiConnectPollTimer){
clearTimeout(_wmWifiConnectPollTimer);
_wmWifiConnectPollTimer=null;
}
}
function pollWifiConnectStatus(){
stopWifiConnectPolling();
var token=++_wmWifiConnectPollToken;
function poll(){
api('/api/wifi/connect-status').then(function(res){
if(token!==_wmWifiConnectPollToken)return;
var j={};
var msg=$('wm-wifi-msg');
try{j=JSON.parse(res.body);}catch(e){}
if(msg&&j.message){
msg.innerHTML=esc(j.message);
}
if(j.state==='success'){
stopWifiConnectPolling();
_wmWifiConnectPending=false;
if(msg && j.stationIp){
msg.innerHTML="Connected to WiFi. Redirecting to <a href='"+esc(j.redirectUrl||("http://"+j.stationIp+"/"))+"'>"+esc(j.stationIp)+"</a>…";
}
showToast(j.message||'WiFi connected',false);
if(j.redirectUrl){
setTimeout(function(){ window.location.href=j.redirectUrl; }, 1400);
}else{
location.hash='#/';
}
}else if(j.state==='failed'){
stopWifiConnectPolling();
_wmWifiConnectPending=false;
showToast(j.message||'WiFi connect failed',true);
}else{
_wmWifiConnectPollTimer=setTimeout(poll,700);
}
}).catch(function(){
if(token!==_wmWifiConnectPollToken)return;
stopWifiConnectPolling();
var msg=$('wm-wifi-msg');
if(msg){
msg.innerHTML=_wmWifiConnectPending
? 'Portal became unreachable after saving. If the device joined your WiFi network, reconnect to it there.'
: 'Portal became unreachable while checking connection status.';
}
_wmWifiConnectPending=false;
});
}
poll();
}
window.portalWifiSave=function(ev){
ev.preventDefault();
var fd=new FormData(document.getElementById('wm-wifi-form'));
var msg=$('wm-wifi-msg');
if(msg)msg.innerHTML='Submitting...';
api('/api/wifi/save',{method:'POST',body:fd}).then(function(res){
var j={};
try{j=JSON.parse(res.body);}catch(e){}
if(msg){
msg.innerHTML=(j&&j.message)?esc(j.message):(res.ok?'Queued.':'Error');
}
if(res.status===202){
_wmWifiConnectPending=true;
pollWifiConnectStatus();
}
});
return false;
};
// --- Info view ---
function viewInfo(){
setView(navBar('info')+"<div class='wm-card'><p class='wm-lead'>Loading device info…</p></div>");
api('/api/info').then(function(res){
try{var d=JSON.parse(res.body);}catch(e){d={};}
var html=navBar('info');
html+="<div class='wm-page-head'><h1>Device info</h1><p class='wm-page-desc'>Connection status, hardware, and actions.</p></div>";
var st=d.status;
if(st && typeof st==='object' && !Array.isArray(st)){
html+="<div class='wm-card'>"+cardTitleHtml('status','Status');
if(st.summary){html+="<p class='wm-callout wm-callout--info wm-info-summary'>"+esc(st.summary)+"</p>";}
html+="<dl class='wm-kv'>";
html+="<dt>Connected</dt><dd>"+esc(st.connected?'Yes':'No')+"</dd>";
if(st.ssid!==undefined && st.ssid!=='')html+="<dt>SSID</dt><dd>"+esc(st.ssid)+"</dd>";
if(st.stationIp)html+="<dt>Station IP</dt><dd>"+esc(st.stationIp)+"</dd>";
if(st.apIp)html+="<dt>Portal IP</dt><dd>"+esc(st.apIp)+"</dd>";
html+="</dl></div>";
} else {
html+=sectionCardHtml('status','Status','Connection summary and main addresses.',d.status||[]);
}
html+=sectionCardHtml('device','Device','Runtime, memory, and hardware details.',d.device||[]);
html+=sectionCardHtml('diagnostics','WiFi details','Network diagnostics and interface metadata.',rowsWithoutKeys(d.wifi||[],['conx','stassid','staip','apip']));
html+=sectionCardHtml('about','About','Library, SDK, and build information.',d.about||[]);
if(d.extraSections){
var xi,zs,zrows,zi,it;
for(xi=0;xi<d.extraSections.length;xi++){
zs=d.extraSections[xi];
zrows=[];
if(zs.items){for(zi=0;zi<zs.items.length;zi++){it=zs.items[zi];zrows.push({label:it.label,value:esc(it.value)});}}
html+=sectionCardHtml('info',zs.title||'Details','',zrows);
}
}
var act=d.actions||{};
var actionsHtml='', hasActions=false;
if(act.showRestart){actionsHtml+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-restart-btn'>"+labelWithIcon('restart','Restart device')+"</button>";hasActions=true;}
if(act.showExitPortal){actionsHtml+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-exit-btn'>"+labelWithIcon('exit','Exit portal')+"</button>";hasActions=true;}
if(act.showCloseCaptive){actionsHtml+="<button type='button' class='wm-btn wm-btn--secondary wm-btn--block' id='wm-close-captive-btn'>"+labelWithIcon('close','Stop captive portal')+"</button>";hasActions=true;}
if(act.showUpdate){actionsHtml+="<a class='wm-btn wm-btn--secondary wm-btn--block' href='#/update'>"+labelWithIcon('update','Firmware update')+"</a>";hasActions=true;}
if(act.showErase){actionsHtml+="<button type='button' class='wm-btn wm-btn--danger wm-btn--block' id='wm-erase-btn'>"+labelWithIcon('erase','Erase WiFi config')+"</button>";hasActions=true;}
if(hasActions){
html+="<div class='wm-card'>"+cardTitleHtml('actions','Actions')+"<p class='wm-card-subtitle'>Maintenance and recovery actions for this device.</p><div class='wm-btn-group'>"+actionsHtml+"</div></div>";
}
setView(html);
});
}
function portalConfirmPost(url, promptMsg){
showConfirm(promptMsg||'Continue?',function(){
api(url,{method:'POST'}).then(function(res){
try{var j=JSON.parse(res.body);}catch(e){j={};}
var m=(j&&j.message)?j.message:(res.ok?'OK':'Error');
showToast(m,!res.ok);
});
});
}
window.portalRestart=function(){portalConfirmPost('/api/device/restart','Restart the device?');};
window.portalExit=function(){portalConfirmPost('/api/portal/exit','Exit the configuration portal?');};
window.portalCloseCaptive=function(){portalConfirmPost('/api/portal/close','Stop redirecting clients to this portal (captive detection off)?');};
window.portalErase=function(){
showConfirm('Erase WiFi configuration?',function(){
api('/api/device/erase',{method:'POST'}).then(function(res){
try{var j=JSON.parse(res.body);}catch(e){j={};}
showToast((j&&j.message)?j.message:(res.ok?'Done':'Error'),!res.ok);
});
});
};
// --- Params / OTA ---
function viewSetup(){
setView(navBar('setup')+"<div class='wm-card'><p class='wm-lead'>Loading parameters…</p></div>");
api('/api/params').then(function(res){
try{var d=JSON.parse(res.body);}catch(e){d={};}
var html=navBar('setup');
html+="<div class='wm-page-head'><h1>Setup</h1><p class='wm-page-desc'>Custom parameters stored on this device.</p></div>";
html+="<div class='wm-card'><form id='wm-param-form'>";
html+=renderFieldList(d.params||[]);
html+="<div class='wm-form-actions'><button type='submit' class='wm-btn wm-btn--primary wm-btn--block'>"+labelWithIcon('save','Save parameters')+"</button></div>";
html+="</form><div id='wm-param-msg'></div></div>";
setView(html);
});
}
window.portalParamSave=function(ev){
ev.preventDefault();
var fd=new FormData(document.getElementById('wm-param-form'));
var msg=$('wm-param-msg');
if(msg)msg.innerHTML='Saving...';
api('/api/params/save',{method:'POST',body:fd}).then(function(res){
try{var j=JSON.parse(res.body);}catch(e){j={};}
if(msg)msg.innerHTML=(j&&j.message)?esc(j.message):'Saved.';
});
return false;
};
function viewUpdate(){
var pages=boot.pages||{};
var pupd=pages.update||{};
var html=navBar('update');
html+="<div class='wm-page-head'><h1>Firmware update</h1><p class='wm-page-desc'>Flash a new firmware build (.bin). The device reboots when done.</p></div>";
if(!pupd.visible){
html+="<div class='wm-card'><p class='wm-lead'>Firmware update is disabled for this configuration.</p></div>";
setView(html);
return;
}
html+="<div class='wm-card'><form id='wm-ota-form'>";
html+="<div class='wm-field'><label for='wm-ota-file'>Firmware file</label>";
html+="<input type='file' id='wm-ota-file' name='update' accept='.bin,.bin.gz'/></div>";
html+="<div class='wm-form-actions'><button type='submit' class='wm-btn wm-btn--primary wm-btn--block'>"+labelWithIcon('upload','Upload firmware')+"</button></div>";
html+="</form>";
html+="<p class='wm-lead' style='margin-top:14px;margin-bottom:8px'>Choose the correct binary for this chip. Upload progress appears below.</p>";
html+="<pre id='wm-ota-log'></pre></div>";
setView(html);
}
window.portalOtaSubmit=function(ev){
ev.preventDefault();
var fi=$('wm-ota-file');
var logEl=$('wm-ota-log');
if(!fi||!fi.files||!fi.files[0]){
if(logEl)logEl.textContent='Choose a firmware file first.';
return false;
}
if(logEl)logEl.textContent='Uploading…';
var xhr=new XMLHttpRequest();
xhr.upload.onprogress=function(e){
if(!logEl||!e.lengthComputable)return;
logEl.textContent='Uploading… '+Math.round(100*e.loaded/e.total)+'%';
};
xhr.onreadystatechange=function(){
if(xhr.readyState!==4)return;
var t=xhr.responseText||'';
if(logEl)logEl.textContent=t;
var httpOk=xhr.status>=200&&xhr.status<300;
try{
var j=JSON.parse(t);
if(j&&j.message){
if(logEl)logEl.textContent=j.message;
showToast(j.message,j.ok===false);
return;
}
}catch(e){}
showToast(httpOk?'Upload finished.':('HTTP '+xhr.status),!httpOk);
};
xhr.open('POST','/u');
var fd=new FormData();
fd.append('update',fi.files[0]);
xhr.send(fd);
return false;
};
// --- Routing ---
function route(){
var h=location.hash||'#/';
if(h.indexOf('#/')!==0)h='#/';
var pages=boot.pages||{};
var ps=pages.setup||{};
var pi=pages.info||{};
var pu=pages.update||{};
if(h==='#/setup'&&ps.visible===false){viewHome();try{document.dispatchEvent(new CustomEvent('wm:view-changed',{detail:{route:'#/'}}));}catch(e){}return;}
if(h==='#/info'&&pi.visible===false){viewHome();try{document.dispatchEvent(new CustomEvent('wm:view-changed',{detail:{route:'#/'}}));}catch(e){}return;}
if(h==='#/update'&&pu.visible===false){viewHome();try{document.dispatchEvent(new CustomEvent('wm:view-changed',{detail:{route:'#/'}}));}catch(e){}return;}
if(h==='#/'||h==='#'){viewHome();}
else if(h==='#/wifi'){viewWifi();}
else if(h==='#/info'){viewInfo();}
else if(h==='#/setup'){viewSetup();}
else if(h==='#/update'){viewUpdate();}
else {viewHome();h='#/';}
try{document.dispatchEvent(new CustomEvent('wm:view-changed',{detail:{route:h}}));}catch(e){}
}
function bootPortal(){
route();
try{document.dispatchEvent(new CustomEvent('wm:ready',{detail:{boot:boot}}));}catch(e){}
}
window.addEventListener('hashchange',route);
window.addEventListener('load',bootPortal);
})();
)rawliteral";
#endif // _WM_PORTAL_APP_JS_H_
@@ -0,0 +1,50 @@
/**
* RootShell.h
*
* @author alexhopeoconnor
* @license MIT
*
* Single-page portal shell: only HTML document served for GET /.
* Dynamic UI is driven by embedded JS + JSON APIs under /api/...
*
* Placeholder keys (%PAGE_TITLE%, %STYLES%, %BOOTSTRAP_JSON%, %PORTAL_APP_JS%, %PORTAL_APPEND_JS%) are filled
* per request in WiFiManagerHandlers::handleRoot; do not treat placeholders as a customization API.
*/
#ifndef _WM_ROOT_SHELL_TEMPLATE_H_
#define _WM_ROOT_SHELL_TEMPLATE_H_
#include <Arduino.h>
const char WM_ROOT_SHELL_TEMPLATE[] PROGMEM =
"<!DOCTYPE html>"
"<html lang='en'>"
"<head>"
"<meta name='format-detection' content='telephone=no'>"
"<meta charset='UTF-8'/>"
"<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>"
"<title>%PAGE_TITLE%</title>"
"%STYLES%"
"</head>"
"<body class='portal'>"
"<div id='wm-toast' class='wm-toast' aria-live='polite' role='status' style='display:none'></div>"
"<div id='wm-dialog' class='wm-dialog' style='display:none' aria-hidden='true'>"
"<div class='wm-dialog-backdrop' id='wm-dialog-backdrop'></div>"
"<div class='wm-dialog-panel'>"
"<p class='wm-dialog-msg' id='wm-dialog-msg'></p>"
"<div class='wm-dialog-actions'>"
"<button type='button' id='wm-dialog-cancel' class='wm-btn wm-btn--secondary'>Cancel</button>"
"<button type='button' id='wm-dialog-ok' class='wm-btn wm-btn--primary wm-dialog-ok'>OK</button>"
"</div></div></div>"
"<div id='app'></div>"
"<script id='wm-bootstrap' type='application/json'>%BOOTSTRAP_JSON%</script>"
"<script>"
"%PORTAL_APP_JS%"
"</script>"
"<script>"
"%PORTAL_APPEND_JS%"
"</script>"
"</body>"
"</html>";
#endif // _WM_ROOT_SHELL_TEMPLATE_H_
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,111 @@
/**
* WiFiManagerParameter.cpp
*
* @author alexhopeoconnor
* @license MIT
*/
#include "WiFiManagerParameter.h"
#include <cstring>
#include <new>
WiFiManagerParameter::WiFiManagerParameter()
: WiFiManagerParameter("")
{
}
WiFiManagerParameter::WiFiManagerParameter(const char *custom) {
_id = NULL;
_label = NULL;
_length = 0;
_value = nullptr;
_labelPlacement = WFM_LABEL_DEFAULT;
_customHTML = custom;
}
WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label) {
init(id, label, "", 0, "", WFM_LABEL_DEFAULT);
}
WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length) {
init(id, label, defaultValue, length, "", WFM_LABEL_DEFAULT);
}
WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom) {
init(id, label, defaultValue, length, custom, WFM_LABEL_DEFAULT);
}
WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement) {
init(id, label, defaultValue, length, custom, labelPlacement);
}
void WiFiManagerParameter::init(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement) {
_id = id;
_label = label;
_labelPlacement = labelPlacement;
_customHTML = custom;
_length = 0;
_value = nullptr;
setValue(defaultValue,length);
}
WiFiManagerParameter::~WiFiManagerParameter() {
if (_value != NULL) {
delete[] _value;
}
_length=0; // setting length 0, ideally the entire parameter should be removed, or added to wifimanager scope so it follows
}
// WiFiManagerParameter& WiFiManagerParameter::operator=(const WiFiManagerParameter& rhs){
// Serial.println("copy assignment op called");
// (*this->_value) = (*rhs._value);
// return *this;
// }
// @note debug is not available in wmparameter class
void WiFiManagerParameter::setValue(const char *defaultValue, int length) {
if (!_id || length < 0) {
return;
}
if (_length != length || _value == nullptr) {
char* replacement = new (std::nothrow) char[static_cast<size_t>(length) + 1];
if (!replacement) {
return;
}
delete[] _value;
_value = replacement;
_length = length;
}
memset(_value, 0, static_cast<size_t>(_length) + 1);
if (defaultValue != nullptr) {
strncpy(_value, defaultValue, _length);
}
}
const char* WiFiManagerParameter::getValue() const {
// Serial.println(printf("Address of _value is %p\n", (void *)_value));
return _value;
}
const char* WiFiManagerParameter::getID() const {
return _id;
}
const char* WiFiManagerParameter::getPlaceholder() const {
return _label;
}
const char* WiFiManagerParameter::getLabel() const {
return _label;
}
int WiFiManagerParameter::getValueLength() const {
return _length;
}
int WiFiManagerParameter::getLabelPlacement() const {
return _labelPlacement;
}
const char* WiFiManagerParameter::getCustomHTML() const {
return _customHTML;
}
+178
View File
@@ -0,0 +1,178 @@
/**
* WiFiManagerServer.cpp
*
* @author alexhopeoconnor
* @license MIT
*
* HTTP server lifecycle and route registration only. HTML shell rendering is request-scoped in
* WiFiManagerHandlers (WM_ROOT_SHELL_TEMPLATE + per-request placeholder registry).
* Route inventory matches WiFiManagerServer.h (GET /, /api/..., POST /u, onNotFound).
*/
#include "WiFiManagerServer.h"
#include "WiFiManager.h"
#include "WiFiManagerHandlers.h"
#ifdef WM_DFTE_LOGGING
#include "WiFiManagerDfteLogger.h"
#include <DeviceFrameworkTemplateEngineDebug.h>
#endif
#if defined(ESP8266) || defined(ESP32)
WiFiManagerServer::WiFiManagerServer(WiFiManager* wm)
: _wm(wm), _handlers(std::make_unique<WiFiManagerHandlers>(wm)) {}
WiFiManagerServer::~WiFiManagerServer() = default;
void WiFiManagerServer::createServer(uint16_t port) {
if (server) {
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Debug, kWiFiMgrLogSubsystem, F("Server already exists, shutting down first"));
#endif
shutdownServer();
}
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Info, kWiFiMgrLogSubsystem, F("Starting Web Portal"));
#endif
if (port != 80) {
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Debug, kWiFiMgrLogSubsystem, F("http server started with custom port: "), port);
#endif
}
server.reset(new AsyncWebServer(port));
#ifdef WM_DFTE_LOGGING
// DFTE logging is still owned by server lifecycle; it is intentionally independent of
// request-scoped shell rendering / placeholder registration.
if (!deviceFrameworkTemplateEngineIsLoggingEnabled()) {
if (!_dfteLogger) {
_dfteLogger = std::make_unique<WiFiManagerDfteLogger>(_wm);
}
deviceFrameworkTemplateEngineEnableLogging(_dfteLogger.get(), static_cast<const void*>(this));
_wmOwnsDfteLogSink = true;
}
#endif
}
void WiFiManagerServer::registerRoutes() {
if (!server) {
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Error, kWiFiMgrLogSubsystem, F("[ERROR] Server not created, call createServer() first"));
#endif
return;
}
if (_wm->_webservercallback != NULL) {
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Debug, kWiFiMgrLogSubsystem, F("[CB] _webservercallback calling"));
#endif
_wm->_webservercallback();
}
// Shell: only HTML document. JSON + actions + OTA below (no legacy /wifi, /info, … routes).
server->on(WM_G(R_root), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleRoot(request);
});
server->on(WM_G(R_api_bootstrap), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiBootstrap(request);
});
server->on(WM_G(R_api_wifi_scan_status), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiWifiScanStatus(request);
});
server->on(WM_G(R_api_wifi_scan), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiWifiScan(request);
});
server->on(WM_G(R_api_wifi_meta), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiWifiMeta(request);
});
server->on(WM_G(R_api_wifi_save), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiWifiSave(request);
});
server->on(WM_G(R_api_wifi_connect_status), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiWifiConnectStatus(request);
});
server->on(WM_G(R_api_params), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiParamsGet(request);
});
server->on(WM_G(R_api_params_save), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiParamsSave(request);
});
server->on(WM_G(R_api_info), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiInfo(request);
});
server->on(WM_G(R_api_status), HTTP_GET, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiStatus(request);
});
server->on(WM_G(R_api_device_restart), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiDeviceRestart(request);
});
server->on(WM_G(R_api_device_erase), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiDeviceErase(request);
});
server->on(WM_G(R_api_portal_close), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiPortalClose(request);
});
server->on(WM_G(R_api_portal_exit), HTTP_POST, [this](AsyncWebServerRequest *request) {
this->_handlers->handleApiPortalExit(request);
});
server->on(WM_G(R_updatedone), HTTP_POST,
[this](AsyncWebServerRequest *request) {
this->_handlers->handleUpdateDone(request);
},
[this](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len,
bool final) {
this->_handlers->handleUpdating(request, filename, index, data, len, final);
});
server->onNotFound([this](AsyncWebServerRequest *request) {
this->_handlers->handleNotFound(request);
});
server->begin();
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Debug, kWiFiMgrLogSubsystem, F("HTTP server started"));
#endif
}
void WiFiManagerServer::setupDNSD() {
dnsServer.reset(new DNSServer());
dnsServer->setErrorReplyCode(DNSReplyCode::NoError);
#ifndef WM_NO_LOG
_wm->log(WiFiManagerLogLevel::Trace, kWiFiMgrLogSubsystem, F("dns server started with ip: "), WiFi.softAPIP());
#endif
const uint8_t DNS_PORT = 53;
dnsServer->start(DNS_PORT, F("*"), WiFi.softAPIP());
}
void WiFiManagerServer::processDNS() {
if (dnsServer) {
dnsServer->processNextRequest();
}
}
void WiFiManagerServer::shutdownServer() {
#ifdef WM_DFTE_LOGGING
if (_wmOwnsDfteLogSink) {
deviceFrameworkTemplateEngineDisableLoggingForOwner(static_cast<const void*>(this));
_dfteLogger.reset();
_wmOwnsDfteLogSink = false;
}
#endif
if (server) {
server.reset();
}
if (dnsServer) {
dnsServer->stop();
dnsServer.reset();
}
}
#endif
+135
View File
@@ -0,0 +1,135 @@
/**
* WiFiManagerUtils.cpp
* Implementation of pure utility functions for WiFiManager
*
* @author alexhopeoconnor
* @license MIT
*/
#include "WiFiManagerUtils.h"
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
namespace WiFiManagerUtils {
// -----------------------------------------------------------------------------------------------
// WIFI STATUS ARRAYS
const char * const WIFI_STA_STATUS[] PROGMEM = {
"WL_IDLE_STATUS", // 0 STATION_IDLE
"WL_NO_SSID_AVAIL", // 1 STATION_NO_AP_FOUND
"WL_SCAN_COMPLETED", // 2
"WL_CONNECTED", // 3 STATION_GOT_IP
"WL_CONNECT_FAILED", // 4 STATION_CONNECT_FAIL, STATION_WRONG_PASSWORD(NI)
"WL_CONNECTION_LOST", // 5
"WL_DISCONNECTED", // 6
"WL_STATION_WRONG_PASSWORD" // 7 KLUDGE
};
#ifdef ESP32
const char * const AUTH_MODE_NAMES[] PROGMEM = {
"OPEN",
"WEP",
"WPA_PSK",
"WPA2_PSK",
"WPA_WPA2_PSK",
"WPA2_ENTERPRISE",
"MAX"
};
#elif defined(ESP8266)
const char * const AUTH_MODE_NAMES[] PROGMEM = {
"",
"",
"WPA_PSK", // 2 ENC_TYPE_TKIP
"",
"WPA2_PSK", // 4 ENC_TYPE_CCMP
"WEP", // 5 ENC_TYPE_WEP
"",
"OPEN", //7 ENC_TYPE_NONE
"WPA_WPA2_PSK", // 8 ENC_TYPE_AUTO
};
#endif
const char* const WIFI_MODES[] PROGMEM = { "NULL", "STA", "AP", "STA+AP" };
// -----------------------------------------------------------------------------------------------
// STRING CONVERSION UTILITIES
String getStatusString(uint8_t status) {
if(status <= 7) return FPSTR(WIFI_STA_STATUS[status]);
return F("Unknown");
}
String getModeString(uint8_t mode) {
if(mode <= 3) return FPSTR(WIFI_MODES[mode]);
return F("Unknown");
}
String getEncryptionString(uint8_t authmode) {
return FPSTR(AUTH_MODE_NAMES[authmode]);
}
// -----------------------------------------------------------------------------------------------
// HTML UTILITIES
String htmlEntities(const String& str, bool whitespace) {
String result = str;
result.replace("&","&amp;");
result.replace("<","&lt;");
result.replace(">","&gt;");
result.replace("'","&#39;");
if(whitespace) result.replace(" ","&#160;");
return result;
}
// -----------------------------------------------------------------------------------------------
// IP/STRING UTILITIES
bool isValidIP(const String& str) {
for (size_t i = 0; i < str.length(); i++) {
int c = str.charAt(i);
if (c != '.' && (c < '0' || c > '9')) {
return false;
}
}
return true;
}
String ipToString(IPAddress ip) {
String res = "";
for (int i = 0; i < 3; i++) {
res += String((ip >> (8 * i)) & 0xFF) + ".";
}
res += String(((ip >> 8 * 3)) & 0xFF);
return res;
}
bool isValidAPPassword(const String& password) {
if (password.length() < 8 || password.length() > 63) {
return false;
}
return true;
}
// -----------------------------------------------------------------------------------------------
// HELPER CALCULATIONS
int rssiToQuality(int rssi) {
int quality = 0;
if (rssi <= -100) {
quality = 0;
} else if (rssi >= -50) {
quality = 100;
} else {
quality = 2 * (rssi + 100);
}
return quality;
}
} // namespace WiFiManagerUtils
+80
View File
@@ -0,0 +1,80 @@
{
"name": "WiFiManager",
"version": "3.0.4",
"keywords": [
"wifi",
"wi-fi",
"esp",
"esp8266",
"esp32",
"espressif8266",
"espressif32",
"nodemcu",
"wemos",
"arduino"
],
"description": "Maintained ESP8266/ESP32 WiFi configuration portal with asynchronous web support.",
"authors": [
{
"name": "tzapu",
"url": "https://github.com/tzapu"
},
{
"name": "tablatronix",
"url": "https://github.com/tablatronix",
"maintainer": true
},
{
"name": "Alex Hope-O'Connor",
"url": "https://github.com/alexhopeoconnor"
}
],
"repository": {
"type": "git",
"url": "https://github.com/alexhopeoconnor/WiFiManager.git"
},
"frameworks": "arduino",
"platforms": [
"espressif8266",
"espressif32"
],
"dependencies": [
{
"owner": "ESP32Async",
"name": "ESPAsyncWebServer",
"version": "3.9.1"
},
{
"owner": "ESP32Async",
"name": "ESPAsyncTCP",
"version": "2.0.0",
"platforms": "espressif8266"
},
{
"owner": "ESP32Async",
"name": "AsyncTCP",
"version": "3.4.9",
"platforms": "espressif32"
},
{
"name": "DeviceFrameworkTemplateEngine",
"version": "https://github.com/alexhopeoconnor/DFTE.git#v1.0.2"
}
],
"build": {
"includeDir": "lib/WiFiManager/include",
"srcDir": "lib/WiFiManager/src",
"libLDFMode": "deep+"
},
"export": {
"include": [
"lib/WiFiManager/include",
"lib/WiFiManager/src",
"LICENSE",
"README.md",
"library.json"
]
},
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
"homepage": "https://github.com/alexhopeoconnor/WiFiManager"
}
+46
View File
@@ -0,0 +1,46 @@
; PlatformIO Project Configuration File for WiFiManager Library
; This file is used for building tests
[env:esp8266]
platform = espressif8266
board = d1_mini
framework = arduino
; Postmortem jump relocation fix for large binaries (see ESP8266-LINKER-WORKAROUND.md in arduino-home-assistant)
platform_packages =
platformio/framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#521ae60a89e64bb0d1eb7a0b7addf620ced5cad3
monitor_speed = 115200
test_framework = unity
test_build_src = no
build_flags =
-DWM_LOG_LEVEL=5
-DUNIT_TEST
lib_deps =
ESP32Async/ESPAsyncWebServer@3.9.1
DeviceFrameworkTemplateEngine=https://github.com/alexhopeoconnor/DFTE.git#v1.0.2
ESP32Async/ESPAsyncTCP@2.0.0
[env:esp32]
platform = espressif32@6.13.0
board = esp32dev
framework = arduino
monitor_speed = 115200
test_framework = unity
test_build_src = no
build_unflags =
-std=gnu++11
build_flags =
-std=gnu++14
-DWM_LOG_LEVEL=5
-DUNIT_TEST
lib_deps =
ESP32Async/ESPAsyncWebServer@3.9.1
DeviceFrameworkTemplateEngine=https://github.com/alexhopeoconnor/DFTE.git#v1.0.2
ESP32Async/AsyncTCP@3.4.9
; Optional: compile tests with DFTE logs bridged into WiFiManager::log (see README)
[env:esp8266_dfte_log]
extends = env:esp8266
build_flags =
${env:esp8266.build_flags}
-DWM_DFTE_LOGGING
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 --platform esp8266|esp32" >&2
exit 2
}
[[ "${1:-}" == "--platform" ]] || usage
platform="${2:-}"
[[ "$platform" == "esp8266" || "$platform" == "esp32" ]] || usage
[[ $# -eq 2 ]] || usage
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
pio run -d "$root/test/compile-project" -e "$platform"
echo "WiFiManager consumer compile check passed for $platform"
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 vMAJOR.MINOR.PATCH [--tag]"
exit 2
}
tag="${1:-}"
[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || usage
[[ "${2:-}" == "" || "${2:-}" == "--tag" ]] || usage
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
version="${tag#v}"
manifest_version="$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' "$root/library.json" | head -n 1)"
if [[ "$manifest_version" != "$version" ]]; then
echo "library.json is $manifest_version; expected $version for $tag" >&2
exit 1
fi
if [[ -f "$root/library.properties" ]]; then
properties_version="$(sed -n 's/^version=//p' "$root/library.properties" | head -n 1)"
if [[ "$properties_version" != "$version" ]]; then
echo "library.properties is $properties_version; expected $version for $tag" >&2
exit 1
fi
fi
package_dir="$(mktemp -d)"
trap 'rm -rf "$package_dir"' EXIT
pio pkg pack "$root" --output "$package_dir/package.tar.gz" >/dev/null
echo "Validated PlatformIO package for $tag"
if [[ "${2:-}" == "--tag" ]]; then
git -C "$root" diff --quiet
git -C "$root" diff --cached --quiet
git -C "$root" tag -a "$tag" -m "Release $tag"
echo "Created $tag. Push the branch and tag; GitHub Actions will publish the release."
fi
+33
View File
@@ -0,0 +1,33 @@
[platformio]
default_envs = esp8266
[common]
framework = arduino
lib_ldf_mode = chain
lib_deps =
WiFiManager=symlink://../..
ESP32Async/ESPAsyncWebServer@3.9.1
[env:esp8266]
extends = common
platform = espressif8266
board = d1_mini
platform_packages =
platformio/framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#521ae60a89e64bb0d1eb7a0b7addf620ced5cad3
build_flags =
-DWM_LOG_LEVEL=3
lib_deps =
${common.lib_deps}
ESP32Async/ESPAsyncTCP@2.0.0
[env:esp32]
extends = common
platform = espressif32@6.13.0
board = esp32dev
build_unflags = -std=gnu++11
build_flags =
-std=gnu++14
-DWM_LOG_LEVEL=3
lib_deps =
${common.lib_deps}
ESP32Async/AsyncTCP@3.4.9
+10
View File
@@ -0,0 +1,10 @@
#include <Arduino.h>
#include <WiFiManager.h>
WiFiManager wifiManager;
void setup() {
wifiManager.setConfigPortalTimeout(1);
}
void loop() {}
+180
View File
@@ -0,0 +1,180 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "test_main.h"
// Test case array
TestCase tests[] = {
// Basic tests
TEST_ENTRY(test_basic_wifimanager_instantiation),
TEST_ENTRY(test_reset_settings),
// JSON API shape (buildApiInfoJson is large — run with fresh heap, before stress tests)
TEST_ENTRY(test_captive_redirect_host_rule),
TEST_ENTRY(test_api_wifi_meta_json_shape),
TEST_ENTRY(test_api_wifi_meta_password_field_type),
TEST_ENTRY(test_api_wifi_connect_status_success_redirect),
TEST_ENTRY(test_api_info_json_shape),
TEST_ENTRY(test_api_params_json_shape),
TEST_ENTRY(test_api_status_json_shape),
// Configuration tests
TEST_ENTRY(test_set_and_get_hostname),
TEST_ENTRY(test_get_default_ap_name),
TEST_ENTRY(test_get_wifi_status_string),
TEST_ENTRY(test_get_mode_string),
TEST_ENTRY(test_get_rssi_as_quality),
// Portal lifecycle tests
TEST_ENTRY(test_start_config_portal),
TEST_ENTRY(test_start_config_portal_with_password),
TEST_ENTRY(test_start_config_portal_auto_name),
TEST_ENTRY(test_stop_config_portal),
TEST_ENTRY(test_config_portal_infrastructure),
TEST_ENTRY(test_start_web_portal),
TEST_ENTRY(test_stop_web_portal),
TEST_ENTRY(test_config_portal_multiple_start_stop),
TEST_ENTRY(test_config_portal_already_active),
TEST_ENTRY(test_get_config_portal_ssid),
TEST_ENTRY(test_bootstrap_json_portal_feature_flags),
TEST_ENTRY(test_bootstrap_json_contract_v2),
TEST_ENTRY(test_bootstrap_json_snapshot_consistency),
TEST_ENTRY(test_root_render_interleaved_context_isolation),
// Non-blocking tests
TEST_ENTRY(test_nonblocking_process),
TEST_ENTRY(test_client_check_setters),
TEST_ENTRY(test_process_required_for_timeout),
// Callback tests
TEST_ENTRY(test_ap_callback),
TEST_ENTRY(test_web_server_callback),
TEST_ENTRY(test_multiple_callbacks),
// Parameter tests
TEST_ENTRY(test_create_parameter),
TEST_ENTRY(test_add_parameter),
TEST_ENTRY(test_get_parameters),
TEST_ENTRY(test_parameter_with_custom_html),
TEST_ENTRY(test_parameter_value_length),
TEST_ENTRY(test_parameter_label_placement),
TEST_ENTRY(test_multiple_parameters),
TEST_ENTRY(test_parameter_placeholder),
// Static IP tests
TEST_ENTRY(test_set_ap_static_ip_config),
TEST_ENTRY(test_ap_static_ip_application),
// WiFi connection tests
TEST_ENTRY(test_autoconnect_fallback_to_portal),
TEST_ENTRY(test_connectwifi_ssid_not_found),
TEST_ENTRY(test_connection_state_transitions),
TEST_ENTRY(test_autoconnect_with_timeout),
// Callback firing tests
TEST_ENTRY(test_timeout_callback_fires),
TEST_ENTRY(test_config_reset_callback_fires),
TEST_ENTRY(test_ap_callback_fires_improved),
TEST_ENTRY(test_web_server_callback_fires_improved),
// DNS lifecycle tests
TEST_ENTRY(test_dns_server_created),
TEST_ENTRY(test_dns_server_cleanup),
TEST_ENTRY(test_dns_server_lifecycle_cycles),
// Error condition tests
TEST_ENTRY(test_connection_failure_handling),
TEST_ENTRY(test_resource_cleanup_after_error),
TEST_ENTRY(test_multiple_rapid_start_stop),
// Parameter value tests
TEST_ENTRY(test_parameter_value_set_directly),
TEST_ENTRY(test_parameter_value_length_validation),
TEST_ENTRY(test_parameter_value_persistence),
TEST_ENTRY(test_parameter_value_update),
TEST_ENTRY(test_multiple_parameters_different_values),
// WiFi scanning tests
TEST_ENTRY(test_wifi_scan_initiates),
TEST_ENTRY(test_async_scan_behavior),
TEST_ENTRY(test_scan_status_checking),
TEST_ENTRY(test_scan_completion_wait),
TEST_ENTRY(test_scan_cancels_when_connect_pending),
TEST_ENTRY(test_scan_cancels_when_lifecycle_blocked),
TEST_ENTRY(test_scan_generation_invalidated_on_reset),
// Template rendering tests
TEST_ENTRY(test_shell_template_renders_core_placeholders),
TEST_ENTRY(test_shell_template_renders_dynamic_styles_with_percent_values),
// State transition tests
TEST_ENTRY(test_portal_to_connected_transition),
TEST_ENTRY(test_concurrent_operations),
TEST_ENTRY(test_state_consistency_during_portal),
TEST_ENTRY(test_state_transitions_multiple_cycles),
// Integration tests
TEST_ENTRY(test_autoconnect_fallback_flow),
TEST_ENTRY(test_portal_lifecycle_with_connection_attempt),
TEST_ENTRY(test_parameter_add_and_retrieve),
TEST_ENTRY(test_complete_flow_reset_autoconnect_portal),
TEST_ENTRY(test_portal_with_parameters_and_infrastructure),
// Stress tests
TEST_ENTRY(test_many_start_stop_cycles),
TEST_ENTRY(test_long_running_portal),
TEST_ENTRY(test_rapid_portal_start_stop),
TEST_ENTRY(test_multiple_parameters_stress),
TEST_ENTRY(test_portal_with_timeout_stress),
};
const size_t TEST_COUNT = sizeof(tests) / sizeof(TestCase);
// Test state variables
size_t next_index = 0;
bool begun = false;
// Test setup and teardown
void setUp(void) {
// No per-test setup needed
}
void tearDown(void) {
// No per-test teardown needed
}
// Arduino setup and loop functions (required by framework)
void setup() {
Serial.begin(115200);
delay(2000); // Give time for serial to initialize
Serial.println("\n[TEST] =============================================");
Serial.println("[TEST] === WiFiManager Test Setup ===");
Serial.println("[TEST] Starting WiFiManager tests...");
Serial.println("[TEST] =============================================");
UNITY_BEGIN(); // Start Unity test framework
begun = true; // Start tests immediately
}
void loop() {
// Run one test and return immediately
if (begun && next_index < TEST_COUNT) {
TestCase& t = tests[next_index];
Serial.print("\n[TEST] ==== Running test: ");
Serial.print(t.name);
Serial.println(" ====");
UnityDefaultTestRun(t.fn, t.name, t.line);
next_index++;
return; // yield quickly
}
// All tests completed
if (begun && next_index >= TEST_COUNT) {
Serial.println("\n[TEST] =============================================");
Serial.println("[TEST] === All tests completed ===");
Serial.println("[TEST] =============================================");
UNITY_END(); // prints Unity summary
begun = false; // avoid repeating
}
}
+143
View File
@@ -0,0 +1,143 @@
#ifndef TEST_MAIN_H
#define TEST_MAIN_H
#include <Arduino.h>
// Test function type
using TestFn = void(*)();
// Test case structure
struct TestCase {
const char* name;
TestFn fn;
uint16_t line;
};
#define TEST_ENTRY(fn) { #fn, fn, __LINE__ }
// Basic tests
void test_basic_wifimanager_instantiation();
void test_reset_settings();
// Configuration tests
void test_set_and_get_hostname();
void test_get_default_ap_name();
void test_get_wifi_status_string();
void test_get_mode_string();
void test_get_rssi_as_quality();
// Portal lifecycle tests
void test_start_config_portal();
void test_start_config_portal_with_password();
void test_start_config_portal_auto_name();
void test_stop_config_portal();
void test_config_portal_infrastructure();
void test_start_web_portal();
void test_stop_web_portal();
void test_config_portal_multiple_start_stop();
void test_config_portal_already_active();
void test_get_config_portal_ssid();
void test_bootstrap_json_portal_feature_flags();
void test_bootstrap_json_contract_v2();
void test_bootstrap_json_snapshot_consistency();
void test_root_render_interleaved_context_isolation();
// Non-blocking tests
void test_nonblocking_process();
void test_client_check_setters();
void test_process_required_for_timeout();
// Callback tests
void test_ap_callback();
void test_web_server_callback();
void test_multiple_callbacks();
// Parameter tests
void test_create_parameter();
void test_add_parameter();
void test_get_parameters();
void test_parameter_with_custom_html();
void test_parameter_value_length();
void test_parameter_label_placement();
void test_multiple_parameters();
void test_parameter_placeholder();
// Static IP tests
void test_set_ap_static_ip_config();
void test_ap_static_ip_application();
// Advanced options tests
// WiFi connection tests
void test_autoconnect_fallback_to_portal();
void test_connectwifi_ssid_not_found();
void test_connection_state_transitions();
void test_autoconnect_with_timeout();
// Callback firing tests
void test_timeout_callback_fires();
void test_config_reset_callback_fires();
void test_ap_callback_fires_improved();
void test_web_server_callback_fires_improved();
// DNS lifecycle tests
void test_dns_server_created();
void test_dns_server_cleanup();
void test_dns_server_lifecycle_cycles();
// Error condition tests
void test_connection_failure_handling();
void test_resource_cleanup_after_error();
void test_multiple_rapid_start_stop();
// Parameter value tests
void test_parameter_value_set_directly();
void test_parameter_value_length_validation();
void test_parameter_value_persistence();
void test_parameter_value_update();
void test_multiple_parameters_different_values();
// WiFi scanning tests
void test_wifi_scan_initiates();
void test_async_scan_behavior();
void test_scan_status_checking();
void test_scan_completion_wait();
void test_scan_cancels_when_connect_pending();
void test_scan_cancels_when_lifecycle_blocked();
void test_scan_generation_invalidated_on_reset();
// Template rendering tests
void test_shell_template_renders_core_placeholders();
void test_shell_template_renders_dynamic_styles_with_percent_values();
// API JSON + captive helper tests
void test_captive_redirect_host_rule();
void test_api_wifi_meta_json_shape();
void test_api_wifi_meta_password_field_type();
void test_api_wifi_connect_status_success_redirect();
void test_api_info_json_shape();
void test_api_params_json_shape();
void test_api_status_json_shape();
// State transition tests
void test_portal_to_connected_transition();
void test_concurrent_operations();
void test_state_consistency_during_portal();
void test_state_transitions_multiple_cycles();
// Integration tests
void test_autoconnect_fallback_flow();
void test_portal_lifecycle_with_connection_attempt();
void test_parameter_add_and_retrieve();
void test_complete_flow_reset_autoconnect_portal();
void test_portal_with_parameters_and_infrastructure();
// Stress tests
void test_many_start_stop_cycles();
void test_long_running_portal();
void test_rapid_portal_start_stop();
void test_multiple_parameters_stress();
void test_portal_with_timeout_stress();
#endif // TEST_MAIN_H
@@ -0,0 +1,132 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
// Test advanced configuration options - consolidated into logical groups
// Test connection behavior options
void test_connection_behavior_options() {
Serial.println("[TEST] Testing connection behavior options...");
WiFiManager wm;
// Test connection options
wm.setBreakAfterConfig(true);
wm.setBreakAfterConfig(false);
wm.setSaveConnect(true);
wm.setSaveConnect(false);
wm.setRestorePersistent(true);
wm.setRestorePersistent(false);
wm.setConnectRetries(1);
wm.setConnectRetries(3);
wm.setConnectRetries(5);
wm.setSaveConnectTimeout(0);
wm.setSaveConnectTimeout(10);
wm.setSaveConnectTimeout(30);
wm.setEnableConfigPortal(true);
wm.setEnableConfigPortal(false);
wm.setDisableConfigPortal(true);
wm.setDisableConfigPortal(false);
wm.portalSetBehaviorConnectOnSave(true);
wm.portalSetBehaviorConnectOnSave(false);
wm.portalSetBehaviorExitAllowed(true);
wm.portalSetBehaviorExitAllowed(false);
wm.portalSetBehaviorConnectTimeoutSeconds(15);
wm.portalSetBehaviorPortalTimeoutSeconds(20);
wm.portalSetBehaviorAutoReconnect(true);
wm.portalSetBehaviorAutoReconnect(false);
wm.portalSetBehaviorApClientCheck(true);
wm.portalSetBehaviorApClientCheck(false);
wm.portalSetBehaviorWebClientCheck(true);
wm.portalSetBehaviorWebClientCheck(false);
wm.preloadWiFi("TestSSID", "TestPassword");
// All setters executed without crash
TEST_ASSERT_TRUE_MESSAGE(true, "Connection behavior options executed without crash");
Serial.println("[TEST] Connection behavior options test completed successfully");
}
// Test UI display options
void test_ui_display_options() {
Serial.println("[TEST] Testing UI display options...");
WiFiManager wm;
// Test display toggles
wm.portalSetFieldPasswordPlaceholderMode(PortalPasswordPlaceholderMode::Actual);
wm.portalSetFieldPasswordPlaceholderMode(PortalPasswordPlaceholderMode::Masked);
wm.portalSetFieldPasswordPlaceholderMode(PortalPasswordPlaceholderMode::Hidden);
wm.setScanDispPerc(true);
wm.setScanDispPerc(false);
wm.portalSetActionEraseVisible(true);
wm.portalSetActionEraseVisible(false);
wm.portalSetActionRestartVisible(true);
wm.portalSetActionRestartVisible(false);
wm.portalSetActionExitVisible(true);
wm.portalSetActionExitVisible(false);
wm.portalSetActionCloseCaptiveVisible(true);
wm.portalSetActionCloseCaptiveVisible(false);
wm.portalSetPageUpdateVisible(true);
wm.portalSetPageUpdateVisible(false);
wm.portalSetPageSetupVisible(true);
wm.portalSetPageSetupVisible(false);
wm.portalSetLayoutParamsLocation(PortalParamsLocation::WiFiPage);
wm.portalSetLayoutParamsLocation(PortalParamsLocation::SetupPage);
wm.portalSetActionBackVisible(true);
wm.portalSetActionBackVisible(false);
// All setters executed without crash
TEST_ASSERT_TRUE_MESSAGE(true, "UI display options executed without crash");
Serial.println("[TEST] UI display options test completed successfully");
}
// Test custom HTML/UI customization
void test_ui_customization() {
Serial.println("[TEST] Testing UI customization...");
WiFiManager wm;
// Minimal customization retained: title
wm.portalSetBrandTitle("MyDevice");
// All setters executed without crash
TEST_ASSERT_TRUE_MESSAGE(true, "UI customization options executed without crash");
Serial.println("[TEST] UI customization test completed successfully");
}
void test_debug_soft_ap_config() {
Serial.println("[TEST] Testing debugSoftAPConfig()...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("TestAP");
// Call process() to simulate real usage
wm.process();
delay(100);
// Debug output should not crash
wm.debugSoftAPConfig();
wm.stopConfigPortal();
Serial.println("[TEST] debugSoftAPConfig() test completed successfully");
}
void test_debug_platform_info() {
Serial.println("[TEST] Testing debugPlatformInfo()...");
WiFiManager wm;
// Debug output should not crash
wm.debugPlatformInfo();
TEST_ASSERT_TRUE_MESSAGE(true, "debugPlatformInfo() executed without crash");
Serial.println("[TEST] debugPlatformInfo() test completed successfully");
}
@@ -0,0 +1,141 @@
#include <unity.h>
#include <Arduino.h>
#include <string.h>
#include <WiFiManager.h>
#include <WiFiManagerHandlers.h>
#include "../test_main.h"
void test_captive_redirect_host_rule() {
Serial.println("[TEST] Testing captive redirect host comparison...");
TEST_ASSERT_TRUE(WiFiManagerHandlers::shouldRedirectCaptiveForHost("captive.apple.com", "192.168.4.1"));
TEST_ASSERT_TRUE(WiFiManagerHandlers::shouldRedirectCaptiveForHost("192.168.4.2", "192.168.4.1"));
TEST_ASSERT_FALSE(WiFiManagerHandlers::shouldRedirectCaptiveForHost("192.168.4.1", "192.168.4.1"));
TEST_ASSERT_FALSE(WiFiManagerHandlers::shouldRedirectCaptiveForHost("example.com", ""));
Serial.println("[TEST] Captive redirect host rule test completed successfully");
}
void test_api_wifi_meta_json_shape() {
Serial.println("[TEST] Testing /api/wifi/meta JSON shape...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
String j = handlers.buildApiWifiMetaJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"wifiFields\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"staticFields\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"params\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"actions\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"canRefreshScan\":true")));
WiFiManagerParameter fieldParam("mqtt_host", "MQTT host", "broker.local", 64, "placeholder='broker.local'");
WiFiManagerParameter htmlParam("<div class='wm-callout wm-callout--info'><p>GPS settings...</p></div>");
wm.portalAddParameter(&fieldParam);
wm.portalAddParameter(&htmlParam);
j = handlers.buildApiWifiMetaJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"kind\":\"field\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"kind\":\"html\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"html\":\"<div class='wm-callout wm-callout--info'><p>GPS settings...</p></div>\"}")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"wifiFields\":[{\"id\":\"s\"")));
Serial.println("[TEST] WiFi meta JSON shape test completed successfully");
}
void test_api_wifi_meta_password_field_type() {
Serial.println("[TEST] Testing /api/wifi/meta password field type from custom attrs...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
WiFiManagerParameter pwd("mqttpass", "MQTT password", "secret", 24, " type='password' autocorrect='off'");
wm.portalAddParameter(&pwd);
String j = handlers.buildApiWifiMetaJson();
const char* p = j.c_str();
const char* chunk = strstr(p, "\"id\":\"mqttpass\"");
TEST_ASSERT_NOT_NULL_MESSAGE(chunk, "mqttpass param missing from meta JSON");
TEST_ASSERT_NOT_NULL_MESSAGE(strstr(chunk, "\"type\":\"password\""),
"customAttrs type=password must map to JSON type password");
Serial.println("[TEST] WiFi meta password field type test completed successfully");
}
void test_api_wifi_connect_status_success_redirect() {
Serial.println("[TEST] Testing /api/wifi/connect-status success redirect payload...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
#ifdef UNIT_TEST
wm.wmTestSetPortalConnectSuccess("WiFi connected. Redirecting to 192.168.1.42", "192.168.1.42");
#endif
String j = handlers.buildApiWifiConnectStatusJson();
const char* p = j.c_str();
TEST_ASSERT_NOT_NULL(strstr(p, "\"state\":\"success\""));
TEST_ASSERT_NOT_NULL(strstr(p, "\"stationIp\":\"192.168.1.42\""));
TEST_ASSERT_NOT_NULL(strstr(p, "\"redirectUrl\":\"http://192.168.1.42/\""));
Serial.println("[TEST] WiFi connect-status success redirect payload test completed successfully");
}
void test_api_info_json_shape() {
Serial.println("[TEST] Testing /api/info JSON shape...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
PortalInfoSection battery;
battery.id = "battery";
battery.title = "Battery";
battery.items.push_back({"soc", "State of charge", "84%"});
battery.items.push_back({"voltage", "Voltage", "13.2V"});
wm.portalAddInfoSection(battery);
String j = handlers.buildApiInfoJson();
const char* p = j.c_str();
// Shape checks only: "status" is a nested object (},\n"device" not ],"device"); require
// a tail marker so we know the full String was built (heap is OK). Middle sections
// (wifi / about) are not asserted — long runs fragment heap and can truncate long JSONs.
TEST_ASSERT_NOT_NULL(p);
TEST_ASSERT_GREATER_THAN_INT_MESSAGE(200, (int)j.length(),
"api/info body unexpectedly short; likely heap/fragmentation");
TEST_ASSERT_NOT_NULL(strstr(p, "\"status\":"));
TEST_ASSERT_NOT_NULL(strstr(p, "\"connected\":"));
TEST_ASSERT_NOT_NULL(strstr(p, "},\"device\":["));
TEST_ASSERT_NOT_NULL(strstr(p, "\"extraSections\":"));
TEST_ASSERT_NOT_NULL(strstr(p, "\"id\":\"battery\""));
TEST_ASSERT_NOT_NULL(strstr(p, "\"title\":\"Battery\""));
TEST_ASSERT_NOT_NULL(strstr(p, "\"label\":\"State of charge\""));
TEST_ASSERT_NOT_NULL(strstr(p, "\"showUpdate\":"));
TEST_ASSERT_NOT_NULL(strstr(p, "\"key\":\"aboutver\",\"label\":\"WiFiManager\",\"value\":\""));
TEST_ASSERT_NOT_NULL(strstr(p, "\"},{\"key\":\"aboutarduinover\""));
Serial.println("[TEST] API info JSON shape test completed successfully");
}
void test_api_params_json_shape() {
Serial.println("[TEST] Testing /api/params JSON shape...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
String j = handlers.buildApiParamsGetJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"params\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"actions\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"showBack\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"params\":[")));
Serial.println("[TEST] API params JSON shape test completed successfully");
}
void test_api_status_json_shape() {
Serial.println("[TEST] Testing /api/status JSON shape...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
String j = handlers.buildApiStatusJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"text\"")));
TEST_ASSERT_EQUAL('{', j.charAt(0));
TEST_ASSERT_EQUAL('}', j.charAt(j.length() - 1));
Serial.println("[TEST] API status JSON shape test completed successfully");
}
@@ -0,0 +1,71 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
// Test basic WiFiManager instantiation
void test_basic_wifimanager_instantiation() {
Serial.println("[TEST] Testing basic WiFiManager instantiation...");
// Test default constructor
WiFiManager wm;
// Test that we can call basic methods without crashing
String defaultName = wm.getDefaultAPName();
TEST_ASSERT_GREATER_THAN(0, defaultName.length());
// Test default state - portal should not be active
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
TEST_ASSERT_FALSE(wm.getWebPortalActive());
Serial.println("[TEST] Basic WiFiManager instantiation test completed successfully");
}
// Test resetSettings clears credentials
void test_reset_settings() {
Serial.println("[TEST] Testing resetSettings()...");
WiFiManager wm;
// Ensure WiFi is in a stable state before resetting
delay(100);
// Reset settings (should not crash)
wm.resetSettings();
// Small delay to allow WiFi operations to complete
delay(100);
// Verify WiFi is not saved after reset
// Note: ESP32 uses NVS for WiFi credentials which behaves differently than ESP8266's EEPROM
// On ESP32, getWiFiIsSaved() may still return TRUE due to NVS persistence differences
#ifdef ESP32
// ESP32: Due to NVS behavior, getWiFiIsSaved() may return TRUE even after resetSettings()
// This is a known platform difference - the reset is still effective, just detected differently
bool wifiIsSaved = wm.getWiFiIsSaved();
TEST_ASSERT_TRUE_MESSAGE(true, "resetSettings() executed on ESP32 (NVS behavior differs from ESP8266)");
Serial.print("[TEST] ESP32: getWiFiIsSaved() = ");
Serial.println(wifiIsSaved ? "TRUE" : "FALSE");
#else
// ESP8266: Should return FALSE after resetSettings()
TEST_ASSERT_FALSE(wm.getWiFiIsSaved());
#endif
Serial.println("[TEST] resetSettings() test completed successfully");
}
// Test disconnect - verify it doesn't crash and can be called multiple times
void test_disconnect() {
Serial.println("[TEST] Testing disconnect()...");
WiFiManager wm;
// Disconnect should not crash even if not connected
(void)wm.disconnect();
// Can be called multiple times safely
(void)wm.disconnect();
Serial.println("[TEST] disconnect() test completed successfully");
}
@@ -0,0 +1,129 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
// Callback flags (static to avoid duplicate definitions)
static bool timeout_callback_fired = false;
static bool config_reset_callback_fired = false;
// Callback functions (static to avoid duplicate definitions)
static void timeout_callback() {
timeout_callback_fired = true;
}
static void config_reset_callback() {
config_reset_callback_fired = true;
}
// Reset callback flags (static to avoid duplicate definitions)
static void reset_callback_flags() {
timeout_callback_fired = false;
config_reset_callback_fired = false;
}
// Test timeout callback fires
void test_timeout_callback_fires() {
Serial.println("[TEST] Testing timeout callback firing...");
reset_callback_flags();
WiFiManager wm;
wm.setConfigPortalTimeoutCallback(timeout_callback);
wm.setConfigPortalTimeout(2); // 2 second timeout
wm.startConfigPortal("TestAP");
// Process until timeout
unsigned long start = millis();
while (wm.getConfigPortalActive() && (millis() - start < 5000)) {
wm.process();
delay(50);
}
// Callback should have fired when timeout occurred
TEST_ASSERT_TRUE(timeout_callback_fired);
wm.stopConfigPortal();
Serial.println("[TEST] Timeout callback firing test completed successfully");
}
// Test config reset callback fires
void test_config_reset_callback_fires() {
Serial.println("[TEST] Testing config reset callback firing...");
reset_callback_flags();
WiFiManager wm;
wm.setConfigResetCallback(config_reset_callback);
// Ensure WiFi is in a stable state before resetting
delay(100);
// Call resetSettings which should trigger callback
wm.resetSettings();
// Allow WiFi operations to complete
delay(100);
// Callback should have fired
TEST_ASSERT_TRUE(config_reset_callback_fired);
Serial.println("[TEST] Config reset callback firing test completed successfully");
}
// Test AP callback fires (improve existing test)
void test_ap_callback_fires_improved() {
Serial.println("[TEST] Testing AP callback firing (improved)...");
bool ap_callback_fired = false;
WiFiManager wm;
wm.setAPCallback([&](WiFiManager* wm) {
ap_callback_fired = true;
(void)wm; // Suppress unused parameter warning
});
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("TestAP");
wm.process();
// Callback should have fired when AP starts
TEST_ASSERT_TRUE(ap_callback_fired);
wm.stopConfigPortal();
Serial.println("[TEST] AP callback firing (improved) test completed successfully");
}
// Test web server callback fires (improve existing test)
void test_web_server_callback_fires_improved() {
Serial.println("[TEST] Testing web server callback firing (improved)...");
bool web_server_callback_fired = false;
WiFiManager wm;
wm.setWebServerCallback([&]() {
web_server_callback_fired = true;
});
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("TestAP");
wm.process();
// Wait for server to initialize
unsigned long start = millis();
while (!web_server_callback_fired && (millis() - start < 1000)) {
wm.process();
delay(10);
}
// Callback should have fired when server starts
TEST_ASSERT_TRUE(web_server_callback_fired);
wm.stopConfigPortal();
Serial.println("[TEST] Web server callback firing (improved) test completed successfully");
}
@@ -0,0 +1,165 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
// Callback flags
bool ap_callback_fired = false;
bool web_server_callback_fired = false;
bool save_config_callback_fired = false;
bool pre_save_config_callback_fired = false;
bool save_params_callback_fired = false;
bool pre_save_params_callback_fired = false;
bool config_reset_callback_fired = false;
bool config_portal_timeout_callback_fired = false;
// Callback functions
void ap_callback(WiFiManager* wm) {
ap_callback_fired = true;
}
void web_server_callback() {
web_server_callback_fired = true;
}
void save_config_callback() {
save_config_callback_fired = true;
}
void pre_save_config_callback() {
pre_save_config_callback_fired = true;
}
void save_params_callback(WiFiManager::WiFiManagerRequestArgs requestArgs) {
save_params_callback_fired = true;
// Test that we can access request args
(void)requestArgs; // Suppress unused variable warning
}
void pre_save_params_callback() {
pre_save_params_callback_fired = true;
}
void config_reset_callback() {
config_reset_callback_fired = true;
}
void config_portal_timeout_callback() {
config_portal_timeout_callback_fired = true;
}
// Reset all callback flags
void reset_callback_flags() {
ap_callback_fired = false;
web_server_callback_fired = false;
save_config_callback_fired = false;
pre_save_config_callback_fired = false;
save_params_callback_fired = false;
pre_save_params_callback_fired = false;
config_reset_callback_fired = false;
config_portal_timeout_callback_fired = false;
}
void test_ap_callback() {
Serial.println("[TEST] Testing AP callback...");
reset_callback_flags();
WiFiManager wm;
wm.setAPCallback(ap_callback);
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("TestAP");
// Call process() to ensure portal is fully initialized
wm.process();
// Callback should have fired when AP starts
TEST_ASSERT_TRUE(ap_callback_fired);
wm.stopConfigPortal();
Serial.println("[TEST] AP callback test completed successfully");
}
void test_web_server_callback() {
Serial.println("[TEST] Testing web server callback...");
reset_callback_flags();
WiFiManager wm;
wm.setWebServerCallback(web_server_callback);
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("TestAP");
// Call process() to ensure server is initialized
wm.process();
delay(100); // Give time for server to start
// Callback should have fired when server starts
TEST_ASSERT_TRUE(web_server_callback_fired);
wm.stopConfigPortal();
Serial.println("[TEST] Web server callback test completed successfully");
}
// Test callback registration - verify all callbacks can be registered without crash
void test_callback_registration() {
Serial.println("[TEST] Testing callback registration...");
reset_callback_flags();
WiFiManager wm;
// Register all callbacks - verify registration doesn't crash
wm.setConfigResetCallback(config_reset_callback);
wm.setSaveConfigCallback(save_config_callback);
wm.setPreSaveConfigCallback(pre_save_config_callback);
wm.setSaveParamsCallback(save_params_callback);
wm.setPreSaveParamsCallback(pre_save_params_callback);
wm.setConfigPortalTimeoutCallback(config_portal_timeout_callback);
// Call resetSettings to verify callback registration doesn't interfere
wm.resetSettings();
// Verify registration doesn't crash
TEST_ASSERT_TRUE_MESSAGE(true, "All callbacks registered without crash");
Serial.println("[TEST] Callback registration test completed successfully");
}
void test_multiple_callbacks() {
Serial.println("[TEST] Testing multiple callbacks together...");
reset_callback_flags();
WiFiManager wm;
// Register all callbacks
wm.setAPCallback(ap_callback);
wm.setWebServerCallback(web_server_callback);
wm.setSaveConfigCallback(save_config_callback);
wm.setPreSaveConfigCallback(pre_save_config_callback);
wm.setSaveParamsCallback(save_params_callback);
wm.setPreSaveParamsCallback(pre_save_params_callback);
wm.setConfigResetCallback(config_reset_callback);
wm.setConfigPortalTimeoutCallback(config_portal_timeout_callback);
// Start portal - should fire AP and web server callbacks
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("TestAP");
// Call process() to ensure portal is fully initialized
wm.process();
delay(100);
// Verify AP callback fired
TEST_ASSERT_TRUE(ap_callback_fired);
TEST_ASSERT_TRUE(web_server_callback_fired);
wm.stopConfigPortal();
Serial.println("[TEST] Multiple callbacks test completed successfully");
}
@@ -0,0 +1,180 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
// Test configuration API methods
// Consolidated setter tests - verify setters don't crash and can be called multiple times
void test_configuration_setters() {
Serial.println("[TEST] Testing configuration setters...");
WiFiManager wm;
// Test timeout setters
wm.setConfigPortalTimeout(0);
wm.setConfigPortalTimeout(30);
wm.setConfigPortalTimeout(300);
wm.setConnectTimeout(0);
wm.setConnectTimeout(20);
wm.setConnectTimeout(60);
// Test HTTP port
wm.setHttpPort(80);
wm.setHttpPort(8080);
// Test WiFi quality and filtering
wm.setMinimumSignalQuality(-1); // Disable filter
wm.setMinimumSignalQuality(0);
wm.setMinimumSignalQuality(50);
wm.setMinimumSignalQuality(100);
wm.setRemoveDuplicateAPs(true);
wm.setRemoveDuplicateAPs(false);
// Test display options
wm.setShowStaticFields(true);
wm.setShowStaticFields(false);
wm.setShowDnsFields(true);
wm.setShowDnsFields(false);
// Test portal behavior
wm.portalSetBehaviorCaptivePortalEnabled(true);
wm.portalSetBehaviorCaptivePortalEnabled(false);
// Test custom title path
wm.portalSetBrandTitle("TestTitle");
// Call setters multiple times with different values.
wm.setConfigPortalTimeout(60);
wm.setConnectTimeout(30);
wm.setHttpPort(8080);
wm.setMinimumSignalQuality(50);
Serial.println("[TEST] Configuration setters test completed successfully");
}
// Test hostname setter/getter - can verify behavior
void test_set_and_get_hostname() {
Serial.println("[TEST] Testing setHostname() and getWiFiHostname()...");
WiFiManager wm;
TEST_ASSERT_TRUE_MESSAGE(wm.setHostname("test-hostname"), "Valid char* hostname should be accepted");
TEST_ASSERT_TRUE_MESSAGE(wm.setHostname(String(" trimmed-hostname ")), "Valid String hostname should be trimmed and accepted");
TEST_ASSERT_TRUE_MESSAGE(wm.setHostname(""), "Empty hostname should clear the configured hostname");
String tooLongHostname = "123456789012345678901234567890123";
TEST_ASSERT_FALSE_MESSAGE(wm.setHostname(tooLongHostname), "Hostnames longer than 32 chars should be rejected");
TEST_ASSERT_FALSE_MESSAGE(wm.setHostname("bad host"), "Hostnames with spaces should be rejected");
TEST_ASSERT_FALSE_MESSAGE(wm.setHostname("-leading"), "Hostnames cannot start with a hyphen");
TEST_ASSERT_FALSE_MESSAGE(wm.setHostname("trailing-"), "Hostnames cannot end with a hyphen");
(void)wm.getWiFiHostname();
Serial.println("[TEST] setHostname() and getWiFiHostname() test completed successfully");
}
// Test WiFi AP configuration setters - consolidated
void test_wifi_ap_configuration_setters() {
Serial.println("[TEST] Testing WiFi AP configuration setters...");
WiFiManager wm;
// Test AP channel
wm.setWiFiAPChannel(0); // Auto
wm.setWiFiAPChannel(1);
wm.setWiFiAPChannel(11);
// Test AP hidden
wm.setWiFiAPHidden(true);
wm.setWiFiAPHidden(false);
// Test country code
wm.setCountry("US");
wm.setCountry("CN");
// Test clean connect
wm.setCleanConnect(true);
wm.setCleanConnect(false);
// Test auto reconnect
wm.setWiFiAutoReconnect(true);
wm.setWiFiAutoReconnect(false);
Serial.println("[TEST] WiFi AP configuration setters test completed successfully");
}
void test_get_default_ap_name() {
Serial.println("[TEST] Testing getDefaultAPName()...");
WiFiManager wm;
String apName = wm.getDefaultAPName();
// Should return a non-empty string (chip ID based)
TEST_ASSERT_GREATER_THAN(0, apName.length());
Serial.println("[TEST] getDefaultAPName() test completed successfully");
}
void test_get_wifi_status_string() {
Serial.println("[TEST] Testing getWLStatusString()...");
WiFiManager wm;
// Test with status code
String status1 = wm.getWLStatusString(WL_IDLE_STATUS);
String status2 = wm.getWLStatusString(WL_CONNECTED);
String status3 = wm.getWLStatusString(WL_DISCONNECTED);
// All should return non-empty strings
TEST_ASSERT_GREATER_THAN(0, status1.length());
TEST_ASSERT_GREATER_THAN(0, status2.length());
TEST_ASSERT_GREATER_THAN(0, status3.length());
// Test without parameter (uses current WiFi.status())
String status4 = wm.getWLStatusString();
TEST_ASSERT_GREATER_THAN(0, status4.length());
Serial.println("[TEST] getWLStatusString() test completed successfully");
}
void test_get_mode_string() {
Serial.println("[TEST] Testing getModeString()...");
WiFiManager wm;
String mode1 = wm.getModeString(WIFI_OFF);
String mode2 = wm.getModeString(WIFI_STA);
String mode3 = wm.getModeString(WIFI_AP);
String mode4 = wm.getModeString(WIFI_AP_STA);
// All should return non-empty strings
TEST_ASSERT_GREATER_THAN(0, mode1.length());
TEST_ASSERT_GREATER_THAN(0, mode2.length());
TEST_ASSERT_GREATER_THAN(0, mode3.length());
TEST_ASSERT_GREATER_THAN(0, mode4.length());
Serial.println("[TEST] getModeString() test completed successfully");
}
void test_get_rssi_as_quality() {
Serial.println("[TEST] Testing getRSSIasQuality()...");
WiFiManager wm;
// Test various RSSI values
int quality1 = wm.getRSSIasQuality(-30); // Very strong
int quality2 = wm.getRSSIasQuality(-70); // Good
int quality3 = wm.getRSSIasQuality(-90); // Weak
// Quality should be 0-100
TEST_ASSERT_GREATER_OR_EQUAL(0, quality1);
TEST_ASSERT_LESS_OR_EQUAL(100, quality1);
TEST_ASSERT_GREATER_OR_EQUAL(0, quality2);
TEST_ASSERT_LESS_OR_EQUAL(100, quality2);
// Stronger signal should have higher quality
TEST_ASSERT_GREATER_THAN(quality3, quality1);
Serial.println("[TEST] getRSSIasQuality() test completed successfully");
}
@@ -0,0 +1,101 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
// Test DNS server is created when portal starts
void test_dns_server_created() {
Serial.println("[TEST] Testing DNS server creation...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
wm.startConfigPortal("TestAP");
wm.process();
// Wait for DNS server to be created
unsigned long start = millis();
while (!wm.getDNSServer() && (millis() - start < 1000)) {
wm.process();
delay(10);
}
// DNS server should be created when portal starts
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
wm.stopConfigPortal();
Serial.println("[TEST] DNS server creation test completed successfully");
}
// Test DNS server cleanup when portal stops
void test_dns_server_cleanup() {
Serial.println("[TEST] Testing DNS server cleanup...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
wm.startConfigPortal("TestAP");
wm.process();
// Wait for DNS server to be created
unsigned long start = millis();
while (!wm.getDNSServer() && (millis() - start < 1000)) {
wm.process();
delay(10);
}
// Verify DNS server exists
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
// Stop portal
wm.stopConfigPortal();
wm.process();
// DNS server should be cleaned up (set to nullptr or deleted)
// Note: Actual cleanup verification depends on implementation
// For now, verify portal is stopped
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] DNS server cleanup test completed successfully");
}
// Test DNS server lifecycle with multiple start/stop cycles
void test_dns_server_lifecycle_cycles() {
Serial.println("[TEST] Testing DNS server lifecycle with multiple cycles...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Cycle 1
wm.startConfigPortal("TestAP1");
wm.process();
unsigned long start = millis();
while (!wm.getDNSServer() && (millis() - start < 1000)) {
wm.process();
delay(10);
}
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
wm.stopConfigPortal();
wm.process();
delay(200);
// Cycle 2
wm.startConfigPortal("TestAP2");
wm.process();
start = millis();
while (!wm.getDNSServer() && (millis() - start < 1000)) {
wm.process();
delay(10);
}
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
wm.stopConfigPortal();
wm.process();
Serial.println("[TEST] DNS server lifecycle cycles test completed successfully");
}
@@ -0,0 +1,181 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
// Test invalid AP password (too short)
void test_invalid_ap_password_too_short() {
Serial.println("[TEST] Testing invalid AP password (too short)...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Password < 8 chars - should handle gracefully
wm.startConfigPortal("TestAP", "short"); // < 8 chars
// Portal should either not start or use default behavior
// Verify it doesn't crash
wm.process();
// Portal may or may not be active (implementation dependent)
// Just verify no crash
if (wm.getConfigPortalActive()) {
wm.stopConfigPortal();
}
TEST_ASSERT_TRUE_MESSAGE(true, "Invalid AP password (too short) handled without crash");
Serial.println("[TEST] Invalid AP password (too short) test completed successfully");
}
// Test invalid AP password (too long)
void test_invalid_ap_password_too_long() {
Serial.println("[TEST] Testing invalid AP password (too long)...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Password > 63 chars - should handle gracefully
String longPassword = String('a', 64); // 64 chars
wm.startConfigPortal("TestAP", longPassword.c_str());
// Portal should handle gracefully
wm.process();
// Portal may or may not be active (implementation dependent)
// Just verify no crash
if (wm.getConfigPortalActive()) {
wm.stopConfigPortal();
}
TEST_ASSERT_TRUE_MESSAGE(true, "Invalid AP password (too long) handled without crash");
Serial.println("[TEST] Invalid AP password (too long) test completed successfully");
}
// Test empty SSID
void test_empty_ssid() {
Serial.println("[TEST] Testing empty SSID...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Empty SSID - should use default AP name
wm.startConfigPortal(""); // Empty SSID
wm.process();
// Portal should start with default name or handle gracefully
if (wm.getConfigPortalActive()) {
String ssid = wm.getConfigPortalSSID();
// Should have a valid SSID (either default or empty handled)
TEST_ASSERT_TRUE_MESSAGE(true, "Empty SSID handled gracefully");
wm.stopConfigPortal();
} else {
TEST_ASSERT_TRUE_MESSAGE(true, "Empty SSID handled gracefully (portal not started)");
}
Serial.println("[TEST] Empty SSID test completed successfully");
}
// Test very long SSID
void test_very_long_ssid() {
Serial.println("[TEST] Testing very long SSID...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Very long SSID (> 32 chars) - should handle gracefully
String longSSID = String('A', 64); // 64 chars
wm.startConfigPortal(longSSID.c_str());
wm.process();
// Portal should handle gracefully (may truncate or reject)
if (wm.getConfigPortalActive()) {
wm.stopConfigPortal();
}
TEST_ASSERT_TRUE_MESSAGE(true, "Very long SSID handled without crash");
Serial.println("[TEST] Very long SSID test completed successfully");
}
// Test connection failure handling
void test_connection_failure_handling() {
Serial.println("[TEST] Testing connection failure handling...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
// Attempt connection via autoConnect (will fail)
wm.setConfigPortalTimeout(5);
bool result = wm.autoConnect("TestAP");
// Should handle failure gracefully
TEST_ASSERT_FALSE(result);
// Verify WiFi state is consistent
wl_status_t status = WiFi.status();
TEST_ASSERT_NOT_EQUAL(WL_CONNECTED, status);
wm.stopConfigPortal();
Serial.println("[TEST] Connection failure handling test completed successfully");
}
// Test resource cleanup after error
void test_resource_cleanup_after_error() {
Serial.println("[TEST] Testing resource cleanup after error...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Stop portal (simulating cleanup after potential error)
wm.stopConfigPortal();
wm.process();
// Verify portal is stopped
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
// Verify we can start again (resources cleaned up)
wm.startConfigPortal("TestAP2");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] Resource cleanup after error test completed successfully");
}
// Test multiple rapid start/stop calls
void test_multiple_rapid_start_stop() {
Serial.println("[TEST] Testing multiple rapid start/stop calls...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Rapid start/stop cycles
for (int i = 0; i < 5; i++) {
wm.startConfigPortal("TestAP");
wm.process();
delay(10);
wm.stopConfigPortal();
wm.process();
delay(10);
}
// Final state should be stopped
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Multiple rapid start/stop calls test completed successfully");
}
@@ -0,0 +1,167 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include <WiFiManagerParameter.h>
#include "../test_main.h"
// Test autoConnect fallback flow
void test_autoconnect_fallback_flow() {
Serial.println("[TEST] Testing autoConnect fallback flow...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
wm.setConfigPortalTimeout(5);
// 1. Device starts
// 2. autoConnect() called with no saved credentials
bool result = wm.autoConnect("TestAP");
// 3. Should fail to connect (no saved credentials)
TEST_ASSERT_FALSE(result);
// 4. Portal should start automatically as fallback
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] autoConnect fallback flow test completed successfully");
}
// Test portal lifecycle with connection attempt
void test_portal_lifecycle_with_connection_attempt() {
Serial.println("[TEST] Testing portal lifecycle with connection attempt...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// 1. Start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// 2. Attempt connection (while portal active) via preloadWiFi
wm.preloadWiFi("NonExistentSSID_12345", "password");
// 3. Verify state handling - portal should still be active
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Connection should fail (verify WiFi is not connected)
wl_status_t status = WiFi.status();
TEST_ASSERT_NOT_EQUAL(WL_CONNECTED, status);
// 4. Stop portal
wm.stopConfigPortal();
wm.process();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Portal lifecycle with connection attempt test completed successfully");
}
// Test parameter add and retrieve in portal
void test_parameter_add_and_retrieve() {
Serial.println("[TEST] Testing parameter add and retrieve in portal...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// 1. Add parameters
WiFiManagerParameter param("server", "Server", "default", 40);
wm.portalAddParameter(&param);
TEST_ASSERT_EQUAL(1, wm.getParametersCount());
// 2. Start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// 3. Verify parameters are accessible
TEST_ASSERT_EQUAL(1, wm.getParametersCount());
WiFiManagerParameter** params = wm.getParameters();
TEST_ASSERT_NOT_NULL(params);
TEST_ASSERT_EQUAL_STRING("server", params[0]->getID());
wm.stopConfigPortal();
Serial.println("[TEST] Parameter add and retrieve in portal test completed successfully");
}
// Test complete flow: reset -> autoConnect -> portal
void test_complete_flow_reset_autoconnect_portal() {
Serial.println("[TEST] Testing complete flow: reset -> autoConnect -> portal...");
WiFiManager wm;
// 1. Reset settings
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings();
delay(100); // Allow WiFi operations to complete
// 2. autoConnect (should fail and start portal)
wm.setConfigPortalTimeout(5);
bool result = wm.autoConnect("TestAP");
// 3. Verify portal started
TEST_ASSERT_FALSE(result); // Connection failed
TEST_ASSERT_TRUE(wm.getConfigPortalActive()); // Portal started
// 4. Process portal
wm.process();
delay(100);
// 5. Verify portal is still active
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// 6. Stop portal
wm.stopConfigPortal();
wm.process();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Complete flow: reset -> autoConnect -> portal test completed successfully");
}
// Test portal with parameters and infrastructure
void test_portal_with_parameters_and_infrastructure() {
Serial.println("[TEST] Testing portal with parameters and infrastructure...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Add parameters
WiFiManagerParameter p1("server", "Server", "192.168.1.1", 40);
WiFiManagerParameter p2("port", "Port", "1883", 6);
wm.portalAddParameter(&p1);
wm.portalAddParameter(&p2);
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
// Verify portal is active
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Verify infrastructure
TEST_ASSERT_NOT_NULL(wm.getServer());
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
// Verify parameters
TEST_ASSERT_EQUAL(2, wm.getParametersCount());
// Verify WiFi mode
WiFiMode_t mode = WiFi.getMode();
TEST_ASSERT_TRUE((mode & WIFI_AP) != 0);
// Verify AP IP
IPAddress apIP = WiFi.softAPIP();
TEST_ASSERT_NOT_EQUAL(IPAddress(0,0,0,0), apIP);
wm.stopConfigPortal();
Serial.println("[TEST] Portal with parameters and infrastructure test completed successfully");
}
@@ -0,0 +1,153 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
// Test process() doesn't block - verify it must be called periodically
void test_nonblocking_process() {
Serial.println("[TEST] Testing process() calls (non-blocking behavior)...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
wm.startConfigPortal("TestAP");
// Verify portal is active
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process multiple times - should not block
for (int i = 0; i < 10; i++) {
unsigned long start = millis();
wm.process();
unsigned long elapsed = millis() - start;
// Each call should be fast (< 100ms) - verifies non-blocking behavior
TEST_ASSERT_LESS_THAN(100, elapsed);
delay(10);
}
// Portal should still be active after multiple process() calls
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] Non-blocking process() test completed successfully");
}
// Test client check setters - verify they don't interfere with portal operation
void test_client_check_setters() {
Serial.println("[TEST] Testing client check setters...");
WiFiManager wm;
// Test AP client check
wm.setAPClientCheck(true);
wm.setAPClientCheck(false);
wm.setConfigPortalTimeout(10);
// Start portal and verify it works with client check settings
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.process();
delay(100);
wm.stopConfigPortal();
// Test web portal client check
wm.setWebPortalClientCheck(true);
wm.setWebPortalClientCheck(false);
// Start web portal and verify it works
wm.setConfigPortalTimeout(5);
wm.startWebPortal();
TEST_ASSERT_TRUE(wm.getWebPortalActive());
wm.process();
wm.stopWebPortal();
Serial.println("[TEST] Client check setters test completed successfully");
}
void test_nonblocking_timeout_behavior() {
Serial.println("[TEST] Testing timeout behavior (requires process() calls)...");
WiFiManager wm;
wm.setConfigPortalTimeout(2); // 2 second timeout
wm.startConfigPortal("TestAP");
unsigned long start = millis();
bool stillActive = true;
// Process until timeout or max wait
while (stillActive && (millis() - start < 5000)) {
wm.process();
// Check if portal is still active (may become inactive after timeout)
if (!wm.getConfigPortalActive()) {
stillActive = false;
break; // Exit loop if portal has closed
}
delay(50);
}
// After timeout, portal should be inactive (may have auto-closed)
// Just verify we can check the state without crashing
bool portalState = wm.getConfigPortalActive();
// Only call stopConfigPortal if portal is still active
// If it auto-closed on timeout, calling stopConfigPortal may crash
if (portalState) {
wm.stopConfigPortal();
}
// Test completed without crash
TEST_ASSERT_TRUE_MESSAGE(true, "Timeout test completed without crash");
Serial.println("[TEST] Timeout behavior test completed successfully");
}
// Test that process() is required for timeouts to work
void test_process_required_for_timeout() {
Serial.println("[TEST] Testing that process() is required for timeouts...");
WiFiManager wm;
wm.setConfigPortalTimeout(1); // 1 second timeout
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Wait 2 seconds WITHOUT calling process()
delay(2000);
// Portal should still be active because process() wasn't called
// (timeout checking only happens in process())
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Now call process() - timeout should be checked
unsigned long start = millis();
bool stillActive = true;
// Process until timeout or max wait
while (stillActive && (millis() - start < 3000)) {
wm.process();
if (!wm.getConfigPortalActive()) {
stillActive = false;
break;
}
delay(50);
}
// Portal should have timed out after process() was called
// (may have auto-closed, but at least we verified process() is needed)
bool portalState = wm.getConfigPortalActive();
if (portalState) {
wm.stopConfigPortal();
}
Serial.println("[TEST] process() required for timeout test completed successfully");
}
@@ -0,0 +1,112 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include <WiFiManagerParameter.h>
#include "../test_main.h"
// Test parameter value set directly
void test_parameter_value_set_directly() {
Serial.println("[TEST] Testing parameter value set directly...");
WiFiManagerParameter param("server", "Server", "default", 40);
// Set value directly
param.setValue("newvalue", 40);
// Verify value was set
TEST_ASSERT_EQUAL_STRING("newvalue", param.getValue());
Serial.println("[TEST] Parameter value set directly test completed successfully");
}
// Test parameter value length validation
void test_parameter_value_length_validation() {
Serial.println("[TEST] Testing parameter value length validation...");
WiFiManagerParameter param("server", "Server", "", 10);
// Set value within length
param.setValue("short", 10);
TEST_ASSERT_EQUAL_STRING("short", param.getValue());
// Set value at length limit
param.setValue("1234567890", 10); // Exactly 10 chars
String value = param.getValue();
TEST_ASSERT_LESS_OR_EQUAL(10, value.length());
Serial.println("[TEST] Parameter value length validation test completed successfully");
}
// Test parameter value persistence
void test_parameter_value_persistence() {
Serial.println("[TEST] Testing parameter value persistence...");
WiFiManager wm;
WiFiManagerParameter param("server", "Server", "default", 40);
wm.portalAddParameter(&param);
// Set value
param.setValue("persisted_value", 40);
TEST_ASSERT_EQUAL_STRING("persisted_value", param.getValue());
// Verify parameter is still accessible through WiFiManager
TEST_ASSERT_EQUAL(1, wm.getParametersCount());
WiFiManagerParameter** params = wm.getParameters();
TEST_ASSERT_NOT_NULL(params);
TEST_ASSERT_EQUAL_STRING("persisted_value", params[0]->getValue());
Serial.println("[TEST] Parameter value persistence test completed successfully");
}
// Test parameter value update
void test_parameter_value_update() {
Serial.println("[TEST] Testing parameter value update...");
WiFiManagerParameter param("server", "Server", "default", 40);
// Set initial value
param.setValue("initial", 40);
TEST_ASSERT_EQUAL_STRING("initial", param.getValue());
// Update value
param.setValue("updated", 40);
TEST_ASSERT_EQUAL_STRING("updated", param.getValue());
Serial.println("[TEST] Parameter value update test completed successfully");
}
// Test multiple parameters with different values
void test_multiple_parameters_different_values() {
Serial.println("[TEST] Testing multiple parameters with different values...");
WiFiManager wm;
WiFiManagerParameter p1("server", "Server", "192.168.1.1", 40);
WiFiManagerParameter p2("port", "Port", "1883", 6);
WiFiManagerParameter p3("key", "Key", "default_key", 32);
wm.portalAddParameter(&p1);
wm.portalAddParameter(&p2);
wm.portalAddParameter(&p3);
// Set different values
p1.setValue("10.0.0.1", 40);
p2.setValue("8883", 6);
p3.setValue("new_key", 32);
// Verify all values are correct
TEST_ASSERT_EQUAL_STRING("10.0.0.1", p1.getValue());
TEST_ASSERT_EQUAL_STRING("8883", p2.getValue());
TEST_ASSERT_EQUAL_STRING("new_key", p3.getValue());
// Verify through WiFiManager
WiFiManagerParameter** params = wm.getParameters();
TEST_ASSERT_EQUAL_STRING("10.0.0.1", params[0]->getValue());
TEST_ASSERT_EQUAL_STRING("8883", params[1]->getValue());
TEST_ASSERT_EQUAL_STRING("new_key", params[2]->getValue());
Serial.println("[TEST] Multiple parameters with different values test completed successfully");
}
@@ -0,0 +1,154 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include <WiFiManagerParameter.h>
// Test custom parameters
void test_create_parameter() {
Serial.println("[TEST] Testing WiFiManagerParameter creation...");
// Create parameter with basic constructor
WiFiManagerParameter param("test_id", "Test Label", "default_value", 40);
// Verify basic getters work
TEST_ASSERT_EQUAL_STRING("test_id", param.getID());
TEST_ASSERT_EQUAL_STRING("Test Label", param.getLabel());
TEST_ASSERT_EQUAL_STRING("default_value", param.getValue());
TEST_ASSERT_EQUAL(40, param.getValueLength());
Serial.println("[TEST] WiFiManagerParameter creation test completed successfully");
}
void test_add_parameter() {
Serial.println("[TEST] Testing portalAddParameter()...");
WiFiManager wm;
WiFiManagerParameter param1("param1", "Parameter 1", "value1", 40);
WiFiManagerParameter param2("param2", "Parameter 2", "value2", 40);
// Add parameters
bool result1 = wm.portalAddParameter(&param1);
bool result2 = wm.portalAddParameter(&param2);
TEST_ASSERT_TRUE(result1);
TEST_ASSERT_TRUE(result2);
// Verify parameters are stored
TEST_ASSERT_EQUAL(2, wm.getParametersCount());
wm.portalClearParameters();
TEST_ASSERT_EQUAL(0, wm.getParametersCount());
Serial.println("[TEST] portalAddParameter() test completed successfully");
}
void test_get_parameters() {
Serial.println("[TEST] Testing getParameters() and getParametersCount()...");
WiFiManager wm;
WiFiManagerParameter param1("param1", "Parameter 1", "value1", 40);
WiFiManagerParameter param2("param2", "Parameter 2", "value2", 40);
WiFiManagerParameter param3("param3", "Parameter 3", "value3", 40);
wm.portalAddParameter(&param1);
wm.portalAddParameter(&param2);
wm.portalAddParameter(&param3);
// Get count
int count = wm.getParametersCount();
TEST_ASSERT_EQUAL(3, count);
// Get parameters array
WiFiManagerParameter** params = wm.getParameters();
TEST_ASSERT_NOT_NULL(params);
// Verify we can access parameters
TEST_ASSERT_EQUAL_STRING("param1", params[0]->getID());
TEST_ASSERT_EQUAL_STRING("param2", params[1]->getID());
TEST_ASSERT_EQUAL_STRING("param3", params[2]->getID());
Serial.println("[TEST] getParameters() test completed successfully");
}
void test_parameter_with_custom_html() {
Serial.println("[TEST] Testing WiFiManagerParameter with custom HTML...");
// Create parameter with custom HTML
const char* custom_html = "<input type='text' name='custom' value='test'>";
WiFiManagerParameter param(custom_html);
// Verify custom HTML is accessible
const char* html = param.getCustomHTML();
TEST_ASSERT_NOT_NULL(html);
Serial.println("[TEST] Parameter with custom HTML test completed successfully");
}
void test_parameter_value_length() {
Serial.println("[TEST] Testing WiFiManagerParameter value length...");
WiFiManagerParameter param("test_id", "Test Label", "default", 10);
TEST_ASSERT_EQUAL(10, param.getValueLength());
// Try to set value within length
param.setValue("short", 10);
TEST_ASSERT_EQUAL_STRING("short", param.getValue());
Serial.println("[TEST] Parameter value length test completed successfully");
}
void test_parameter_label_placement() {
Serial.println("[TEST] Testing WiFiManagerParameter label placement...");
WiFiManagerParameter param("test_id", "Test Label", "default", 40, "", WFM_LABEL_BEFORE);
TEST_ASSERT_EQUAL(WFM_LABEL_BEFORE, param.getLabelPlacement());
WiFiManagerParameter param2("test_id2", "Test Label 2", "default", 40, "", WFM_LABEL_AFTER);
TEST_ASSERT_EQUAL(WFM_LABEL_AFTER, param2.getLabelPlacement());
Serial.println("[TEST] Parameter label placement test completed successfully");
}
void test_multiple_parameters() {
Serial.println("[TEST] Testing multiple parameters...");
WiFiManager wm;
// Add several parameters
WiFiManagerParameter p1("mqtt_server", "MQTT Server", "192.168.1.1", 40);
WiFiManagerParameter p2("mqtt_port", "MQTT Port", "1883", 6);
WiFiManagerParameter p3("api_key", "API Key", "default_key", 32);
wm.portalAddParameter(&p1);
wm.portalAddParameter(&p2);
wm.portalAddParameter(&p3);
TEST_ASSERT_EQUAL(3, wm.getParametersCount());
WiFiManagerParameter** params = wm.getParameters();
// Verify all parameters are accessible
TEST_ASSERT_EQUAL_STRING("mqtt_server", params[0]->getID());
TEST_ASSERT_EQUAL_STRING("mqtt_port", params[1]->getID());
TEST_ASSERT_EQUAL_STRING("api_key", params[2]->getID());
Serial.println("[TEST] Multiple parameters test completed successfully");
}
void test_parameter_placeholder() {
Serial.println("[TEST] Testing WiFiManagerParameter placeholder (deprecated)...");
WiFiManagerParameter param("test_id", "Test Label", "default", 40);
// getPlaceholder() is deprecated but should still work
const char* placeholder = param.getPlaceholder();
// May return label or empty, just verify no crash
TEST_ASSERT_NOT_NULL(placeholder);
Serial.println("[TEST] Parameter placeholder test completed successfully");
}
@@ -0,0 +1,257 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
// Test config portal lifecycle
void test_start_config_portal() {
Serial.println("[TEST] Testing startConfigPortal()...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal with SSID only
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100);
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] startConfigPortal() test completed successfully");
}
void test_start_config_portal_with_password() {
Serial.println("[TEST] Testing startConfigPortal() with password...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal with SSID and password
wm.startConfigPortal("TestAP2", "password123");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100);
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] startConfigPortal() with password test completed successfully");
}
void test_start_config_portal_auto_name() {
Serial.println("[TEST] Testing startConfigPortal() with auto-generated name...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal without SSID (uses chip ID)
wm.startConfigPortal();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100); // Give it time to initialize
// Verify we can get the SSID
String ssid = wm.getConfigPortalSSID();
TEST_ASSERT_GREATER_THAN(0, ssid.length());
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] startConfigPortal() auto-name test completed successfully");
}
void test_stop_config_portal() {
Serial.println("[TEST] Testing stopConfigPortal()...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100);
// Stop portal
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] stopConfigPortal() test completed successfully");
}
void test_config_portal_infrastructure() {
Serial.println("[TEST] Testing config portal infrastructure...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(200); // Give time for initialization
// Verify server object exists (must check while portal is active)
TEST_ASSERT_NOT_NULL_MESSAGE(wm.getServer(), "Server object should exist when portal is active");
// Verify DNS server exists
TEST_ASSERT_NOT_NULL_MESSAGE(wm.getDNSServer(), "DNS server object should exist when portal is active");
// Verify WiFi is in AP mode
WiFiMode_t mode = WiFi.getMode();
TEST_ASSERT_TRUE_MESSAGE((mode & WIFI_AP) != 0, "WiFi should be in AP mode");
// Verify AP has an IP
IPAddress apIP = WiFi.softAPIP();
TEST_ASSERT_NOT_EQUAL(IPAddress(0,0,0,0), apIP);
// Verify AP SSID matches
String apSSID = WiFi.softAPSSID();
TEST_ASSERT_EQUAL_STRING("TestAP", apSSID.c_str());
wm.stopConfigPortal();
Serial.println("[TEST] Config portal infrastructure test completed successfully");
}
void test_start_web_portal() {
Serial.println("[TEST] Testing startWebPortal()...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
// Note: Web portal requires STA mode, but for testing we can just verify it starts
// In real usage, WiFi would need to be connected first
wm.startWebPortal();
TEST_ASSERT_TRUE(wm.getWebPortalActive());
// Call process() to simulate real usage
wm.process();
// Verify server object exists
TEST_ASSERT_NOT_NULL(wm.getServer());
wm.stopWebPortal();
Serial.println("[TEST] startWebPortal() test completed successfully");
}
void test_stop_web_portal() {
Serial.println("[TEST] Testing stopWebPortal()...");
WiFiManager wm;
wm.setConfigPortalTimeout(5);
wm.startWebPortal();
TEST_ASSERT_TRUE(wm.getWebPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100);
wm.stopWebPortal();
TEST_ASSERT_FALSE(wm.getWebPortalActive());
Serial.println("[TEST] stopWebPortal() test completed successfully");
}
void test_config_portal_multiple_start_stop() {
Serial.println("[TEST] Testing multiple config portal start/stop cycles...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// First cycle
wm.startConfigPortal("TestAP1");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.process();
delay(100);
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
delay(200);
// Second cycle
wm.startConfigPortal("TestAP2");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.process();
delay(100);
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
delay(200);
// Third cycle
wm.startConfigPortal("TestAP3");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.process();
delay(100);
wm.stopConfigPortal();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Multiple config portal cycles test completed successfully");
}
void test_config_portal_already_active() {
Serial.println("[TEST] Testing startConfigPortal() when already active...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100);
// Try to start again (should silently fail when already active)
wm.startConfigPortal("TestAP2");
TEST_ASSERT_TRUE(wm.getConfigPortalActive()); // Still active with original AP name
wm.stopConfigPortal();
Serial.println("[TEST] Config portal already active test completed successfully");
}
void test_get_config_portal_ssid() {
Serial.println("[TEST] Testing getConfigPortalSSID()...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start with known SSID
wm.startConfigPortal("MyTestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(100);
// Verify SSID matches what we set
String ssid = wm.getConfigPortalSSID();
TEST_ASSERT_EQUAL_STRING("MyTestAP", ssid.c_str());
wm.stopConfigPortal();
Serial.println("[TEST] getConfigPortalSSID() test completed successfully");
}
@@ -0,0 +1,219 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include <WiFiManagerHandlers.h>
#include <TemplateEngine.h>
#include "templates/RootShell.h"
namespace {
const char kEmptyTemplateChunk[] PROGMEM = "";
const char kTestTitle[] PROGMEM = "WiFiManager";
const char* dynamicStringGetter(void* userData) {
const auto* value = static_cast<const String*>(userData);
return value ? value->c_str() : "";
}
size_t dynamicStringLengthGetter(const char* data, void* /*userData*/) {
return data ? strlen(data) : 0;
}
void configureDescriptor(DynamicDataDescriptor& descriptor, String& value) {
descriptor.getter = &dynamicStringGetter;
descriptor.getLength = &dynamicStringLengthGetter;
descriptor.userData = &value;
}
void renderContextsInterleaved(TemplateContext& first, String& firstOutput,
TemplateContext& second, String& secondOutput) {
uint8_t firstBuffer[31];
uint8_t secondBuffer[31];
bool firstDone = false;
bool secondDone = false;
while (!firstDone || !secondDone) {
if (!firstDone) {
size_t written = TemplateRenderer::renderNextChunk(first, firstBuffer, sizeof(firstBuffer));
if (written == 0) {
firstDone = true;
} else {
firstOutput.concat(reinterpret_cast<const char*>(firstBuffer), written);
}
}
if (!secondDone) {
size_t written = TemplateRenderer::renderNextChunk(second, secondBuffer, sizeof(secondBuffer));
if (written == 0) {
secondDone = true;
} else {
secondOutput.concat(reinterpret_cast<const char*>(secondBuffer), written);
}
}
}
}
} // namespace
void test_bootstrap_json_portal_feature_flags() {
Serial.println("[TEST] Testing bootstrap JSON portal feature flags...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
String idleBootstrap = handlers.buildPortalBootstrapJson();
TEST_ASSERT_EQUAL(-1, idleBootstrap.indexOf(F("\"closeCaptive\":{\"visible\":true")));
wm.wmTestSetPortalActive(true);
wm.portalSetBehaviorCaptivePortalEnabled(true);
String apBootstrap = handlers.buildPortalBootstrapJson();
TEST_ASSERT_NOT_EQUAL(-1, apBootstrap.indexOf(F("\"closeCaptive\":{\"visible\":true")));
TEST_ASSERT_NOT_EQUAL(-1, apBootstrap.indexOf(F("\"exitPortal\":{\"visible\":true")));
wm.wmTestSetPortalActive(false);
Serial.println("[TEST] Bootstrap portal feature flags test completed successfully");
}
void test_bootstrap_json_contract_v2() {
Serial.println("[TEST] Testing bootstrap JSON v2 contract...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
wm.portalSetBrandTitle("Solar Battery Monitor Setup");
wm.portalSetContextIdentityText("Solar Battery Monitor");
wm.portalSetBrandHomeIntro("Connect this device to WiFi and finish setup.");
wm.portalSetBrandLogoSvg("<svg viewBox='0 0 24 24'></svg>");
wm.portalSetPageInfoVisible(true);
wm.portalSetPageUpdateVisible(false);
wm.portalSetPageSetupVisible(true);
wm.portalSetActionEraseVisible(false);
wm.portalSetActionBackVisible(true);
wm.portalSetLayoutParamsLocation(PortalParamsLocation::SetupPage);
wm.setConfigPortalTimeout(90);
PortalHomeCard card;
card.id = "solar";
card.title = "Solar summary";
card.kind = PortalHomeCardKind::KeyValue;
card.items.push_back({"pv", "PV input", "420W"});
wm.portalAddHomeCard(card);
String j = handlers.buildPortalBootstrapJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"contractVersion\":2")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"brand\":{")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"title\":\"Solar Battery Monitor Setup\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"homeIntro\":\"Connect this device to WiFi and finish setup.\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"logoSvg\":\"<svg viewBox='0 0 24 24'></svg>\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"context\":{")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"identityText\":\"Solar Battery Monitor\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"pages\":{")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"setup\":{\"visible\":true}")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"actions\":{")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"erase\":{\"visible\":false}")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"back\":{\"visible\":true}")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"layout\":{\"paramsLocation\":\"setup\"}")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"extraHomeCards\":[")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"id\":\"solar\"")));
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"kind\":\"kv\"")));
wm.startWebPortal();
j = handlers.buildPortalBootstrapJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"portalActive\":true")));
wm.stopWebPortal();
wm.wmTestSetPortalActive(true);
j = handlers.buildPortalBootstrapJson();
TEST_ASSERT_NOT_EQUAL(-1, j.indexOf(F("\"portalTimeoutSecondsRemaining\":")));
TEST_ASSERT_EQUAL(-1, j.indexOf(F("\"portalTimeoutSecondsRemaining\":0")));
wm.wmTestSetPortalActive(false);
Serial.println("[TEST] Bootstrap JSON v2 contract test completed successfully");
}
void test_bootstrap_json_snapshot_consistency() {
Serial.println("[TEST] Testing bootstrap JSON snapshot consistency...");
WiFiManager wm;
WiFiManagerHandlers handlers(&wm);
wm.setConfigPortalTimeout(5);
wm.startConfigPortal("RootSnapshotAP");
wm.process();
delay(100);
String snap1 = handlers.buildPortalBootstrapJson();
String snap2 = handlers.buildPortalBootstrapJson();
TEST_ASSERT_GREATER_THAN(32, snap1.length());
TEST_ASSERT_EQUAL_STRING(snap1.c_str(), snap2.c_str());
wm.stopConfigPortal();
Serial.println("[TEST] Bootstrap JSON snapshot consistency test completed successfully");
}
void test_root_render_interleaved_context_isolation() {
Serial.println("[TEST] Testing root render interleaved context isolation...");
PlaceholderRegistry registryA(8);
PlaceholderRegistry registryB(8);
registryA.registerProgmemData("%STYLES%", kEmptyTemplateChunk);
registryA.registerProgmemData("%PAGE_TITLE%", kTestTitle);
registryA.registerProgmemData("%PORTAL_APPEND_JS%", kEmptyTemplateChunk);
registryB.registerProgmemData("%STYLES%", kEmptyTemplateChunk);
registryB.registerProgmemData("%PAGE_TITLE%", kTestTitle);
registryB.registerProgmemData("%PORTAL_APPEND_JS%", kEmptyTemplateChunk);
String bootstrapA = F("{\"ctx\":\"A\"}");
String appJsA = F("// shell A");
String bootstrapB = F("{\"ctx\":\"B\"}");
String appJsB = F("// shell B");
DynamicDataDescriptor bootstrapDescriptorA{};
DynamicDataDescriptor appJsDescriptorA{};
DynamicDataDescriptor bootstrapDescriptorB{};
DynamicDataDescriptor appJsDescriptorB{};
configureDescriptor(bootstrapDescriptorA, bootstrapA);
configureDescriptor(appJsDescriptorA, appJsA);
configureDescriptor(bootstrapDescriptorB, bootstrapB);
configureDescriptor(appJsDescriptorB, appJsB);
TEST_ASSERT_TRUE_MESSAGE(registryA.registerDynamicData("%BOOTSTRAP_JSON%", &bootstrapDescriptorA),
"Registry A bootstrap placeholder should register");
TEST_ASSERT_TRUE_MESSAGE(registryA.registerDynamicData("%PORTAL_APP_JS%", &appJsDescriptorA),
"Registry A app JS placeholder should register");
TEST_ASSERT_TRUE_MESSAGE(registryB.registerDynamicData("%BOOTSTRAP_JSON%", &bootstrapDescriptorB),
"Registry B bootstrap placeholder should register");
TEST_ASSERT_TRUE_MESSAGE(registryB.registerDynamicData("%PORTAL_APP_JS%", &appJsDescriptorB),
"Registry B app JS placeholder should register");
TemplateContext contextA;
TemplateContext contextB;
contextA.setRegistry(&registryA);
contextB.setRegistry(&registryB);
TemplateRenderer::initializeContext(contextA, WM_ROOT_SHELL_TEMPLATE);
TemplateRenderer::initializeContext(contextB, WM_ROOT_SHELL_TEMPLATE);
String outputA;
String outputB;
renderContextsInterleaved(contextA, outputA, contextB, outputB);
TEST_ASSERT_NOT_EQUAL(-1, outputA.indexOf("{\"ctx\":\"A\"}"));
TEST_ASSERT_NOT_EQUAL(-1, outputA.indexOf("// shell A"));
TEST_ASSERT_EQUAL(-1, outputA.indexOf("{\"ctx\":\"B\"}"));
TEST_ASSERT_EQUAL(-1, outputA.indexOf("// shell B"));
TEST_ASSERT_NOT_EQUAL(-1, outputB.indexOf("{\"ctx\":\"B\"}"));
TEST_ASSERT_NOT_EQUAL(-1, outputB.indexOf("// shell B"));
TEST_ASSERT_EQUAL(-1, outputB.indexOf("{\"ctx\":\"A\"}"));
TEST_ASSERT_EQUAL(-1, outputB.indexOf("// shell A"));
Serial.println("[TEST] Root render interleaved context isolation test completed successfully");
}
@@ -0,0 +1,131 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
// Test portal to connected transition (state consistency)
void test_portal_to_connected_transition() {
Serial.println("[TEST] Testing portal to connected transition...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
// Verify portal is active
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
TEST_ASSERT_FALSE(wm.getWebPortalActive());
// Portal state should be consistent
// While portal is active, WiFi should be in AP mode
WiFiMode_t mode = WiFi.getMode();
TEST_ASSERT_TRUE((mode & WIFI_AP) != 0);
// Stop portal
wm.stopConfigPortal();
wm.process();
// Verify portal is stopped
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Portal to connected transition test completed successfully");
}
// Test concurrent operations (portal + connection attempt)
void test_concurrent_operations() {
Serial.println("[TEST] Testing concurrent operations...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Attempt connection while portal is active (via preloadWiFi)
// This should either be ignored or handled gracefully
wm.preloadWiFi("NonExistentSSID_12345", "password");
// Portal should still be active (connection attempt shouldn't stop it)
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Verify WiFi is not connected (SSID doesn't exist)
wl_status_t status = WiFi.status();
TEST_ASSERT_NOT_EQUAL(WL_CONNECTED, status);
wm.stopConfigPortal();
Serial.println("[TEST] Concurrent operations test completed successfully");
}
// Test state consistency during portal operation
void test_state_consistency_during_portal() {
Serial.println("[TEST] Testing state consistency during portal operation...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
// Verify state consistency
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
TEST_ASSERT_NOT_NULL(wm.getServer());
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
// Process multiple times
for (int i = 0; i < 10; i++) {
wm.process();
delay(10);
// State should remain consistent
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
}
wm.stopConfigPortal();
wm.process();
// After stop, portal should be inactive
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] State consistency during portal operation test completed successfully");
}
// Test state transitions with multiple start/stop cycles
void test_state_transitions_multiple_cycles() {
Serial.println("[TEST] Testing state transitions with multiple cycles...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
for (int cycle = 0; cycle < 3; cycle++) {
// Start state
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Active state
wm.process();
delay(100);
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Stop portal
wm.stopConfigPortal();
wm.process();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
delay(100);
}
Serial.println("[TEST] State transitions with multiple cycles test completed successfully");
}
@@ -0,0 +1,93 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
// Test static IP configuration
// Test AP static IP configuration - verifies IP is actually applied
void test_set_ap_static_ip_config() {
Serial.println("[TEST] Testing setAPStaticIPConfig()...");
WiFiManager wm;
IPAddress ip(192, 168, 4, 1);
IPAddress gw(192, 168, 4, 1);
IPAddress sn(255, 255, 255, 0);
// Set AP static IP
wm.setAPStaticIPConfig(ip, gw, sn);
wm.setConfigPortalTimeout(10);
// Start portal and verify IP is actually set
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(200); // Give time for IP to be configured
// Verify AP IP matches what we configured
IPAddress apIP = WiFi.softAPIP();
TEST_ASSERT_EQUAL(ip, apIP);
wm.stopConfigPortal();
Serial.println("[TEST] setAPStaticIPConfig() test completed successfully");
}
// Test STA static IP configuration - consolidated
void test_sta_static_ip_configuration() {
Serial.println("[TEST] Testing STA static IP configuration...");
WiFiManager wm;
IPAddress ip(192, 168, 1, 100);
IPAddress gw(192, 168, 1, 1);
IPAddress sn(255, 255, 255, 0);
IPAddress dns(8, 8, 8, 8);
// Test setSTAStaticIPConfig without DNS
wm.setSTAStaticIPConfig(ip, gw, sn);
// Test setSTAStaticIPConfig with DNS
wm.setSTAStaticIPConfig(ip, gw, sn, dns);
// Verify no crash
TEST_ASSERT_TRUE_MESSAGE(true, "STA static IP configuration setters executed without crash");
Serial.println("[TEST] STA static IP configuration test completed successfully");
}
// Note: test_show_static_fields and test_show_dns_fields removed -
// already covered in test_configuration_setters() in test_configuration.cpp
void test_ap_static_ip_application() {
Serial.println("[TEST] Testing AP static IP application...");
WiFiManager wm;
IPAddress customIP(10, 0, 1, 1);
IPAddress customGW(10, 0, 1, 1);
IPAddress customSN(255, 255, 255, 0);
wm.setAPStaticIPConfig(customIP, customGW, customSN);
wm.setConfigPortalTimeout(10);
wm.startConfigPortal("TestAP");
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Call process() to simulate real usage
wm.process();
delay(200); // Give time for AP to configure
IPAddress apIP = WiFi.softAPIP();
// AP should have the configured IP
TEST_ASSERT_EQUAL(customIP, apIP);
wm.stopConfigPortal();
Serial.println("[TEST] AP static IP application test completed successfully");
}
+176
View File
@@ -0,0 +1,176 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include <WiFiManagerParameter.h>
#include "../test_main.h"
// Test many start/stop cycles for memory leaks
void test_many_start_stop_cycles() {
Serial.println("[TEST] Testing many start/stop cycles for memory leaks...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Test 10 start/stop cycles (enough to verify memory leaks and resource cleanup)
for (int i = 0; i < 10; i++) {
wm.startConfigPortal("TestAP");
wm.process();
// Verify portal started
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
wm.process();
// Verify portal stopped
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
delay(10); // Small delay between cycles
}
// Verify no crashes or memory leaks (by checking we can still start/stop)
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] Many start/stop cycles test completed successfully");
}
// Test long running portal
void test_long_running_portal() {
Serial.println("[TEST] Testing long running portal...");
WiFiManager wm;
wm.setConfigPortalTimeout(30); // Longer timeout for long running test
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Process for extended period (enough to verify stability)
for (int i = 0; i < 50; i++) {
wm.process();
// Verify portal remains active
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Verify infrastructure remains
TEST_ASSERT_NOT_NULL(wm.getServer());
TEST_ASSERT_NOT_NULL(wm.getDNSServer());
delay(10);
}
wm.stopConfigPortal();
wm.process();
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Long running portal test completed successfully");
}
// Test rapid portal start/stop
void test_rapid_portal_start_stop() {
Serial.println("[TEST] Testing rapid portal start/stop...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Rapid start/stop cycles (reduced for faster execution)
for (int i = 0; i < 5; i++) {
wm.startConfigPortal("TestAP");
wm.process();
wm.stopConfigPortal();
wm.process();
}
// Verify final state
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
// Verify we can still start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] Rapid portal start/stop test completed successfully");
}
// Test multiple parameters stress
void test_multiple_parameters_stress() {
Serial.println("[TEST] Testing multiple parameters stress...");
WiFiManager wm;
wm.setConfigPortalTimeout(10);
// Add many parameters
WiFiManagerParameter* params[20];
for (int i = 0; i < 20; i++) {
char id[20];
char label[30];
sprintf(id, "param%d", i);
sprintf(label, "Parameter %d", i);
params[i] = new WiFiManagerParameter(id, label, "default", 40);
wm.portalAddParameter(params[i]);
}
TEST_ASSERT_EQUAL(20, wm.getParametersCount());
// Start portal
wm.startConfigPortal("TestAP");
wm.process();
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
// Verify all parameters accessible
WiFiManagerParameter** paramArray = wm.getParameters();
for (int i = 0; i < 20; i++) {
TEST_ASSERT_NOT_NULL(paramArray[i]);
}
wm.stopConfigPortal();
// Cleanup - Parameters are managed by WiFiManager, but we allocated with new
// Note: WiFiManagerParameter doesn't have virtual destructor, but this is just cleanup
for (int i = 0; i < 20; i++) {
delete params[i];
}
Serial.println("[TEST] Multiple parameters stress test completed successfully");
}
// Test portal with timeout stress
void test_portal_with_timeout_stress() {
Serial.println("[TEST] Testing portal with timeout stress...");
WiFiManager wm;
// Multiple cycles with different timeouts
for (int timeout = 1; timeout <= 5; timeout++) {
wm.setConfigPortalTimeout(timeout);
wm.startConfigPortal("TestAP");
wm.process();
// Process until timeout or max wait
unsigned long start = millis();
unsigned long maxWait = (timeout + 1) * 1000UL;
while (wm.getConfigPortalActive() && (millis() - start < maxWait)) {
wm.process();
delay(50);
}
// Portal may have timed out or still be active
if (wm.getConfigPortalActive()) {
wm.stopConfigPortal();
}
wm.process();
delay(100);
}
// Verify final state
TEST_ASSERT_FALSE(wm.getConfigPortalActive());
Serial.println("[TEST] Portal with timeout stress test completed successfully");
}
@@ -0,0 +1,104 @@
#include <unity.h>
#include <Arduino.h>
#include <TemplateEngine.h>
#include "templates/RootShell.h"
#include "templates/PortalAppJS.h"
#include "../test_main.h"
namespace {
String renderTemplate(const char* templateData, PlaceholderRegistry& registry) {
TemplateContext context;
context.setRegistry(&registry);
TemplateRenderer::initializeContext(context, templateData);
uint8_t buffer[128];
String output;
while (true) {
size_t written = TemplateRenderer::renderNextChunk(context, buffer, sizeof(buffer));
if (written == 0) {
break;
}
output.concat(reinterpret_cast<const char*>(buffer), written);
}
return output;
}
const char kEmpty[] PROGMEM = "";
const char kDocTitle[] PROGMEM = "Config ESP";
const char kBootstrapJson[] PROGMEM = "{\"title\":\"Test\"}";
const char kPortalAppJs[] PROGMEM = "console.log('portal');";
const char kPortalAppendJs[] PROGMEM = "";
const char* dynamicStringGetter(void* userData) {
const auto* value = static_cast<const String*>(userData);
return value ? value->c_str() : "";
}
size_t dynamicStringLengthGetter(const char* data, void* /*userData*/) {
return data ? strlen(data) : 0;
}
void configureDescriptor(DynamicDataDescriptor& descriptor, String& value) {
descriptor.getter = &dynamicStringGetter;
descriptor.getLength = &dynamicStringLengthGetter;
descriptor.userData = &value;
}
} // namespace
void test_shell_template_renders_core_placeholders() {
Serial.println("[TEST] Testing portal shell template rendering...");
PlaceholderRegistry registry(8);
registry.registerProgmemData("%STYLES%", kEmpty);
registry.registerProgmemData("%PAGE_TITLE%", kDocTitle);
registry.registerProgmemData("%BOOTSTRAP_JSON%", kBootstrapJson);
registry.registerProgmemData("%PORTAL_APP_JS%", kPortalAppJs);
registry.registerProgmemData("%PORTAL_APPEND_JS%", kPortalAppendJs);
String output = renderTemplate(WM_ROOT_SHELL_TEMPLATE, registry);
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("<title>Config ESP</title>"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("<div id='app'></div>"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("id='wm-toast'"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("id='wm-dialog'"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("id='wm-bootstrap'"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("{\"title\":\"Test\"}"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("console.log('portal')"));
Serial.println("[TEST] Portal shell template rendering test completed successfully");
}
void test_shell_template_renders_dynamic_styles_with_percent_values() {
Serial.println("[TEST] Testing portal shell dynamic styles placeholder with percent values...");
PlaceholderRegistry registry(8);
String styles = F("<style>body{width:100%;max-width:92%}</style>");
String title = F("Config ESP");
String bootstrap = F("{\"title\":\"Test\"}");
String appendJs = F("");
DynamicDataDescriptor stylesDescriptor{};
DynamicDataDescriptor titleDescriptor{};
DynamicDataDescriptor bootstrapDescriptor{};
DynamicDataDescriptor appendJsDescriptor{};
configureDescriptor(stylesDescriptor, styles);
configureDescriptor(titleDescriptor, title);
configureDescriptor(bootstrapDescriptor, bootstrap);
configureDescriptor(appendJsDescriptor, appendJs);
TEST_ASSERT_TRUE(registry.registerDynamicData("%STYLES%", &stylesDescriptor));
TEST_ASSERT_TRUE(registry.registerDynamicData("%PAGE_TITLE%", &titleDescriptor));
TEST_ASSERT_TRUE(registry.registerDynamicData("%BOOTSTRAP_JSON%", &bootstrapDescriptor));
TEST_ASSERT_TRUE(registry.registerProgmemData("%PORTAL_APP_JS%", kPortalAppJs));
TEST_ASSERT_TRUE(registry.registerDynamicData("%PORTAL_APPEND_JS%", &appendJsDescriptor));
String output = renderTemplate(WM_ROOT_SHELL_TEMPLATE, registry);
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("<style>body{width:100%;max-width:92%}</style>"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("<title>Config ESP</title>"));
TEST_ASSERT_NOT_EQUAL(-1, output.indexOf("{\"title\":\"Test\"}"));
Serial.println("[TEST] Dynamic styles placeholder percent rendering test completed successfully");
}
@@ -0,0 +1,164 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
// Test autoConnect fallback to portal when no saved credentials
void test_autoconnect_fallback_to_portal() {
Serial.println("[TEST] Testing autoConnect fallback to portal...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
wm.setConfigPortalTimeout(5);
bool result = wm.autoConnect("TestAP");
// Should fail to connect (no saved credentials)
TEST_ASSERT_FALSE(result);
// Should start portal as fallback
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] autoConnect fallback to portal test completed successfully");
}
// Test connectWifi with non-existent SSID (using autoConnect instead)
void test_connectwifi_ssid_not_found() {
Serial.println("[TEST] Testing connection with non-existent SSID...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
// Use autoConnect with non-existent SSID (will fail to connect)
wm.setConfigPortalTimeout(5);
bool result = wm.autoConnect("TestAP");
// Should fail to connect (no saved credentials or SSID not found)
TEST_ASSERT_FALSE(result);
// Verify WiFi is not connected
wl_status_t status = WiFi.status();
TEST_ASSERT_NOT_EQUAL(WL_CONNECTED, status);
wm.stopConfigPortal();
Serial.println("[TEST] Connection with non-existent SSID test completed successfully");
}
// Test connect retry count setting
void test_connectwifi_retry_count() {
Serial.println("[TEST] Testing connect retry count setting...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
// Set retry count
wm.setConnectRetries(3);
// Verify setting is stored (by attempting connection via autoConnect)
// The retry logic should be called internally
wm.setConfigPortalTimeout(5);
bool result = wm.autoConnect("TestAP");
// Should fail (not connected)
TEST_ASSERT_FALSE(result);
// Verify no crash with retry setting
TEST_ASSERT_TRUE_MESSAGE(true, "autoConnect with retry count executed without crash");
wm.stopConfigPortal();
Serial.println("[TEST] Connect retry count test completed successfully");
}
// Test connect timeout setting
void test_connectwifi_timeout_setting() {
Serial.println("[TEST] Testing connect timeout setting...");
WiFiManager wm;
// Ensure WiFi is in a stable state before resetting
delay(100);
wm.resetSettings(); // Clear saved credentials
// Allow WiFi operations to complete
delay(100);
// Set timeout
wm.setConnectTimeout(5);
// Verify timeout setting is used (by attempting connection via autoConnect)
wm.setConfigPortalTimeout(5);
bool result = wm.autoConnect("TestAP");
// Should fail (not connected)
TEST_ASSERT_FALSE(result);
// Verify no crash with timeout setting
TEST_ASSERT_TRUE_MESSAGE(true, "autoConnect with timeout setting executed without crash");
wm.stopConfigPortal();
Serial.println("[TEST] Connect timeout setting test completed successfully");
}
// Test connection state transitions
void test_connection_state_transitions() {
Serial.println("[TEST] Testing connection state transitions...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
// Attempt connection via autoConnect (will fail)
wm.setConfigPortalTimeout(5);
wm.autoConnect("TestAP");
// Wait a bit for state to potentially change
delay(100);
// Verify state transition (may be IDLE, DISCONNECTED, or NO_SSID_AVAIL)
wl_status_t finalStatus = WiFi.status();
// Should not be CONNECTED (since no saved credentials)
TEST_ASSERT_NOT_EQUAL(WL_CONNECTED, finalStatus);
wm.stopConfigPortal();
Serial.println("[TEST] Connection state transitions test completed successfully");
}
// Test autoConnect with timeout
void test_autoconnect_with_timeout() {
Serial.println("[TEST] Testing autoConnect with timeout...");
WiFiManager wm;
delay(100); // Ensure WiFi is in a stable state
wm.resetSettings(); // Clear saved credentials
delay(100); // Allow WiFi operations to complete
wm.setConfigPortalTimeout(5);
wm.setConnectTimeout(3);
bool result = wm.autoConnect("TestAP");
// Should fail to connect (no saved credentials)
TEST_ASSERT_FALSE(result);
// Should start portal as fallback
TEST_ASSERT_TRUE(wm.getConfigPortalActive());
wm.stopConfigPortal();
Serial.println("[TEST] autoConnect with timeout test completed successfully");
}
@@ -0,0 +1,152 @@
#include <unity.h>
#include <Arduino.h>
#include <WiFiManager.h>
#include "../test_main.h"
void test_wifi_scan_initiates() {
Serial.println("[TEST] Testing async scan request queues...");
WiFiManager wm;
wm.requestAsyncScan(true);
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_QUEUED, wm.getScanState());
TEST_ASSERT_TRUE_MESSAGE(wm.getScanSnapshot().schedulePending,
"Explicit refresh should mark scan scheduling as pending");
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_SCHEDULE_USER_REFRESH,
wm.getScanSnapshot().scheduledReason);
TEST_ASSERT_FALSE_MESSAGE(wm.hasValidScanResults(),
"Queueing a scan should invalidate previous cached results");
Serial.println("[TEST] Async scan request queues test completed successfully");
}
void test_async_scan_behavior() {
Serial.println("[TEST] Testing repeated scan requests coalesce...");
WiFiManager wm;
wm.requestAsyncScan(true);
wm.requestAsyncScan(true);
wm.requestAsyncScan(true);
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_QUEUED, wm.getScanState());
TEST_ASSERT_TRUE_MESSAGE(wm.getScanSnapshot().schedulePending,
"Repeated refresh clicks should still leave one pending schedule");
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_SCHEDULE_USER_REFRESH,
wm.getScanSnapshot().scheduledReason);
TEST_ASSERT_FALSE_MESSAGE(wm.hasValidScanResults(),
"Repeated refresh requests should keep a single queued scan lifecycle");
Serial.println("[TEST] Repeated scan requests coalesce test completed successfully");
}
void test_scan_status_checking() {
Serial.println("[TEST] Testing cached scan snapshot state...");
WiFiManager wm;
#ifdef UNIT_TEST
std::vector<WiFiManager::WiFiScanNetwork> results = {
{ "Office", -48, 1 },
{ "Guest", -70, 0 }
};
wm.wmTestInjectScanResults(results);
TEST_ASSERT_TRUE_MESSAGE(wm.hasValidScanResults(),
"Injected scan snapshot should be marked valid");
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_COMPLETE, wm.getScanState());
TEST_ASSERT_EQUAL(static_cast<size_t>(2), wm.getScanResults().size());
TEST_ASSERT_EQUAL_STRING("Office", wm.getScanResults()[0].ssid.c_str());
#else
TEST_IGNORE_MESSAGE("UNIT_TEST helpers unavailable");
#endif
Serial.println("[TEST] Cached scan snapshot state test completed successfully");
}
void test_scan_completion_wait() {
Serial.println("[TEST] Testing scan timeout transition...");
WiFiManager wm;
#ifdef UNIT_TEST
wm.wmTestSetPortalActive(true);
wm.wmTestForceScanState(WiFiManager::WM_SCAN_RUNNING);
wm.wmTestSetScanStartedAt(millis() - 20000);
wm.wmTestSetScanTimeoutMs(1000);
wm.process();
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_TIMEOUT, wm.getScanState());
TEST_ASSERT_FALSE_MESSAGE(wm.hasValidScanResults(),
"Timed out scans should not leave cached results marked valid");
#else
TEST_IGNORE_MESSAGE("UNIT_TEST helpers unavailable");
#endif
Serial.println("[TEST] Scan timeout transition test completed successfully");
}
void test_scan_cancels_when_connect_pending() {
Serial.println("[TEST] Testing scan cancellation during connect...");
WiFiManager wm;
#ifdef UNIT_TEST
wm.wmTestSetPortalActive(true);
wm.wmTestForceScanState(WiFiManager::WM_SCAN_RUNNING);
wm.wmTestSetScanStartedAt(millis());
wm.wmTestSetConnectPending(true);
wm.process();
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_IDLE, wm.getScanState());
TEST_ASSERT_FALSE_MESSAGE(wm.getScanSnapshot().schedulePending,
"Connect flow should cancel any in-flight async scan");
#else
TEST_IGNORE_MESSAGE("UNIT_TEST helpers unavailable");
#endif
Serial.println("[TEST] Scan cancellation during connect test completed successfully");
}
void test_scan_cancels_when_lifecycle_blocked() {
Serial.println("[TEST] Testing scan cancellation during lifecycle block...");
WiFiManager wm;
#ifdef UNIT_TEST
wm.wmTestSetPortalActive(true);
wm.requestAsyncScan(true);
wm.wmTestSetScanLifecycleBlocked(true);
wm.process();
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_IDLE, wm.getScanState());
TEST_ASSERT_FALSE_MESSAGE(wm.getScanSnapshot().schedulePending,
"Lifecycle blocking should leave scan engine idle");
#else
TEST_IGNORE_MESSAGE("UNIT_TEST helpers unavailable");
#endif
Serial.println("[TEST] Scan cancellation during lifecycle block test completed successfully");
}
void test_scan_generation_invalidated_on_reset() {
Serial.println("[TEST] Testing scan generation invalidation on reset...");
WiFiManager wm;
#ifdef UNIT_TEST
wm.wmTestSetScanGenerations(4, 4, 4);
wm.wmTestSetScanCompletionPending(3);
wm.wmTestClearScanResults();
TEST_ASSERT_EQUAL(WiFiManager::WM_SCAN_IDLE, wm.getScanState());
TEST_ASSERT_TRUE_MESSAGE(wm.getScanSnapshot().generation > 4,
"Resetting scan state should invalidate older completion generations");
TEST_ASSERT_FALSE_MESSAGE(wm.getScanSnapshot().completionPending,
"Resetting scan state should clear pending completion callbacks");
#else
TEST_IGNORE_MESSAGE("UNIT_TEST helpers unavailable");
#endif
Serial.println("[TEST] Scan generation invalidation on reset test completed successfully");
}