summaryrefslogtreecommitdiff
path: root/code/esp32/components/eos/wifi.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2019-12-07 17:13:23 +0100
committerUros Majstorovic <majstor@majstor.org>2019-12-07 17:13:23 +0100
commit040f4333678f46f3558e604014d460076244af6b (patch)
tree084b8a41eef67a9bf45a5c21124fc393061f88fb /code/esp32/components/eos/wifi.c
parent8cdc7528c800a3f10bca3e875e76f6d9661ab88f (diff)
added net_alloc; fixed cell modem driver
Diffstat (limited to 'code/esp32/components/eos/wifi.c')
-rwxr-xr-xcode/esp32/components/eos/wifi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/code/esp32/components/eos/wifi.c b/code/esp32/components/eos/wifi.c
index 628c4fd..29cd983 100755
--- a/code/esp32/components/eos/wifi.c
+++ b/code/esp32/components/eos/wifi.c
@@ -17,9 +17,11 @@
#include "net.h"
#include "wifi.h"
-static const char *TAG = "EOS";
+static const char *TAG = "EOS WIFI";
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) {
+ unsigned char *rbuf;
+
switch(event->event_id) {
case SYSTEM_EVENT_SCAN_DONE:
break;
@@ -42,9 +44,9 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) {
ESP_LOGI(TAG, "* We are now connected to AP");
ESP_LOGI(TAG, "* - Our IP address is: " IPSTR, IP2STR(&event->event_info.got_ip.ip_info.ip));
ESP_LOGI(TAG, "********************************************");
- unsigned char *buf = malloc(32);
- buf[0] = EOS_WIFI_MTYPE_CONNECT;
- eos_net_send(EOS_NET_MTYPE_WIFI, buf, 1, EOS_NET_FLAG_BUF_FREE);
+ rbuf = eos_net_alloc();
+ rbuf[0] = EOS_WIFI_MTYPE_CONNECT;
+ eos_net_send(EOS_NET_MTYPE_WIFI, rbuf, 1, 0);
break;
default: // Ignore the other event types
@@ -70,7 +72,6 @@ static void wifi_handler(unsigned char _mtype, unsigned char *buffer, uint16_t s
eos_wifi_disconnect();
break;
}
- // eos_wifi_connect((char *)buffer, (char *)(buffer+strlen((char *)buffer)+1));
}
void eos_wifi_init(void) {