From 5d157b4f7ecea4793c9da5c33a890d4ea4afc545 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 17 May 2020 04:03:16 +0200 Subject: power management implemented; net protocol change --- code/esp32/components/eos/wifi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'code/esp32/components/eos/wifi.c') diff --git a/code/esp32/components/eos/wifi.c b/code/esp32/components/eos/wifi.c index 31aefea..3dd90ba 100755 --- a/code/esp32/components/eos/wifi.c +++ b/code/esp32/components/eos/wifi.c @@ -16,7 +16,7 @@ #include "net.h" #include "wifi.h" -// XXX: No DHCP server +// XXX: WiFi fail due to no DHCP server #define WIFI_MAX_SCAN_RECORDS 20 #define WIFI_MAX_CONNECT_ATTEMPTS 3 @@ -45,7 +45,7 @@ static uint8_t wifi_action; static uint8_t wifi_state; static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) { - esp_err_t ret; + esp_err_t ret = ESP_OK; char _disconnect; uint8_t _action, _state; unsigned char *rbuf; @@ -188,6 +188,9 @@ void eos_wifi_init(void) { ret = esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_sta_config); assert(ret == ESP_OK); + ret = esp_wifi_stop(); + assert(ret == ESP_OK); + mutex = xSemaphoreCreateBinary(); xSemaphoreGive(mutex); @@ -260,7 +263,6 @@ int eos_wifi_connect(void) { if (rv) return rv; - esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_sta_config); if (_wifi_state == WIFI_STATE_STOPPED) { -- cgit v1.2.3