Browse Source

wifi: preliminary fix for leases setup order

see 69c65a6a40 (commitcomment-42008295)
Because of the way DHCP is integrated into the Core logic, we need to
call wifi_softap_add_dhcps_lease(...) inbetween WiFi.softApConfig(...) and WiFi.softAp(...)
mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
487190892e
1 changed files with 11 additions and 7 deletions
  1. +11
    -7
      code/espurna/wifi.cpp

+ 11
- 7
code/espurna/wifi.cpp View File

@ -759,15 +759,13 @@ void wifiSetup() {
_wifiConfigure();
if (WiFiApMode::Enabled ==_wifi_ap_mode) {
jw.enableAP(true);
jw.enableSTA(true);
}
// Note that maximum amount of stations is set by `WiFi.softAP(...)` call, but justwifi handles that.
// Default is 4, which we use here. However, maximum is 8. ref:
// https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/soft-access-point-class.html#softap
#if WIFI_AP_LEASES_SUPPORT
#if WIFI_AP_LEASES_SUPPORT
wifiRegister([](justwifi_messages_t code, char*) {
if (MESSAGE_ACCESSPOINT_CREATING != code) return;
for (unsigned char index = 0; index < 4; ++index) {
auto lease = getSetting({"wifiApLease", index});
if (12 != lease.length()) {
@ -781,7 +779,13 @@ void wifiSetup() {
wifi_softap_add_dhcps_lease(mac);
}
#endif
});
#endif
if (WiFiApMode::Enabled ==_wifi_ap_mode) {
jw.enableAP(true);
jw.enableSTA(true);
}
#if JUSTWIFI_ENABLE_SMARTCONFIG
if (_wifi_smartconfig_initial) jw.startSmartConfig();


Loading…
Cancel
Save