Allow app to compile for ESP8266 - add some conditionals based on mos.platform
This commit is contained in:
32
mos.yml
32
mos.yml
@ -1,7 +1,8 @@
|
|||||||
platform: esp32
|
|
||||||
author: Pim van Pelt <pim@ipng.nl>
|
author: Pim van Pelt <pim@ipng.nl>
|
||||||
description: A Mongoose-OS Huzzah32 Featherwing
|
description: A Mongoose-OS Huzzah32 Featherwing
|
||||||
version: 1.0
|
version: 1.0
|
||||||
|
platform: esp32
|
||||||
|
platfors: [ esp8266, esp32 ]
|
||||||
|
|
||||||
libs_version: ${mos.version}
|
libs_version: ${mos.version}
|
||||||
modules_version: ${mos.version}
|
modules_version: ${mos.version}
|
||||||
@ -24,7 +25,7 @@ filesystem:
|
|||||||
|
|
||||||
config_schema:
|
config_schema:
|
||||||
# - ["debug.level", 4]
|
# - ["debug.level", 4]
|
||||||
- ["sys.esp32_adc_vref", 3300] # ADC Vref is 3.3V
|
# - ["spi.debug", true]
|
||||||
- ["wifi.ap.enable", false]
|
- ["wifi.ap.enable", false]
|
||||||
- ["wifi.sta.enable", true]
|
- ["wifi.sta.enable", true]
|
||||||
- ["wifi.sta.ssid", "dapches-iot"]
|
- ["wifi.sta.ssid", "dapches-iot"]
|
||||||
@ -42,17 +43,28 @@ config_schema:
|
|||||||
- ["app.battery_calibration", i, {title: "Battery ADC value at 4000mV"}]
|
- ["app.battery_calibration", i, {title: "Battery ADC value at 4000mV"}]
|
||||||
- ["app.battery_calibration", 2360]
|
- ["app.battery_calibration", 2360]
|
||||||
- ["spi.enable", true]
|
- ["spi.enable", true]
|
||||||
# - ["spi.debug", true]
|
|
||||||
- ["spi.mosi_gpio", 18]
|
|
||||||
- ["spi.miso_gpio", 19]
|
|
||||||
- ["spi.sclk_gpio", 5]
|
|
||||||
- ["spi.cs0_gpio", 32]
|
|
||||||
- ["spi.cs1_gpio", -1]
|
- ["spi.cs1_gpio", -1]
|
||||||
- ["spi.cs2_gpio", -1]
|
- ["spi.cs2_gpio", -1]
|
||||||
- ["ili9341.cs_pin", 15]
|
|
||||||
- ["ili9341.dc_pin", 33]
|
|
||||||
- ["stmpe610.cs_index", 0]
|
- ["stmpe610.cs_index", 0]
|
||||||
- ["stmpe610.irq_pin", 23]
|
|
||||||
|
conds:
|
||||||
|
- when: mos.platform == "esp32"
|
||||||
|
apply:
|
||||||
|
build_vars:
|
||||||
|
MGOS_PLATFORM_ESP32: 1
|
||||||
|
config_schema:
|
||||||
|
- ["sys.esp32_adc_vref", 3300] # ADC Vref is 3.3V
|
||||||
|
- ["spi.mosi_gpio", 18]
|
||||||
|
- ["spi.miso_gpio", 19]
|
||||||
|
- ["spi.sclk_gpio", 5]
|
||||||
|
- ["spi.cs0_gpio", 32]
|
||||||
|
- ["ili9341.cs_pin", 15]
|
||||||
|
- ["ili9341.dc_pin", 33]
|
||||||
|
- ["stmpe610.irq_pin", 23]
|
||||||
|
- when: mos.platform == "esp8266"
|
||||||
|
apply:
|
||||||
|
build_vars:
|
||||||
|
MGOS_PLATFORM_ESP8266: 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,4 +58,5 @@ void widget_default_ev(int ev, struct widget_t *w, void *ev_data) {
|
|||||||
default: // EV_WIDGET_NONE
|
default: // EV_WIDGET_NONE
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
(void) ev_data;
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,13 @@ static void widget_network_render(struct widget_t *w, void *ev_data) {
|
|||||||
static void widget_network_send_clear(void *arg) {
|
static void widget_network_send_clear(void *arg) {
|
||||||
send_timer=0;
|
send_timer=0;
|
||||||
widget_network_ev(EV_WIDGET_REDRAW, widget_network, NULL);
|
widget_network_ev(EV_WIDGET_REDRAW, widget_network, NULL);
|
||||||
|
(void) arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void widget_network_recv_clear(void *arg) {
|
static void widget_network_recv_clear(void *arg) {
|
||||||
recv_timer=0;
|
recv_timer=0;
|
||||||
widget_network_ev(EV_WIDGET_REDRAW, widget_network, NULL);
|
widget_network_ev(EV_WIDGET_REDRAW, widget_network, NULL);
|
||||||
|
(void) arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget_network_send() {
|
void widget_network_send() {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "mgos.h"
|
#include "mgos.h"
|
||||||
#include "mongoose-touch.h"
|
#include "mongoose-touch.h"
|
||||||
|
#ifdef MGOS_PLATFORM_ESP32
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static long map(long x, long in_min, long in_max, long out_min, long out_max)
|
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%
|
// Returns a value between 0 and 100%
|
||||||
static uint8_t widget_wifi_signal() {
|
static uint8_t widget_wifi_signal() {
|
||||||
|
#ifdef MGOS_PLATFORM_ESP32
|
||||||
wifi_ap_record_t info;
|
wifi_ap_record_t info;
|
||||||
|
|
||||||
if(0 != esp_wifi_sta_get_ap_info(&info))
|
if(0 != esp_wifi_sta_get_ap_info(&info))
|
||||||
@ -19,6 +22,8 @@ static uint8_t widget_wifi_signal() {
|
|||||||
if (info.rssi >= -50)
|
if (info.rssi >= -50)
|
||||||
return 100;
|
return 100;
|
||||||
return 2 * (info.rssi + 100);
|
return 2 * (info.rssi + 100);
|
||||||
|
#endif
|
||||||
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void widget_wifi_render(struct widget_t *w, void *ev_data) {
|
static void widget_wifi_render(struct widget_t *w, void *ev_data) {
|
||||||
|
Reference in New Issue
Block a user