mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Correctly access WIFI_EVENT_MODE_CHANGE event info (#8343)
Select the specific union member struct fields. Co-authored-by: Rastislav Hričák <88608954+RastoH@users.noreply.github.com>
This commit is contained in:
parent
c7c7d0518b
commit
ac4af38c09
@ -203,7 +203,10 @@ WiFiEventHandler ESP8266WiFiGenericClass::onSoftAPModeProbeRequestReceived(std::
|
||||
WiFiEventHandler ESP8266WiFiGenericClass::onWiFiModeChange(std::function<void(const WiFiEventModeChange&)> f)
|
||||
{
|
||||
WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_MODE_CHANGE, [f](System_Event_t* e){
|
||||
WiFiEventModeChange& dst = *reinterpret_cast<WiFiEventModeChange*>(&e->event_info);
|
||||
auto& src = e->event_info.opmode_changed;
|
||||
WiFiEventModeChange dst;
|
||||
dst.oldMode = (WiFiMode_t)src.old_opmode;
|
||||
dst.newMode = (WiFiMode_t)src.new_opmode;
|
||||
f(dst);
|
||||
});
|
||||
sCbEventList.push_back(handler);
|
||||
|
Loading…
x
Reference in New Issue
Block a user