Browse Source

Using wifiRegister instead of WifiHandlers in rf module

rfm69
Xose Pérez 6 years ago
parent
commit
ca4fc1a38d
1 changed files with 9 additions and 15 deletions
  1. +9
    -15
      code/espurna/rf.ino

+ 9
- 15
code/espurna/rf.ino View File

@ -75,24 +75,18 @@ void rfSetup() {
RemoteReceiver::disable();
DEBUG_MSG_P(PSTR("[RF] Disabled\n"));
static WiFiEventHandler e1 = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected& event) {
RemoteReceiver::disable();
DEBUG_MSG_P(PSTR("[RF] Disabled\n"));
});
wifiRegister([](justwifi_messages_t code, char * parameter) {
static WiFiEventHandler e2 = WiFi.onSoftAPModeStationDisconnected([](const WiFiEventSoftAPModeStationDisconnected& event) {
RemoteReceiver::disable();
DEBUG_MSG_P(PSTR("[RF] Disabled\n"));
});
if (code == MESSAGE_CONNECTED || code == MESSAGE_ACCESSPOINT_CREATED) {
RemoteReceiver::enable();
DEBUG_MSG_P(PSTR("[RF] Enabled\n"));
}
static WiFiEventHandler e3 = WiFi.onStationModeConnected([](const WiFiEventStationModeConnected& event) {
RemoteReceiver::enable();
DEBUG_MSG_P(PSTR("[RF] Enabled\n"));
});
if (code == MESSAGE_DISCONNECTED)
RemoteReceiver::disable();
DEBUG_MSG_P(PSTR("[RF] Disabled\n"));
}
static WiFiEventHandler e4 = WiFi.onSoftAPModeStationConnected([](const WiFiEventSoftAPModeStationConnected& event) {
RemoteReceiver::enable();
DEBUG_MSG_P(PSTR("[RF] Enabled\n"));
});
#if WEB_SUPPORT


Loading…
Cancel
Save