mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1810] Add additional callback options #1526
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1526
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @frogen1 on GitHub (Mar 18, 2025).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1810
I downloaded source and modified for my application to add a new callback for the handleErase() function.
My project has a touch screen and I needed to give users the ability to erase wifi config without reseting the ESP. This gives them the option to either use the touchscreen or Config/Web portal to set and clear wifi configs.
So I added:
std::function<void()> _erasewificallback;
void WiFiManager::eraseConfigCallback( std::function<void()> func ) {
_erasewificallback = func;
}
And changed the following at the end of:
void WiFiManager::handleErase() {
.......
if (_erasewificallback != NULL) {
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(WM_DEBUG_VERBOSE,F("[CB] _erasewificallback calling"));
#endif
_erasewificallback(); // @CALLBACK
}
else if(ret){ //if callback set do not reset. Let callback decide.
delay(2000);
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(F("RESETTING ESP"));
#endif
reboot();
}