mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-13 23:01:20 +10:00
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
This commit is contained in:
+3
-3
@@ -1809,17 +1809,17 @@ void WiFiManager::setBreakAfterConfig(boolean shouldBreak) {
|
||||
* @access public
|
||||
* @param {[type]} void (*func)(WiFiManager* myWiFiManager) [description]
|
||||
*/
|
||||
void WiFiManager::setAPCallback( void (*func)(WiFiManager* myWiFiManager) ) {
|
||||
void WiFiManager::setAPCallback( std::function<void(WiFiManager*)> func ) {
|
||||
_apcallback = func;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setSaveConfigCallback, set a save config callback after closing configportal
|
||||
* @todo only calls if configportal stopped
|
||||
* @access public
|
||||
* @param {[type]} void (*func)(void) [description]
|
||||
*/
|
||||
void WiFiManager::setSaveConfigCallback( void (*func)(void) ) {
|
||||
void WiFiManager::setSaveConfigCallback( std::function<void()> func ) {
|
||||
_savecallback = func;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user