diff options
Diffstat (limited to 'main/tollgate_main.c')
| -rw-r--r-- | main/tollgate_main.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index 41dbbed..1350d70 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c | |||
| @@ -265,11 +265,6 @@ void app_main(void) | |||
| 265 | wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); | 265 | wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); |
| 266 | ESP_ERROR_CHECK(esp_wifi_init(&cfg)); | 266 | ESP_ERROR_CHECK(esp_wifi_init(&cfg)); |
| 267 | 267 | ||
| 268 | const tollgate_config_t *tcfg = tollgate_config_get(); | ||
| 269 | ESP_ERROR_CHECK(esp_wifi_set_mac(WIFI_IF_STA, tcfg->sta_mac)); | ||
| 270 | ESP_ERROR_CHECK(esp_wifi_set_mac(WIFI_IF_AP, tcfg->ap_mac)); | ||
| 271 | ESP_LOGI(TAG, "MACs set from identity"); | ||
| 272 | |||
| 273 | ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, | 268 | ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, |
| 274 | &wifi_event_handler, NULL, NULL)); | 269 | &wifi_event_handler, NULL, NULL)); |
| 275 | ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT, IP_EVENT_STA_GOT_IP, | 270 | ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT, IP_EVENT_STA_GOT_IP, |
| @@ -279,6 +274,11 @@ void app_main(void) | |||
| 279 | 274 | ||
| 280 | ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA)); | 275 | ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA)); |
| 281 | 276 | ||
| 277 | const tollgate_config_t *tcfg = tollgate_config_get(); | ||
| 278 | ESP_ERROR_CHECK(esp_wifi_set_mac(WIFI_IF_STA, tcfg->sta_mac)); | ||
| 279 | ESP_ERROR_CHECK(esp_wifi_set_mac(WIFI_IF_AP, tcfg->ap_mac)); | ||
| 280 | ESP_LOGI(TAG, "MACs set from identity"); | ||
| 281 | |||
| 282 | wifi_configure_ap(); | 282 | wifi_configure_ap(); |
| 283 | 283 | ||
| 284 | wifi_config_t sta_config; | 284 | wifi_config_t sta_config; |
| @@ -292,6 +292,11 @@ void app_main(void) | |||
| 292 | 292 | ||
| 293 | ESP_LOGI(TAG, "WiFi AP+STA started, waiting for connection..."); | 293 | ESP_LOGI(TAG, "WiFi AP+STA started, waiting for connection..."); |
| 294 | 294 | ||
| 295 | if (tollgate_config_get_wifi(&(wifi_config_t){0}) != ESP_OK) { | ||
| 296 | ESP_LOGI(TAG, "No STA network configured, starting services immediately"); | ||
| 297 | xTaskCreate(services_start_task, "svc_start", 32768, NULL, 5, NULL); | ||
| 298 | } | ||
| 299 | |||
| 295 | while (1) { | 300 | while (1) { |
| 296 | vTaskDelay(pdMS_TO_TICKS(1000)); | 301 | vTaskDelay(pdMS_TO_TICKS(1000)); |
| 297 | session_tick(); | 302 | session_tick(); |