Fix SoftAP boot abort: stop DHCP before setting static AP IP; drop RC522 SPI clock to 1 MHz; order RFID before display init

This commit is contained in:
2026-09-10 07:01:57 +02:00
parent aff5d1477f
commit 05d8012c8b
3 changed files with 18 additions and 8 deletions

View File

@@ -266,14 +266,23 @@ esp_err_t web_server_start(void)
.netmask = { .addr = ESP_IP4TOADDR(255, 255, 255, 0) },
.gw = { .addr = ESP_IP4TOADDR(192, 168, 4, 1) },
};
ESP_ERROR_CHECK(esp_netif_set_ip_info(ap, &ip_info));
/* The AP netif has DHCP running by default; stop it before assigning a
* static IP, otherwise esp_netif_set_ip_info fails with
* ESP_ERR_ESP_NETIF_DHCP_NOT_STOPPED. */
esp_netif_dhcps_stop(ap);
ret = esp_netif_set_ip_info(ap, &ip_info);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "set AP IP failed: %s", esp_err_to_name(ret));
return ret;
}
ret = esp_wifi_start();
if (ret != ESP_OK) {
ESP_LOGE(TAG, "wifi start (APSTA) failed: %s", esp_err_to_name(ret));
return ret;
}
ESP_ERROR_CHECK(esp_netif_dhcps_start(ap));
(void)esp_netif_dhcps_start(ap); /* harmless if someone else started it */
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.stack_size = 6 * 1024;