diff options
| author | Your Name <you@example.com> | 2026-05-18 23:50:55 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-18 23:50:55 +0530 |
| commit | 56f30ca866613c94e6a83bc1c21bee0eb38c5b39 (patch) | |
| tree | 8986b08bbfef98e8b0913b15b0baf6843d932145 | |
| parent | f8a5cffd3fe9d07de52e1688bda9b2975adbb74d (diff) | |
fix: don't stop services on STA disconnect
Services (API server on 2121, captive portal on 80, DNS hijack,
firewall) should stay running even when STA WiFi disconnects.
Previously, every STA disconnect would tear down all services,
making the board unreachable on its own AP.
Also set default wifi_networks to empty since upstream WiFi config
should be provisioned, not hardcoded.
| -rw-r--r-- | main/config.c | 4 | ||||
| -rw-r--r-- | main/tollgate_main.c | 1 |
2 files changed, 1 insertions, 4 deletions
diff --git a/main/config.c b/main/config.c index 6753f40..e810ede 100644 --- a/main/config.c +++ b/main/config.c | |||
| @@ -53,9 +53,7 @@ esp_err_t tollgate_config_init(void) | |||
| 53 | ESP_LOGW(TAG, "No config.json found, generating default"); | 53 | ESP_LOGW(TAG, "No config.json found, generating default"); |
| 54 | const char *default_json = "{" | 54 | const char *default_json = "{" |
| 55 | "\"nsec\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2\"," | 55 | "\"nsec\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2\"," |
| 56 | "\"wifi_networks\":[" | 56 | "\"wifi_networks\":[]," |
| 57 | "{\"ssid\":\"c03rad0r\",\"password\":\"c03rad0r123\"}" | ||
| 58 | "]," | ||
| 59 | "\"ap_password\":\"\"," | 57 | "\"ap_password\":\"\"," |
| 60 | "\"mint_url\":\"https://testnut.cashu.space\"," | 58 | "\"mint_url\":\"https://testnut.cashu.space\"," |
| 61 | "\"price_per_step\":21," | 59 | "\"price_per_step\":21," |
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index f8998bd..dda4142 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c | |||
| @@ -50,7 +50,6 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, | |||
| 50 | s_retry_count++; | 50 | s_retry_count++; |
| 51 | ESP_LOGW(TAG, "WiFi disconnected, retry %d/%d", s_retry_count, MAX_STA_RETRY); | 51 | ESP_LOGW(TAG, "WiFi disconnected, retry %d/%d", s_retry_count, MAX_STA_RETRY); |
| 52 | tollgate_client_on_sta_disconnected(); | 52 | tollgate_client_on_sta_disconnected(); |
| 53 | if (s_services_running) stop_services(); | ||
| 54 | if (s_retry_count < MAX_STA_RETRY) { | 53 | if (s_retry_count < MAX_STA_RETRY) { |
| 55 | esp_wifi_connect(); | 54 | esp_wifi_connect(); |
| 56 | } else { | 55 | } else { |