mirror of
https://github.com/esphome/esphome.git
synced 2025-09-12 08:12:22 +01:00
[wifi] Fix some access point bugs related to esp-idf 4.4.7 (#6928)
* Set dhcp server range to only 10 IPs * Change log level to errors to make it clearer * We want to stop the dhcp server, not client
This commit is contained in:
@@ -716,12 +716,12 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||
|
||||
if (wifi_softap_dhcps_status() == DHCP_STARTED) {
|
||||
if (!wifi_softap_dhcps_stop()) {
|
||||
ESP_LOGV(TAG, "Stopping DHCP server failed!");
|
||||
ESP_LOGW(TAG, "Stopping DHCP server failed!");
|
||||
}
|
||||
}
|
||||
|
||||
if (!wifi_set_ip_info(SOFTAP_IF, &info)) {
|
||||
ESP_LOGV(TAG, "Setting SoftAP info failed!");
|
||||
ESP_LOGE(TAG, "Setting SoftAP info failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -735,17 +735,17 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||
start_address += 99;
|
||||
lease.start_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||
start_address += 100;
|
||||
start_address += 10;
|
||||
lease.end_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||
if (!wifi_softap_set_dhcps_lease(&lease)) {
|
||||
ESP_LOGV(TAG, "Setting SoftAP DHCP lease failed!");
|
||||
ESP_LOGE(TAG, "Setting SoftAP DHCP lease failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// lease time 1440 minutes (=24 hours)
|
||||
if (!wifi_softap_set_dhcps_lease_time(1440)) {
|
||||
ESP_LOGV(TAG, "Setting SoftAP DHCP lease time failed!");
|
||||
ESP_LOGE(TAG, "Setting SoftAP DHCP lease time failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -755,13 +755,13 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||
uint8_t mode = 1;
|
||||
// bit0, 1 enables router information from ESP8266 SoftAP DHCP server.
|
||||
if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
|
||||
ESP_LOGV(TAG, "wifi_softap_set_dhcps_offer_option failed!");
|
||||
ESP_LOGE(TAG, "wifi_softap_set_dhcps_offer_option failed!");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!wifi_softap_dhcps_start()) {
|
||||
ESP_LOGV(TAG, "Starting SoftAP DHCPS failed!");
|
||||
ESP_LOGE(TAG, "Starting SoftAP DHCPS failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user