summaryrefslogtreecommitdiff
path: root/code/esp32/components/eos/wifi.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-05-17 04:03:16 +0200
committerUros Majstorovic <majstor@majstor.org>2020-05-17 04:03:16 +0200
commit5d157b4f7ecea4793c9da5c33a890d4ea4afc545 (patch)
tree6309b33a6d8e5f6beb068e59e001e66c9f677d2a /code/esp32/components/eos/wifi.c
parent1cafcbd398fa0e5a4afb1ade33ecf21694cde235 (diff)
power management implemented; net protocol change
Diffstat (limited to 'code/esp32/components/eos/wifi.c')
-rwxr-xr-xcode/esp32/components/eos/wifi.c8
1 files changed, 5 insertions, 3 deletions
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) {