@@ -20,25 +20,12 @@ esp_err_t status_handler(httpd_req_t *req) {
2020 char uptime_str [64 ];
2121 snprintf (uptime_str , sizeof (uptime_str ), "%dd %02dh %02dm %02ds" , days , hours , minutes , seconds );
2222
23- esp_netif_ip_info_t ip_info ;
24- char ip_str [INET_ADDRSTRLEN ] = "unknown" ;
25-
26- if (ap_netif == NULL ) {
27- if (sta_netif && esp_netif_get_ip_info (sta_netif , & ip_info ) == ESP_OK ) {
28- snprintf (ip_str , sizeof (ip_str ), IPSTR , IP2STR (& ip_info .ip ));
29- }
30- } else {
31- if (ap_netif && esp_netif_get_ip_info (ap_netif , & ip_info ) == ESP_OK ) {
32- snprintf (ip_str , sizeof (ip_str ), IPSTR , IP2STR (& ip_info .ip ));
33- }
34- }
35-
3623 time_t now ;
3724 time (& now );
3825
3926 json_entry_t entries [] = {{"status" , JSON_TYPE_STRING , "ok" },
4027 {"sys_timestamp" , JSON_TYPE_NUMBER , & now },
41- {"ip" , JSON_TYPE_STRING , ip_str },
28+ {"ip" , JSON_TYPE_STRING , wifi_get_current_ip_str () },
4229 {"free_heap" , JSON_TYPE_STRING , free_heap_str },
4330 {"uptime" , JSON_TYPE_STRING , uptime_str }};
4431
0 commit comments