diff --git a/src/main.c b/src/main.c index 0311334..901434c 100644 --- a/src/main.c +++ b/src/main.c @@ -202,7 +202,28 @@ void app_main(void) { } } - ESP_LOGI(TAG, "WiFi Connected, continuing main task thread . . . "); + // Create a timer to auto-shutdown the AP after 5 minutes + TimerHandle_t ap_shutdown_timer = xTimerCreate( + "ap_shutdown_timer", + pdMS_TO_TICKS(2 * 60 * 1000), // 2 minutes in milliseconds + pdFALSE, // One-shot timer + NULL, // No timer ID + wifi_shutdown_ap // Callback function (now with correct signature) + ); + + if (ap_shutdown_timer != NULL) { + // Timer created successfully, now try to start it + BaseType_t timer_started = xTimerStart(ap_shutdown_timer, 0); + if (timer_started == pdPASS) { + ESP_LOGI(TAG, "AP will automatically shut down in 2 minutes"); + } else { + ESP_LOGE(TAG, "Failed to start AP shutdown timer"); + // Clean up the timer if we couldn't start it + xTimerDelete(ap_shutdown_timer, 0); + } + } else { + ESP_LOGE(TAG, "Failed to create AP shutdown timer"); + } // Get the image URL from WiFi manager const char* image_url = wifi_get_image_url(); diff --git a/src/wifi.c b/src/wifi.c index 3662c92..7bcbd6a 100644 --- a/src/wifi.c +++ b/src/wifi.c @@ -62,44 +62,49 @@ static void (*s_connect_callback)(void) = NULL; static void (*s_disconnect_callback)(void) = NULL; // HTML for the configuration page -static const char *s_html_page = "" -"" -"
" -"WiFi credentials and image URL have been saved.
" "The device will now attempt to connect to the WiFi network.
" +"If you modified a previously saved Image URL please manually reboot your tron for the changes to take effect." "
You can close this page.
" "