mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-20 17:56:34 +00:00
Fix ESP8266 crash
This commit is contained in:
parent
3c9b7df4ed
commit
e6e990a2b5
@ -55,8 +55,7 @@ lib_deps =
|
||||
|
||||
lib_ignore =
|
||||
https://github.com/littlevgl/lvgl.git
|
||||
lvgl@^6.1.2
|
||||
lvgl@^6.1.1
|
||||
|
||||
|
||||
; -- littlevgl config options ----------------------
|
||||
build_flags =
|
||||
@ -76,7 +75,7 @@ build_flags =
|
||||
[flags]
|
||||
esp8266_flags=
|
||||
${env.build_flags}
|
||||
-D HTTP_UPLOAD_BUFLEN=512 ; lower http upload buffer
|
||||
-D HTTP_UPLOAD_BUFLEN=640 ; lower http upload buffer
|
||||
-D MQTT_MAX_PACKET_SIZE=1024 ; longer PubSubClient messages
|
||||
esp32_flags=
|
||||
${env.build_flags}
|
||||
@ -160,7 +159,7 @@ build_flags =
|
||||
-D TFT_DC=2
|
||||
-D TFT_CS=5
|
||||
-D TFT_RST=4
|
||||
-D TFT_BCKL=20
|
||||
-D TFT_BCKL=-1 ; None, configurable via web UI (e.g. 20)
|
||||
-D TOUCH_CS=21
|
||||
; -- Debugging options -----------------------------
|
||||
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||
@ -222,11 +221,11 @@ build_flags =
|
||||
-D ILI9488_DRIVER=1
|
||||
${pins.vspi32}
|
||||
-D ESP32_PARALLEL=1
|
||||
-D define PSEUDO_8_BIT=1
|
||||
-D PSEUDO_8_BIT=1
|
||||
-D TFT_CS=34 ; Chip select control pin
|
||||
-D TFT_DC=36 ; Data Command control pin - must use a pin in the range 0-31
|
||||
-D TFT_RST=38 ; Reset pin
|
||||
-D TFT_WR=4 ; Write strobe control pin - must use a pin in the range 0-31
|
||||
-D TFT_RST=38 ; Reset pin
|
||||
-D TFT_WR=4 ; Write strobe control pin - must use a pin in the range 0-31
|
||||
-D TFT_RD=2
|
||||
-D TFT_D0=12 ; Must use pins in the range 0-31 for the data bus
|
||||
-D TFT_D1=13 ; so a single register write sets/clears all bits
|
||||
@ -268,9 +267,9 @@ build_flags =
|
||||
${pins.vspi32}
|
||||
-D TFT_DC=5
|
||||
-D TFT_CS=26
|
||||
-D TFT_RST=-1 ;RST
|
||||
-D TFT_BCKL=21
|
||||
-D TOUCH_CS=17 ;(can also be 22 or 16)
|
||||
-D TFT_RST=-1 ; RST
|
||||
-D TFT_BCKL=-1 ; None, configurable via web UI (e.g. 21)
|
||||
-D TOUCH_CS=17 ; (can also be 22 or 16)
|
||||
|
||||
|
||||
;***************************************************
|
||||
@ -292,8 +291,8 @@ build_flags =
|
||||
;-D TFT_DC=5 ; Defined by board, don't redefine
|
||||
;-D TFT_CS=26 ; Defined by board, don't redefine
|
||||
;-D TFT_RST=-1 ; Defined by board, don't redefine
|
||||
-D TFT_BCKL=21
|
||||
-D TOUCH_CS=17 ;(can also be 22 or 16)
|
||||
-D TFT_BCKL=-1 ; None, configurable via web UI (e.g. 21)
|
||||
-D TOUCH_CS=17 ; (can also be 22 or 16)
|
||||
|
||||
|
||||
;***************************************************
|
||||
@ -322,7 +321,7 @@ build_flags =
|
||||
;-D TFT_SCLK=14 ;D5 Default HSPI
|
||||
-D TFT_DC=15 ;D8
|
||||
-D TFT_CS=16 ;D0
|
||||
-D TFT_BCKL=2 ;D4 (can also be D1 or D2)
|
||||
-D TFT_BCKL=-1 ;None, configurable via web UI (e.g. 2 for D4)
|
||||
-D TOUCH_CS=0 ;D3 (can also be D1 or D2)
|
||||
-D TFT_RST=-1 ;RST
|
||||
|
||||
@ -354,7 +353,7 @@ build_flags =
|
||||
-D TFT_SCLK=14 ;D5
|
||||
-D TFT_CS=15 ;D8
|
||||
-D TFT_DC=0 ;D3
|
||||
-D TFT_BCKL=2 ;D4 (can also be D1 or D2)
|
||||
-D TFT_BCKL=-1 ;None, configurable via web UI (e.g. 2 for D4)
|
||||
-D TOUCH_CS=-1 ;NC
|
||||
-D TFT_RST=2 ;D4
|
||||
-D SPI_FREQUENCY=27000000
|
||||
@ -388,7 +387,7 @@ build_flags =
|
||||
-D TFT_SCLK=14 ;D5
|
||||
-D TFT_CS=15 ;D8
|
||||
-D TFT_DC=0 ;D3
|
||||
-D TFT_BCKL=2 ;D4
|
||||
-D TFT_BCKL=-1 ;None, configurable via web UI (e.g. 2 for D4)
|
||||
-D TOUCH_CS=-1 ;NC
|
||||
-D TFT_RST=2 ;D4
|
||||
-D SPI_FREQUENCY=27000000
|
||||
|
@ -490,9 +490,11 @@ void haspSetup()
|
||||
// lv_obj_set_size(pages[0], hres, vres);
|
||||
}
|
||||
|
||||
haspDisconnect();
|
||||
haspLoadPage(haspPagesPath);
|
||||
haspSetPage(haspStartPage);
|
||||
if(!wifiShowAP()) {
|
||||
haspDisconnect();
|
||||
haspLoadPage(haspPagesPath);
|
||||
haspSetPage(haspStartPage);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -532,16 +532,16 @@ void guiSetup()
|
||||
lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
if(guiShowPointer || true) {
|
||||
// lv_obj_t * label = lv_label_create(lv_layer_sys(), NULL);
|
||||
// lv_label_set_text(label, "<");
|
||||
// lv_indev_set_cursor(mouse_indev, label); // connect the object to the driver
|
||||
lv_obj_t * label = lv_label_create(lv_layer_sys(), NULL);
|
||||
lv_label_set_text(label, "<");
|
||||
lv_indev_set_cursor(mouse_indev, label); // connect the object to the driver
|
||||
|
||||
/*Set a cursor for the mouse*/
|
||||
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/
|
||||
lv_obj_t * cursor_obj =
|
||||
lv_img_create(lv_disp_get_scr_act(NULL), NULL); /*Create an image object for the cursor */
|
||||
lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
|
||||
lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/
|
||||
// LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/
|
||||
// lv_obj_t * cursor_obj =
|
||||
// lv_img_create(lv_disp_get_scr_act(NULL), NULL); /*Create an image object for the cursor */
|
||||
// lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
|
||||
// lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/
|
||||
}
|
||||
|
||||
/*
|
||||
@ -694,7 +694,7 @@ bool guiSetConfig(const JsonObject & settings)
|
||||
if(calData[0] != 0 || calData[1] != 65535 || calData[2] != 0 || calData[3] != 65535) {
|
||||
Log.trace(F("calData set [%u, %u, %u, %u, %u]"), calData[0], calData[1], calData[2], calData[3],
|
||||
calData[4]);
|
||||
oobeSetAutoCalibrate(true);
|
||||
oobeSetAutoCalibrate(false);
|
||||
} else {
|
||||
Log.notice(F("First Touch Calibration enabled"));
|
||||
oobeSetAutoCalibrate(true);
|
||||
|
@ -311,6 +311,8 @@ void oobeSetup()
|
||||
oobeSetupQR(ssid, pass);
|
||||
oobeSetupSsid();
|
||||
oobeSetPage(0);
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), gotoPage1_cb);
|
||||
}
|
||||
|
||||
if(oobeAutoCalibrate) {
|
||||
@ -318,8 +320,6 @@ void oobeSetup()
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), oobe_calibrate_cb);
|
||||
Log.verbose(F("OOBE: Enabled Auto Calibrate on touch"));
|
||||
} else {
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), gotoPage1_cb);
|
||||
Log.verbose(F("OOBE: Already calibrated"));
|
||||
}
|
||||
}
|
@ -131,11 +131,36 @@ void wifiSTADisconnected(WiFiEventStationModeDisconnected info)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool wifiShowAP()
|
||||
{
|
||||
return (strlen(wifiSsid) == 0);
|
||||
}
|
||||
|
||||
bool wifiShowAP(char * ssid, char * pass)
|
||||
{
|
||||
if(strlen(wifiSsid) != 0) return false;
|
||||
|
||||
byte mac[6];
|
||||
WiFi.macAddress(mac);
|
||||
sprintf_P(ssid, PSTR("HASP-%02x%02x%02x"), mac[3], mac[4], mac[5]);
|
||||
sprintf_P(pass, PSTR("haspadmin"));
|
||||
|
||||
WiFi.softAP(ssid, pass);
|
||||
|
||||
/* Setup the DNS server redirecting all the domains to the apIP */
|
||||
// dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||
// dnsServer.start(DNS_PORT, "*", apIP);
|
||||
|
||||
Log.warning(F("WIFI: Temporary Access Point %s password: %s"), ssid, pass);
|
||||
Log.warning(F("WIFI: AP IP address : %s"), WiFi.softAPIP().toString().c_str());
|
||||
// httpReconnect();}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wifiSetup()
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
if(strlen(wifiSsid) == 0) {
|
||||
if(wifiShowAP()) {
|
||||
WiFi.mode(WIFI_AP);
|
||||
} else {
|
||||
WiFi.mode(WIFI_STA);
|
||||
@ -155,33 +180,6 @@ void wifiSetup()
|
||||
}
|
||||
}
|
||||
|
||||
bool wifiConfigured()
|
||||
{
|
||||
return (strlen(wifiSsid) >= 0);
|
||||
}
|
||||
|
||||
bool wifiShowAP(char * ssid, char * pass)
|
||||
{
|
||||
// if(WiFi.mode != WIFI_AP) return false;
|
||||
|
||||
byte mac[6];
|
||||
WiFi.macAddress(mac);
|
||||
sprintf_P(ssid, PSTR("HASP-%02x%02x%02x"), mac[3], mac[4], mac[5]);
|
||||
sprintf_P(pass, PSTR("haspadmin"));
|
||||
|
||||
// WiFi.softAP(ssid, pass);
|
||||
|
||||
/* Setup the DNS server redirecting all the domains to the apIP */
|
||||
// dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||
// dnsServer.start(DNS_PORT, "*", apIP);
|
||||
|
||||
Log.warning(F("WIFI: Temporary Access Point %s password: %s"), ssid, pass);
|
||||
Log.warning(F("WIFI: AP IP address : %s"), WiFi.softAPIP().toString().c_str());
|
||||
// httpReconnect();}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wifiEvery5Seconds()
|
||||
{
|
||||
if(WiFi.getMode() == WIFI_AP || WiFi.status() == WL_CONNECTED) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
void wifiSetup();
|
||||
bool wifiShowAP();
|
||||
bool wifiShowAP(char * ssid, char * pass);
|
||||
bool wifiEvery5Seconds(void);
|
||||
void wifiStop(void);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "lvgl.h"
|
||||
|
||||
#if 0
|
||||
const uint8_t mouse_cursor_icon_map[] = {
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
/*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/
|
||||
@ -3381,4 +3381,5 @@ lv_img_dsc_t mouse_cursor_icon = {
|
||||
.data_size = 280 * LV_IMG_PX_SIZE_ALPHA_BYTE,
|
||||
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
|
||||
.data = mouse_cursor_icon_map,
|
||||
};
|
||||
};
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user