Allow app to compile for ESP8266 - add some conditionals based on mos.platform

This commit is contained in:
Pim van Pelt
2017-12-01 19:21:01 +01:00
parent 95e2835871
commit b9a0578d5b
4 changed files with 30 additions and 10 deletions

View File

@ -58,4 +58,5 @@ void widget_default_ev(int ev, struct widget_t *w, void *ev_data) {
default: // EV_WIDGET_NONE
break;
}
(void) ev_data;
}

View File

@ -24,11 +24,13 @@ static void widget_network_render(struct widget_t *w, void *ev_data) {
static void widget_network_send_clear(void *arg) {
send_timer=0;
widget_network_ev(EV_WIDGET_REDRAW, widget_network, NULL);
(void) arg;
}
static void widget_network_recv_clear(void *arg) {
recv_timer=0;
widget_network_ev(EV_WIDGET_REDRAW, widget_network, NULL);
(void) arg;
}
void widget_network_send() {

View File

@ -1,6 +1,8 @@
#include "mgos.h"
#include "mongoose-touch.h"
#ifdef MGOS_PLATFORM_ESP32
#include <esp_wifi.h>
#endif
static long map(long x, long in_min, long in_max, long out_min, long out_max)
{
@ -9,6 +11,7 @@ static long map(long x, long in_min, long in_max, long out_min, long out_max)
// Returns a value between 0 and 100%
static uint8_t widget_wifi_signal() {
#ifdef MGOS_PLATFORM_ESP32
wifi_ap_record_t info;
if(0 != esp_wifi_sta_get_ap_info(&info))
@ -19,6 +22,8 @@ static uint8_t widget_wifi_signal() {
if (info.rssi >= -50)
return 100;
return 2 * (info.rssi + 100);
#endif
return 100;
}
static void widget_wifi_render(struct widget_t *w, void *ev_data) {