upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/tollgate_main.c
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-19 04:12:32 +0530
committerYour Name <you@example.com>2026-05-19 04:12:32 +0530
commit3aa372ccc3e11c837458b00088ffb6cbe99ff6ca (patch)
treed0cea8925e1908c4ea5e90096f4d48b9cfee2ce7 /main/tollgate_main.c
parentd0a99d8a92b762187d3d638c9a705d4b891f6ead (diff)
fix: merge readiness — display_enabled config, real pubkey, probe interval, dedup services
- Add display_enabled config field (default true, parsed from config.json) - Guard display_init/display_update behind display_enabled check - Fix discovery pubkey: replace hardcoded all-zeros with identity_get()->npub_hex - Revert MINT_HEALTH_PROBE_INTERVAL_S from 30 (testing) to 300 (production) - Remove duplicate services_start_task call in IP event handler - Fix UTF-8 arrow in STA auth threshold log message - Gitignore compiled test binaries (test_mcp_handler, test_mint_health, etc.) - Remove tracked test binaries from git Verified on Board B (stable): - make test-discovery-b: pubkey=d6bfe100..., metric=milliseconds, price_per_step tags - make test-mints-b: 4 mints listed with reachable field - Wallet: 40 sats balance with 4 proofs from previous payment - All API endpoints responding (discovery, mints, wallet, whoami, portal) - 75/75 unit tests passing
Diffstat (limited to 'main/tollgate_main.c')
-rw-r--r--main/tollgate_main.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/main/tollgate_main.c b/main/tollgate_main.c
index e81ba7b..15791a3 100644
--- a/main/tollgate_main.c
+++ b/main/tollgate_main.c
@@ -108,8 +108,6 @@ static void ip_event_handler(void *arg, esp_event_base_t event_base,
108 char gw_ip_str[16]; 108 char gw_ip_str[16];
109 snprintf(gw_ip_str, sizeof(gw_ip_str), IPSTR, IP2STR(&event->ip_info.gw)); 109 snprintf(gw_ip_str, sizeof(gw_ip_str), IPSTR, IP2STR(&event->ip_info.gw));
110 tollgate_client_on_sta_connected(gw_ip_str); 110 tollgate_client_on_sta_connected(gw_ip_str);
111
112 xTaskCreate(services_start_task, "svc_start", 32768, NULL, 5, NULL);
113 } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_LOST_IP) { 111 } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_LOST_IP) {
114 ESP_LOGW(TAG, "Lost IP address"); 112 ESP_LOGW(TAG, "Lost IP address");
115 xEventGroupClearBits(s_wifi_event_group, WIFI_CONNECTED_BIT); 113 xEventGroupClearBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
@@ -178,6 +176,13 @@ static void start_services(void)
178 s_services_running = true; 176 s_services_running = true;
179 if (s_services_mutex) xSemaphoreGive(s_services_mutex); 177 if (s_services_mutex) xSemaphoreGive(s_services_mutex);
180 ESP_LOGI(TAG, "=== TollGate services started ==="); 178 ESP_LOGI(TAG, "=== TollGate services started ===");
179
180 if (cfg->display_enabled) {
181 display_set_state(DISPLAY_READY);
182 char portal_url[128];
183 snprintf(portal_url, sizeof(portal_url), "http://%s/", cfg->ap_ip_str);
184 display_update(cfg->ap_ssid, 0, 0, portal_url);
185 }
181} 186}
182 187
183static void stop_services(void) 188static void stop_services(void)
@@ -259,9 +264,6 @@ void app_main(void)
259{ 264{
260 ESP_LOGI(TAG, "=== TollGate ESP32 Starting ==="); 265 ESP_LOGI(TAG, "=== TollGate ESP32 Starting ===");
261 266
262 ESP_LOGW(TAG, "Display disabled for stability testing");
263
264
265 esp_err_t ret = nvs_flash_init(); 267 esp_err_t ret = nvs_flash_init();
266 if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { 268 if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
267 ESP_ERROR_CHECK(nvs_flash_erase()); 269 ESP_ERROR_CHECK(nvs_flash_erase());
@@ -271,7 +273,13 @@ void app_main(void)
271 273
272 ESP_ERROR_CHECK(tollgate_config_init()); 274 ESP_ERROR_CHECK(tollgate_config_init());
273 275
274 ESP_ERROR_CHECK(identity_init(tollgate_config_get()->nsec)); 276 const tollgate_config_t *init_cfg = tollgate_config_get();
277 if (init_cfg->display_enabled) {
278 display_init();
279 display_set_state(DISPLAY_BOOT);
280 }
281
282 ESP_ERROR_CHECK(identity_init(init_cfg->nsec));
275 283
276 tollgate_config_derive_unique((tollgate_config_t *)tollgate_config_get()); 284 tollgate_config_derive_unique((tollgate_config_t *)tollgate_config_get());
277 285