mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-21 18:22:37 +10:00
Clarify portal documentation examples
This commit is contained in:
@@ -9,8 +9,6 @@ WiFiManager gives ESP8266 and ESP32 firmware a polished, self-hosted Wi-Fi setup
|
||||
|  |  |
|
||||
| Give each product its own title, identity, icon, and color theme without copying portal HTML. | Show live nearby networks and collect application values, such as an MQTT broker, in the same setup flow. |
|
||||
|
||||
These are unmodified browser captures of [Branded Portal](examples/BrandedPortal/) and [Custom Portal Content](examples/CustomPortalContent/) running on the supported boards. The portal is served by the device itself; no cloud UI or companion app is involved.
|
||||
|
||||
## Start with a working portal
|
||||
|
||||
```cpp
|
||||
@@ -39,20 +37,18 @@ const char kTitle[] PROGMEM = "Set up Temperature Monitor";
|
||||
const char kBrand[] PROGMEM = "Example Devices";
|
||||
const char kAccent[] PROGMEM = "#347a45";
|
||||
|
||||
const WiFiManagerPortalConfig kPortalUI = {
|
||||
WiFiManagerPortalText::progmem(kTitle),
|
||||
WiFiManagerPortalText::progmem(kBrand),
|
||||
{}, {}, {},
|
||||
{
|
||||
{}, {}, {}, {}, {},
|
||||
WiFiManagerPortalText::progmem(kAccent),
|
||||
{}, {}, {}, {}, {},
|
||||
10, 0,
|
||||
},
|
||||
};
|
||||
|
||||
void setup() {
|
||||
wifi.setPortalConfig(kPortalUI); // before the portal starts
|
||||
WiFiManagerPortalConfig portalUI;
|
||||
|
||||
// Leave fields unset to keep WiFiManager's built-in portal values.
|
||||
portalUI.title = WiFiManagerPortalText::progmem(kTitle);
|
||||
portalUI.identityText = WiFiManagerPortalText::progmem(kBrand);
|
||||
|
||||
// Theme values customise the built-in styles; they do not replace the portal.
|
||||
portalUI.theme.accent = WiFiManagerPortalText::progmem(kAccent);
|
||||
portalUI.theme.cornerRadiusPx = 10;
|
||||
|
||||
wifi.setPortalConfig(portalUI); // Apply before the portal starts.
|
||||
wifi.autoConnect("Device Setup");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user