mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 05:06:44 +00:00
Fix build warnings
This commit is contained in:
parent
50fd005433
commit
3dc9b89fd6
@ -338,7 +338,7 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
|||||||
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
|
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
|
||||||
* LV_FONT_DECLARE(my_font_2)
|
* LV_FONT_DECLARE(my_font_2)
|
||||||
*/
|
*/
|
||||||
#define LV_FONT_CUSTOM_DECLARE static lv_font_t *defaultFont;
|
//#define LV_FONT_CUSTOM_DECLARE static lv_font_t *defaultFont;
|
||||||
|
|
||||||
/*Always set a default font from the built-in fonts*/
|
/*Always set a default font from the built-in fonts*/
|
||||||
#define LV_FONT_DEFAULT &lv_font_unscii_8
|
#define LV_FONT_DEFAULT &lv_font_unscii_8
|
||||||
|
@ -174,7 +174,7 @@ static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p)
|
|||||||
// File file = *(File *)(file_p);
|
// File file = *(File *)(file_p);
|
||||||
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
||||||
|
|
||||||
char * msg;
|
char * msg = nullptr;
|
||||||
sprintf(msg, "Closing: %s", file->name());
|
sprintf(msg, "Closing: %s", file->name());
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
@ -196,9 +196,9 @@ static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p)
|
|||||||
static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br)
|
static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br)
|
||||||
{
|
{
|
||||||
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
||||||
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
||||||
|
|
||||||
char * msg;
|
char * msg = nullptr;
|
||||||
sprintf(msg, "Reading: %s", file->name());
|
sprintf(msg, "Reading: %s", file->name());
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
@ -252,7 +252,7 @@ static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos)
|
|||||||
{
|
{
|
||||||
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
||||||
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
||||||
char * msg;
|
char * msg = nullptr;
|
||||||
sprintf(msg, "Seeking: %s", file->name());
|
sprintf(msg, "Seeking: %s", file->name());
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
@ -274,8 +274,8 @@ static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos)
|
|||||||
static lv_fs_res_t fs_size(lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
|
static lv_fs_res_t fs_size(lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
|
||||||
{
|
{
|
||||||
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
||||||
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
||||||
char * msg;
|
char * msg = nullptr;
|
||||||
sprintf(msg, "Filesize: %s", file->name());
|
sprintf(msg, "Filesize: %s", file->name());
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
@ -295,8 +295,8 @@ static lv_fs_res_t fs_size(lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
|
|||||||
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
||||||
{
|
{
|
||||||
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
lv_spiffs_file_t * file = (lv_spiffs_file_t *)file_p; /*Convert type*/
|
||||||
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
// lv_spiffs_file_t file = *(lv_spiffs_file_t *)(file_p);
|
||||||
char * msg;
|
char * msg = nullptr;
|
||||||
sprintf(msg, "Telling: %s", file->name());
|
sprintf(msg, "Telling: %s", file->name());
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
typedef enum zifont_error_t {
|
enum zifont_error_t {
|
||||||
ZIFONT_NO_ERROR,
|
ZIFONT_NO_ERROR,
|
||||||
ZIFONT_ERROR_OUT_OF_MEMORY,
|
ZIFONT_ERROR_OUT_OF_MEMORY,
|
||||||
ZIFONT_ERROR_OPENING_FILE,
|
ZIFONT_ERROR_OPENING_FILE,
|
||||||
@ -29,7 +29,7 @@ typedef enum zifont_error_t {
|
|||||||
ZIFONT_ERROR_UNKNOWN_HEADER
|
ZIFONT_ERROR_UNKNOWN_HEADER
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum zifont_codepage_t8_t {
|
enum zifont_codepage_t8_t {
|
||||||
ASCII = 0x01,
|
ASCII = 0x01,
|
||||||
// GB2312 = 0x02,
|
// GB2312 = 0x02,
|
||||||
ISO_8859_1 = 0x03,
|
ISO_8859_1 = 0x03,
|
||||||
@ -124,7 +124,6 @@ int lv_zifont_font_init(lv_font_t ** font, const char * font_path, uint16_t size
|
|||||||
dsc = (lv_font_fmt_zifont_dsc_t *)(*font)->dsc;
|
dsc = (lv_font_fmt_zifont_dsc_t *)(*font)->dsc;
|
||||||
}
|
}
|
||||||
if(dsc == NULL) return ZIFONT_ERROR_OUT_OF_MEMORY;
|
if(dsc == NULL) return ZIFONT_ERROR_OUT_OF_MEMORY;
|
||||||
int error = 0;
|
|
||||||
|
|
||||||
/* Initialize Last Glyph DSC */
|
/* Initialize Last Glyph DSC */
|
||||||
dsc->last_glyph_dsc = (lv_zifont_char_t *)lv_mem_alloc(sizeof(lv_zifont_char_t));
|
dsc->last_glyph_dsc = (lv_zifont_char_t *)lv_mem_alloc(sizeof(lv_zifont_char_t));
|
||||||
@ -236,7 +235,6 @@ int lv_zifont_font_init(lv_font_t ** font, const char * font_path, uint16_t size
|
|||||||
static const uint8_t * lv_font_get_bitmap_fmt_zifont(const lv_font_t * font, uint32_t unicode_letter)
|
static const uint8_t * lv_font_get_bitmap_fmt_zifont(const lv_font_t * font, uint32_t unicode_letter)
|
||||||
{
|
{
|
||||||
lv_font_fmt_zifont_dsc_t * fdsc = (lv_font_fmt_zifont_dsc_t *)font->dsc; /* header data struct */
|
lv_font_fmt_zifont_dsc_t * fdsc = (lv_font_fmt_zifont_dsc_t *)font->dsc; /* header data struct */
|
||||||
int error = 0;
|
|
||||||
uint32_t glyphID;
|
uint32_t glyphID;
|
||||||
char filename[32];
|
char filename[32];
|
||||||
|
|
||||||
@ -412,7 +410,6 @@ static bool lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t * font, lv_font_gly
|
|||||||
// ulong startMillis = millis();
|
// ulong startMillis = millis();
|
||||||
lv_font_fmt_zifont_dsc_t * fdsc = (lv_font_fmt_zifont_dsc_t *)font->dsc; /* header data struct */
|
lv_font_fmt_zifont_dsc_t * fdsc = (lv_font_fmt_zifont_dsc_t *)font->dsc; /* header data struct */
|
||||||
uint16_t glyphID;
|
uint16_t glyphID;
|
||||||
int error = 0;
|
|
||||||
|
|
||||||
/* Only ascii characteres supported for now */
|
/* Only ascii characteres supported for now */
|
||||||
if(unicode_letter < 0x20) return false;
|
if(unicode_letter < 0x20) return false;
|
||||||
@ -476,8 +473,6 @@ static bool lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t * font, lv_font_gly
|
|||||||
lastCharInfo = fdsc->ascii_glyph_dsc[glyphID];
|
lastCharInfo = fdsc->ascii_glyph_dsc[glyphID];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t w = lastCharInfo.width + lastCharInfo.kerningL + lastCharInfo.kerningR;
|
|
||||||
|
|
||||||
/*cache glyph data*/
|
/*cache glyph data*/
|
||||||
fdsc->last_glyph_id = glyphID;
|
fdsc->last_glyph_id = glyphID;
|
||||||
fdsc->last_glyph_dsc = &lastCharInfo;
|
fdsc->last_glyph_dsc = &lastCharInfo;
|
||||||
|
@ -60,24 +60,26 @@ TFT_ROTATION = 0 ; 0=0, 1=90, 2=180 or 3=270 degree
|
|||||||
|
|
||||||
[env]
|
[env]
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 74880
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
; -- Shared library dependencies in all environments
|
; -- Shared library dependencies in all environments
|
||||||
lib_deps =
|
lib_deps =
|
||||||
;lvgl@^7.0.0 ; Not in library yet
|
;lvgl@^7.0.0 ; Not in library yet
|
||||||
TFT_eSPI@^2.0.0
|
TFT_eSPI@^2.1.2
|
||||||
PubSubClient@^2.7.0 ; MQTT client
|
PubSubClient@^2.7.0 ; MQTT client
|
||||||
ArduinoJson@^6.14.1,>6.14.0 ; needs at least 6.14.1
|
ArduinoJson@^6.14.1,>6.14.0 ; needs at least 6.14.1
|
||||||
Syslog@^2.0.0
|
Syslog@^2.0.0
|
||||||
|
|
||||||
|
|
||||||
; -- littlevgl config options ----------------------
|
; -- littlevgl config options ----------------------
|
||||||
build_flags =
|
build_flags =
|
||||||
-Os ; Code Size Optimization
|
-Os ; Code Size Optimization
|
||||||
-w ; Suppress warnings
|
;-w ; Suppress warnings
|
||||||
-D LV_CONF_INCLUDE_SIMPLE
|
-D LV_CONF_INCLUDE_SIMPLE
|
||||||
-D SPIFFS_TEMPORAL_FD_CACHE ; speedup opening recent files
|
-D SPIFFS_TEMPORAL_FD_CACHE ; speedup opening recent files
|
||||||
-D ARDUINOJSON_DECODE_UNICODE=1 ; for utf-8 symbols
|
-D ARDUINOJSON_DECODE_UNICODE=1 ; for utf-8 symbols
|
||||||
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
|
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
|
||||||
|
;-D Pins_Arduino_h ; fix for D32 warnings
|
||||||
-I include ; include lv_conf.h and hasp_conf.h
|
-I include ; include lv_conf.h and hasp_conf.h
|
||||||
${override.build_flags}
|
${override.build_flags}
|
||||||
|
|
||||||
@ -126,8 +128,8 @@ src_filter = +<*> +<../drivers/stm32f429_disco>
|
|||||||
[env:d1mini32-lolintft24]
|
[env:d1mini32-lolintft24]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = wemos_d1_mini32
|
board = wemos_d1_mini32
|
||||||
upload_port = COM6 ; Change to the correct port
|
upload_port = COM8 ; Change to the correct port
|
||||||
monitor_port = COM6 ; Change to the correct port
|
monitor_port = COM8 ; Change to the correct port
|
||||||
board_build.partitions = default.csv
|
board_build.partitions = default.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
@ -190,10 +192,10 @@ upload_port = COM4 ; Change to the correct port
|
|||||||
monitor_port = COM4 ; Change to the correct port
|
monitor_port = COM4 ; Change to the correct port
|
||||||
board_build.f_flash = 40000000L
|
board_build.f_flash = 40000000L
|
||||||
board_build.flash_mode = dout
|
board_build.flash_mode = dout
|
||||||
|
board_build.ldscript = eagle.flash.4m3m.ld ; 3Mb Spiffs
|
||||||
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-Wl,-Teagle.flash.4m3m.ld
|
|
||||||
; -- TFT_eSPI build options ------------------------
|
; -- TFT_eSPI build options ------------------------
|
||||||
-D MQTT_MAX_PACKET_SIZE=512 ; longer PubSubClient messages
|
-D MQTT_MAX_PACKET_SIZE=512 ; longer PubSubClient messages
|
||||||
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
||||||
@ -224,9 +226,9 @@ monitor_port = COM5
|
|||||||
upload_port = COM5 ; Change to the correct port
|
upload_port = COM5 ; Change to the correct port
|
||||||
board_build.f_flash = 40000000L
|
board_build.f_flash = 40000000L
|
||||||
board_build.flash_mode = dout
|
board_build.flash_mode = dout
|
||||||
|
board_build.ldscript = eagle.flash.4m3m.ld ; 3Mb Spiffs
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-Wl,-Teagle.flash.4m3m.ld
|
|
||||||
; -- TFT_eSPI build options ------------------------
|
; -- TFT_eSPI build options ------------------------
|
||||||
-D MQTT_MAX_PACKET_SIZE=512 ; longer PubSubClient messages
|
-D MQTT_MAX_PACKET_SIZE=512 ; longer PubSubClient messages
|
||||||
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
||||||
|
34
src/hasp.cpp
34
src/hasp.cpp
@ -63,6 +63,7 @@ void hasp_background(uint16_t pageid, uint16_t imageid);
|
|||||||
**********************/
|
**********************/
|
||||||
static lv_style_t style_mbox_bg; /*Black bg. style with opacity*/
|
static lv_style_t style_mbox_bg; /*Black bg. style with opacity*/
|
||||||
static lv_obj_t * kb;
|
static lv_obj_t * kb;
|
||||||
|
static lv_font_t * defaultFont;
|
||||||
|
|
||||||
#if LV_DEMO_WALLPAPER
|
#if LV_DEMO_WALLPAPER
|
||||||
LV_IMG_DECLARE(img_bubble_pattern)
|
LV_IMG_DECLARE(img_bubble_pattern)
|
||||||
@ -425,12 +426,13 @@ bool haspGetObjAttribute(lv_obj_t * obj, String strAttr, std::string & strPayloa
|
|||||||
if(strAttr == F(".val")) {
|
if(strAttr == F(".val")) {
|
||||||
if(check_obj_type(list.type[0], LV_HASP_PRELOADER)) return false;
|
if(check_obj_type(list.type[0], LV_HASP_PRELOADER)) return false;
|
||||||
|
|
||||||
if(check_obj_type(list.type[0], LV_HASP_BUTTON))
|
if(check_obj_type(list.type[0], LV_HASP_BUTTON)) {
|
||||||
if(lv_btn_get_state(obj) == LV_BTN_STATE_TGL_PR ||
|
if(lv_btn_get_state(obj) == LV_BTN_STATE_TGL_PR ||
|
||||||
lv_btn_get_state(obj) == LV_BTN_STATE_TGL_REL)
|
lv_btn_get_state(obj) == LV_BTN_STATE_TGL_REL)
|
||||||
strPayload = "1"; // It's toggled
|
strPayload = "1"; // It's toggled
|
||||||
else
|
else
|
||||||
strPayload = "0"; // Normal btn has no toggle state
|
strPayload = "0"; // Normal btn has no toggle state
|
||||||
|
}
|
||||||
|
|
||||||
if(check_obj_type(list.type[0], LV_HASP_SLIDER))
|
if(check_obj_type(list.type[0], LV_HASP_SLIDER))
|
||||||
strPayload = String(lv_slider_get_value(obj)).c_str();
|
strPayload = String(lv_slider_get_value(obj)).c_str();
|
||||||
@ -815,21 +817,21 @@ void haspFirstSetup(void)
|
|||||||
*/
|
*/
|
||||||
void haspSetup(JsonObject settings)
|
void haspSetup(JsonObject settings)
|
||||||
{
|
{
|
||||||
char buffer[127];
|
|
||||||
|
|
||||||
haspSetConfig(settings);
|
haspSetConfig(settings);
|
||||||
|
|
||||||
#ifdef LV_HASP_HOR_RES_MAX
|
/*
|
||||||
lv_coord_t hres = LV_HASP_HOR_RES_MAX;
|
#ifdef LV_HASP_HOR_RES_MAX
|
||||||
#else
|
lv_coord_t hres = LV_HASP_HOR_RES_MAX;
|
||||||
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
#else
|
||||||
#endif
|
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LV_HASP_VER_RES_MAX
|
#ifdef LV_HASP_VER_RES_MAX
|
||||||
lv_coord_t vres = LV_HASP_VER_RES_MAX;
|
lv_coord_t vres = LV_HASP_VER_RES_MAX;
|
||||||
#else
|
#else
|
||||||
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
// static lv_font_t *
|
// static lv_font_t *
|
||||||
// my_font = (lv_font_t *)lv_mem_alloc(sizeof(lv_font_t));
|
// my_font = (lv_font_t *)lv_mem_alloc(sizeof(lv_font_t));
|
||||||
@ -1366,7 +1368,7 @@ void haspNewObject(const JsonObject & config)
|
|||||||
lv_slider_set_range(obj, min, max);
|
lv_slider_set_range(obj, min, max);
|
||||||
lv_slider_set_value(obj, val, LV_ANIM_OFF);
|
lv_slider_set_value(obj, val, LV_ANIM_OFF);
|
||||||
lv_obj_set_event_cb(obj, slider_event_handler);
|
lv_obj_set_event_cb(obj, slider_event_handler);
|
||||||
bool knobin = config[F("knobin")].as<bool>() | true;
|
// bool knobin = config[F("knobin")].as<bool>() | true;
|
||||||
// lv_slider_set_knob_in(obj, knobin);
|
// lv_slider_set_knob_in(obj, knobin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1525,7 +1527,7 @@ bool haspGetConfig(const JsonObject & settings)
|
|||||||
settings[FPSTR(F_CONFIG_ZIFONT)] = haspZiFontPath;
|
settings[FPSTR(F_CONFIG_ZIFONT)] = haspZiFontPath;
|
||||||
settings[FPSTR(F_CONFIG_PAGES)] = haspPagesPath;
|
settings[FPSTR(F_CONFIG_PAGES)] = haspPagesPath;
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1562,7 +1564,7 @@ bool haspSetConfig(const JsonObject & settings)
|
|||||||
haspThemeHue = settings[FPSTR(F_CONFIG_HUE)].as<uint16_t>();
|
haspThemeHue = settings[FPSTR(F_CONFIG_HUE)].as<uint16_t>();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
|
@ -39,7 +39,7 @@ extern "C" {
|
|||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
typedef enum lv_hasp_obj_type_t {
|
enum lv_hasp_obj_type_t {
|
||||||
LV_HASP_BUTTON = 10,
|
LV_HASP_BUTTON = 10,
|
||||||
LV_HASP_CHECKBOX = 11,
|
LV_HASP_CHECKBOX = 11,
|
||||||
LV_HASP_LABEL = 12,
|
LV_HASP_LABEL = 12,
|
||||||
|
@ -46,7 +46,7 @@ Syslog syslog(syslogClient, debugSyslogHost.c_str(), debugSyslogPort, debugAppNa
|
|||||||
|
|
||||||
void debugSetup()
|
void debugSetup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200); /* prepare for possible serial debug */
|
Serial.begin(74880); /* prepare for possible serial debug */
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
@ -111,8 +111,11 @@ void dispatchJson(char * payload)
|
|||||||
strPayload.remove(strPayload.length() - 2, 2);
|
strPayload.remove(strPayload.length() - 2, 2);
|
||||||
strPayload.concat("]");
|
strPayload.concat("]");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
DynamicJsonDocument haspCommands(MQTT_MAX_PACKET_SIZE + 512);
|
DynamicJsonDocument haspCommands(MQTT_MAX_PACKET_SIZE + 512);
|
||||||
DeserializationError jsonError = deserializeJson(haspCommands, payload);
|
DeserializationError jsonError = deserializeJson(haspCommands, payload);
|
||||||
|
haspCommands.shrinkToFit();
|
||||||
|
|
||||||
if(jsonError) { // Couldn't parse incoming JSON command
|
if(jsonError) { // Couldn't parse incoming JSON command
|
||||||
errorPrintln(String(F("JSON: %sFailed to parse incoming JSON command with error: ")) +
|
errorPrintln(String(F("JSON: %sFailed to parse incoming JSON command with error: ")) +
|
||||||
String(jsonError.c_str()));
|
String(jsonError.c_str()));
|
||||||
@ -137,7 +140,7 @@ void dispatchReboot(bool saveConfig)
|
|||||||
debugStop();
|
debugStop();
|
||||||
delay(250);
|
delay(250);
|
||||||
wifiStop();
|
wifiStop();
|
||||||
debugPrintln(F("CMND: Properly Rebooting the MCU now!"));
|
debugPrintln(F("STOP: Properly Rebooting the MCU now!"));
|
||||||
debugPrintln(F("-------------------------------------"));
|
debugPrintln(F("-------------------------------------"));
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
delay(5000);
|
delay(5000);
|
||||||
|
@ -483,7 +483,7 @@ void guiTakeScreenshot(const char * pFileName)
|
|||||||
pFileOut.write(bmpheader, sizeof(bmpheader));
|
pFileOut.write(bmpheader, sizeof(bmpheader));
|
||||||
|
|
||||||
if(pFileOut == NULL) {
|
if(pFileOut == NULL) {
|
||||||
printf(("[Display] error: %s cannot be opened", pFileName));
|
printf("[Display] error: %s cannot be opened", pFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ void guiTakeScreenshot(const char * pFileName)
|
|||||||
guiSnapshot = 0;
|
guiSnapshot = 0;
|
||||||
|
|
||||||
pFileOut.close();
|
pFileOut.close();
|
||||||
printf(("[Display] data flushed to %s", pFileName));
|
printf("[Display] data flushed to %s", pFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
@ -96,4 +96,13 @@ uint8_t halGetHeapFragmentation()
|
|||||||
#else
|
#else
|
||||||
return ESP.getHeapFragmentation();
|
return ESP.getHeapFragmentation();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t halGetMaxFreeBlock()
|
||||||
|
{
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
return ESP.getMaxAllocHeap();
|
||||||
|
#else
|
||||||
|
return ESP.getMaxFreeBlockSize();
|
||||||
|
#endif
|
||||||
}
|
}
|
@ -5,5 +5,6 @@
|
|||||||
|
|
||||||
uint8_t halGetHeapFragmentation(void);
|
uint8_t halGetHeapFragmentation(void);
|
||||||
String halGetResetInfo(void);
|
String halGetResetInfo(void);
|
||||||
|
size_t halGetMaxFreeBlock();
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -148,7 +148,7 @@ void webHandleRoot()
|
|||||||
{
|
{
|
||||||
if(!httpIsAuthenticated(F("root"))) return;
|
if(!httpIsAuthenticated(F("root"))) return;
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -266,7 +266,7 @@ void webHandleInfo()
|
|||||||
{ // http://plate01/
|
{ // http://plate01/
|
||||||
if(!httpIsAuthenticated(F("/info"))) return;
|
if(!httpIsAuthenticated(F("/info"))) return;
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -374,9 +374,7 @@ String urldecode(String str)
|
|||||||
{
|
{
|
||||||
String encodedString = "";
|
String encodedString = "";
|
||||||
char c;
|
char c;
|
||||||
char code0;
|
for(unsigned int i = 0; i < str.length(); i++) {
|
||||||
char code1;
|
|
||||||
for(int i = 0; i < str.length(); i++) {
|
|
||||||
c = str.charAt(i);
|
c = str.charAt(i);
|
||||||
if(c == '+') {
|
if(c == '+') {
|
||||||
encodedString += ' ';
|
encodedString += ' ';
|
||||||
@ -606,7 +604,7 @@ void webHandleConfig()
|
|||||||
httpHandleReboot();
|
httpHandleReboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -652,7 +650,7 @@ void webHandleMqttConfig()
|
|||||||
DynamicJsonDocument settings(256);
|
DynamicJsonDocument settings(256);
|
||||||
mqttGetConfig(settings.to<JsonObject>());
|
mqttGetConfig(settings.to<JsonObject>());
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -696,7 +694,7 @@ void webHandleGuiConfig()
|
|||||||
DynamicJsonDocument settings(256);
|
DynamicJsonDocument settings(256);
|
||||||
// guiGetConfig(settings.to<JsonObject>());
|
// guiGetConfig(settings.to<JsonObject>());
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -726,7 +724,7 @@ void webHandleWifiConfig()
|
|||||||
DynamicJsonDocument settings(256);
|
DynamicJsonDocument settings(256);
|
||||||
wifiGetConfig(settings.to<JsonObject>());
|
wifiGetConfig(settings.to<JsonObject>());
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -762,7 +760,7 @@ void webHandleHttpConfig()
|
|||||||
DynamicJsonDocument settings(256);
|
DynamicJsonDocument settings(256);
|
||||||
httpGetConfig(settings.to<JsonObject>());
|
httpGetConfig(settings.to<JsonObject>());
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -797,7 +795,7 @@ void webHandleHaspConfig()
|
|||||||
DynamicJsonDocument settings(256);
|
DynamicJsonDocument settings(256);
|
||||||
haspGetConfig(settings.to<JsonObject>());
|
haspGetConfig(settings.to<JsonObject>());
|
||||||
|
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
@ -926,7 +924,7 @@ void httpHandleEspFirmware()
|
|||||||
if(!httpIsAuthenticated(F("/espfirmware"))) return;
|
if(!httpIsAuthenticated(F("/espfirmware"))) return;
|
||||||
|
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
httpMessage += String(F("<h1>"));
|
httpMessage += String(F("<h1>"));
|
||||||
@ -949,7 +947,7 @@ void httpHandleResetConfig()
|
|||||||
|
|
||||||
bool resetConfirmed = webServer.arg(F("confirm")) == F("yes");
|
bool resetConfirmed = webServer.arg(F("confirm")) == F("yes");
|
||||||
String nodename = haspGetNodename();
|
String nodename = haspGetNodename();
|
||||||
char buffer[127];
|
// char buffer[127];
|
||||||
String httpMessage((char *)0);
|
String httpMessage((char *)0);
|
||||||
httpMessage.reserve(1500);
|
httpMessage.reserve(1500);
|
||||||
|
|
||||||
@ -1066,11 +1064,12 @@ void httpReconnect()
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void httpLoop(bool wifiIsConnected)
|
void httpLoop(bool wifiIsConnected)
|
||||||
{
|
{
|
||||||
if(httpEnable)
|
if(httpEnable) {
|
||||||
if(webServerStarted)
|
if(webServerStarted)
|
||||||
webServer.handleClient();
|
webServer.handleClient();
|
||||||
else
|
else
|
||||||
httpReconnect();
|
httpReconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1081,7 +1080,7 @@ bool httpGetConfig(const JsonObject & settings)
|
|||||||
settings[FPSTR(F_CONFIG_USER)] = httpUser;
|
settings[FPSTR(F_CONFIG_USER)] = httpUser;
|
||||||
settings[FPSTR(F_CONFIG_PASS)] = httpPassword;
|
settings[FPSTR(F_CONFIG_PASS)] = httpPassword;
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1112,7 +1111,7 @@ bool httpSetConfig(const JsonObject & settings)
|
|||||||
httpPort = settings[FPSTR(F_CONFIG_PORT)].as<uint8_t>();
|
httpPort = settings[FPSTR(F_CONFIG_PORT)].as<uint8_t>();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
|
@ -48,7 +48,7 @@ bool mdnsGetConfig(const JsonObject & settings)
|
|||||||
|
|
||||||
settings[F_CONFIG_ENABLE] = mdnsEnabled;
|
settings[F_CONFIG_ENABLE] = mdnsEnabled;
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,7 +47,7 @@ void spiffsSetup()
|
|||||||
#else
|
#else
|
||||||
if(!SPIFFS.begin(true)) {
|
if(!SPIFFS.begin(true)) {
|
||||||
#endif
|
#endif
|
||||||
sprintf(msg, PSTR("FILE: %sSPI flash init failed. Unable to mount FS."));
|
sprintf(msg, PSTR("FILE: %%sSPI flash init failed. Unable to mount FS."));
|
||||||
errorPrintln(msg);
|
errorPrintln(msg);
|
||||||
} else {
|
} else {
|
||||||
sprintf(msg, PSTR("FILE: [SUCCESS] SPI flash FS mounted"));
|
sprintf(msg, PSTR("FILE: [SUCCESS] SPI flash FS mounted"));
|
||||||
|
@ -79,7 +79,7 @@ void tftShowConfig(TFT_eSPI & tft)
|
|||||||
|
|
||||||
sprintf_P(buffer, PSTR("TFT: TFT_eSPI ver = %s"), tftSetup.version.c_str());
|
sprintf_P(buffer, PSTR("TFT: TFT_eSPI ver = %s"), tftSetup.version.c_str());
|
||||||
debugPrintln(buffer);
|
debugPrintln(buffer);
|
||||||
sprintf_P(buffer, PSTR("TFT: Processor = ESP%i"), tftSetup.esp, HEX);
|
sprintf_P(buffer, PSTR("TFT: Processor = ESP%i"), tftSetup.esp);
|
||||||
debugPrintln(buffer);
|
debugPrintln(buffer);
|
||||||
sprintf_P(buffer, PSTR("TFT: Frequency = %i MHz"), ESP.getCpuFreqMHz());
|
sprintf_P(buffer, PSTR("TFT: Frequency = %i MHz"), ESP.getCpuFreqMHz());
|
||||||
debugPrintln(buffer);
|
debugPrintln(buffer);
|
||||||
|
@ -211,7 +211,7 @@ bool wifiGetConfig(const JsonObject & settings)
|
|||||||
settings[FPSTR(F_CONFIG_SSID)] = String(wifiSsid.c_str());
|
settings[FPSTR(F_CONFIG_SSID)] = String(wifiSsid.c_str());
|
||||||
settings[FPSTR(F_CONFIG_PASS)] = String(wifiPassword.c_str());
|
settings[FPSTR(F_CONFIG_PASS)] = String(wifiPassword.c_str());
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -241,7 +241,7 @@ bool wifiSetConfig(const JsonObject & settings)
|
|||||||
wifiPassword = settings[FPSTR(F_CONFIG_PASS)].as<String>().c_str();
|
wifiPassword = settings[FPSTR(F_CONFIG_PASS)].as<String>().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = serializeJson(settings, Serial);
|
serializeJson(settings, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
|
@ -36,7 +36,7 @@ static lv_style_t label_prim;
|
|||||||
static lv_style_t label_sec;
|
static lv_style_t label_sec;
|
||||||
static lv_style_t label_hint;
|
static lv_style_t label_hint;
|
||||||
|
|
||||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
// static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||||
|
|
||||||
/*Saved input parameters*/
|
/*Saved input parameters*/
|
||||||
static uint16_t _hue;
|
static uint16_t _hue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user