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 ✅
This commit is contained in:
2025-11-02 01:05:34 +10:00
parent 32655b7226
commit 2b40362ff7
18 changed files with 129 additions and 221 deletions
+32 -10
View File
@@ -1,13 +1,35 @@
.pio
.cache
.pioenvs
.piolibdeps
.idea
.vscode
# 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
/build_output/
# OS
.DS_Store
.gitignore
.clang-format
node_modules
Thumbs.db
# Build artifacts
*.o
*.elf
*.hex
*.bin
*.log
# Misc
node_modules/
-42
View File
@@ -1,42 +0,0 @@
language: c
sudo: false
before_install:
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
- sleep 3
- export DISPLAY=:1.0
- wget http://downloads.arduino.cc/arduino-1.8.10-linux64.tar.xz
- tar xf arduino-1.8.10-linux64.tar.xz
- sudo mv arduino-1.8.10 /usr/local/share/arduino
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
install:
- ln -s $PWD /usr/local/share/arduino/libraries/WiFiManager
- arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json,http://dl.espressif.com/dl/package_esp32_index.json" --save-prefs
- arduino --install-library "ArduinoJson:6.18.0"
- arduino --install-boards esp8266:esp8266
- arduino --pref "compiler.warning_level=all" --save-prefs
# install esp32
- arduino --install-boards esp32:esp32
script:
- "echo $PWD"
- "echo $HOME"
- "ls $PWD"
- source $TRAVIS_BUILD_DIR/travis/common.sh
- arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,dbg=Serial,lvl=CORE --save-prefs
- build_examples
- arduino --board esp32:esp32:esp32:FlashFreq=80,FlashSize=4M,DebugLevel=info --save-prefs
# some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them
- build_examples
# - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino
# no coverage generated, no need to run
#
#after_success:
# - bash <(curl -s https://codecov.io/bash)
notifications:
email:
on_success: change
on_failure: change
-9
View File
@@ -1,9 +0,0 @@
cmake_minimum_required(VERSION 3.5)
idf_component_register(
SRCS "WiFiManager.cpp"
INCLUDE_DIRS "."
PRIV_REQUIRES arduino
)
project(WiFiManager)
+5
View File
@@ -20,3 +20,8 @@ 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 fork maintained for internal use and optimized for PlatformIO
+48 -38
View File
@@ -3,6 +3,8 @@
Espressif ESPx WiFi Connection manager with fallback web configuration portal
> **Note**: This is a fork maintained for internal use. The original project is maintained by [tzapu](https://github.com/tzapu/WiFiManager). This fork is optimized for PlatformIO usage.
:warning: This Documentation is out of date, see notes below
<a name="release"></a>
@@ -34,7 +36,7 @@ Works with the [ESP8266 Arduino](https://github.com/esp8266/Arduino) and [ESP32
### Known Issues
* Documentation needs to be updated, see [https://github.com/tzapu/WiFiManager/issues/500](https://github.com/tzapu/WiFiManager/issues/500)
* Documentation needs to be updated, see [upstream issue #500](https://github.com/tzapu/WiFiManager/issues/500)
-------
## Contents
@@ -116,26 +118,58 @@ Works with the [ESP8266 Arduino](https://github.com/esp8266/Arduino) and [ESP32
## Quick Start
### Installing
You can either install through the Arduino Library Manager or checkout the latest changes or a release from github
#### Install through Library Manager
__Currently version 0.8+ works with release 2.4.0 or newer of the [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)__
- in Arduino IDE got to Sketch/Include Library/Manage Libraries
![Manage Libraries](http://i.imgur.com/9BkEBkR.png)
This fork is optimized for PlatformIO. The recommended installation methods are:
- search for WiFiManager
![WiFiManager package](http://i.imgur.com/18yIai8.png)
#### Install Using PlatformIO (Recommended)
- click Install and start [using it](#using)
[PlatformIO](https://platformio.org/) is the recommended ecosystem for IoT development with ESP8266/ESP32.
#### Checkout from github
__Github version works with release 2.4.0 or newer of the [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)__
- Checkout library to your Arduino libraries folder
**Option 1: Using local path (recommended for forks)**
Add to your `platformio.ini`:
```ini
[env:your_environment]
platform = espressif8266 ; or espressif32
board = d1_mini ; your board
framework = arduino
lib_deps =
path = ../../../WiFiManager ; Relative path to this library
```
**Option 2: From Git repository**
Add to your `platformio.ini`:
```ini
[env:your_environment]
platform = espressif8266
board = d1_mini
framework = arduino
lib_deps =
https://github.com/alexhopeoconnor/WiFiManager.git
```
**Option 3: Using PlatformIO Library Manager**
If you want to use the upstream version from the PlatformIO library registry:
```ini
lib_deps =
WiFiManager
```
#### Arduino IDE Installation
> **Note**: This fork is optimized for PlatformIO. For Arduino IDE usage, consider using the [original library](https://github.com/tzapu/WiFiManager) or install manually.
To use this fork in Arduino IDE:
1. Clone this repository to your Arduino libraries folder
2. Rename the folder to `WiFiManager`
3. Restart Arduino IDE
### Using
- Include in your sketch
```cpp
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic
#include <WiFiManager.h>
```
- Initialize library, in your setup function add, NOTEif you are using non blocking you will make sure you create this in global scope or handle appropriatly , it will not work if in setup and using non blocking mode.
@@ -160,31 +194,7 @@ wifiManager.autoConnect();
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.
Also see [examples](https://github.com/tzapu/WiFiManager/tree/master/examples).
#### Install Using PlatformIO
[PlatformIO](https://platformio.org/) is an emerging ecosystem for IoT development, and
is an alternative to using the Arduino IDE. Install `WiFiManager`
using the platformio [library manager](https://docs.platformio.org/en/latest/librarymanager/index.html#librarymanager) in your editor,
or using the [PlatformIO Core CLI](https://docs.platformio.org/en/latest/core/index.html),
or by adding it to your `platformio.ini` as shown below (recommended approach).
The simplest way is to open the `platformio.ini` file at the root of your project, and `WifiManager` to the common top-level env
`lib_deps` key like so:
```
[env]
lib_deps =
WiFiManager
```
```
[env]
lib_deps =
https://github.com/tzapu/WiFiManager.git
```
Also see [examples](examples/) in this repository.
## Documentation
-39
View File
@@ -1,39 +0,0 @@
#######################################
# Syntax Coloring Map For WifiManager
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
WiFiManager KEYWORD1
WiFiManagerParameter KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
autoConnect KEYWORD2
getSSID KEYWORD2
getPassword KEYWORD2
getConfigPortalSSID KEYWORD2
resetSettings KEYWORD2
setConfigPortalTimeout KEYWORD2
setConnectTimeout KEYWORD2
setDebugOutput KEYWORD2
setMinimumSignalQuality KEYWORD2
setAPStaticIPConfig KEYWORD2
setSTAStaticIPConfig KEYWORD2
setAPCallback KEYWORD2
setSaveConfigCallback KEYWORD2
addParameter KEYWORD2
getID KEYWORD2
getValue KEYWORD2
getPlaceholder KEYWORD2
getValueLength KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################
# LITERAL1
+25 -14
View File
@@ -1,29 +1,40 @@
{
"name": "WiFiManager",
"version": "2.0.17",
"keywords": "wifi,wi-fi,esp,esp8266,esp32,espressif8266,espressif32,nodemcu,wemos,arduino",
"keywords": [
"wifi",
"wi-fi",
"esp",
"esp8266",
"esp32",
"espressif8266",
"espressif32",
"nodemcu",
"wemos",
"arduino"
],
"description": "WiFi Configuration manager with web configuration portal for ESP boards",
"authors":
[
"authors": [
{
"name": "tzapu",
"url": "https://github.com/tzapu"
"name": "tzapu",
"url": "https://github.com/tzapu"
},
{
"name": "tablatronix",
"url": "https://github.com/tablatronix",
"maintainer": true
"name": "tablatronix",
"url": "https://github.com/tablatronix",
"maintainer": true
}
],
"repository":
{
"repository": {
"type": "git",
"url": "https://github.com/tzapu/WiFiManager.git"
"url": "https://github.com/alexhopeoconnor/WiFiManager.git"
},
"frameworks": "arduino",
"platforms":
[
"platforms": [
"espressif8266",
"espressif32"
]
],
"export": {
"include": "include"
}
}
-9
View File
@@ -1,9 +0,0 @@
name=WiFiManager
version=2.0.17
author=tzapu
maintainer=tablatronix
sentence=WiFi Configuration manager with web configuration portal for Espressif ESPx boards, by tzapu
paragraph=Library for configuring ESP8266/ESP32 modules WiFi credentials and custom parameters at runtime with captive portal.
category=Communication
url=https://github.com/tzapu/WiFiManager.git
architectures=esp8266,esp32
+19
View File
@@ -0,0 +1,19 @@
; PlatformIO Project Configuration File for WiFiManager Library Examples
; This file is used to build and test example sketches
[env:esp8266]
platform = espressif8266
board = d1_mini
framework = arduino
monitor_speed = 115200
lib_deps =
bblanchon/ArduinoJson@^6.21.0
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
bblanchon/ArduinoJson@^6.21.0
-60
View File
@@ -1,60 +0,0 @@
#!/bin/bash
function build_examples()
{
excludes=("$@")
# track the exit code for this platform
local exit_code=0
# loop through results and add them to the array
examples=($(find $PWD/examples/ -name "*.pde" -o -name "*.ino"))
# get the last example in the array
local last="${examples[@]:(-1)}"
# loop through example sketches
for example in "${examples[@]}"; do
# store the full path to the example's sketch directory
local example_dir=$(dirname $example)
# store the filename for the example without the path
local example_file=$(basename $example)
# skip files listed as excludes
for exclude in "${excludes[@]}"; do
if [ "${example_file}" == "${exclude}" ] ; then
echo ">>>>>>>>>>>>>>>>>>>>>>>> Skipping ${example_file} <<<<<<<<<<<<<<<<<<<<<<<<<<"
continue 2
fi
done
echo "$example_file: "
local sketch="$example_dir/$example_file"
echo "$sketch"
#arduino -v --verbose-build --verify $sketch
# verify the example, and save stdout & stderr to a variable
# we have to avoid reading the exit code of local:
# "when declaring a local variable in a function, the local acts as a command in its own right"
local build_stdout
build_stdout=$(arduino --verify $sketch 2>&1)
# echo output if the build failed
if [ $? -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n"
echo "$build_stdout"
echo -e "\n------------------------------------------------------------------------\n"
# mark as fail
exit_code=1
else
# heavy checkmark
echo -e "\xe2\x9c\x93"
fi
done
return $exit_code
}