Initial lvgl v8 test

This commit is contained in:
fvanroie 2021-07-17 16:27:51 +02:00
parent 02cb5fea78
commit 9b17008739
107 changed files with 2149 additions and 1982 deletions

View File

@ -2,15 +2,19 @@
#include "user_config_override.h" #include "user_config_override.h"
#endif #endif
#include "lv_conf_v7.h" // #include "lv_conf_v7.h"
#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG // #define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG
/*#include "lv_conf_v8.h" #include "lv_conf_v8.h"
#include "lv_symbol_mdi_def.h"
#ifndef LV_CONF_STUB_H #ifndef LV_CONF_STUB_H
#define LV_CONF_STUB_H #define LV_CONF_STUB_H
#ifdef LV_THEME_DEFAULT_FLAG #define LV_THEME_DEFAULT_FLAG 0
#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG
//#ifdef LV_THEME_DEFAULT_FLAG
//#define lv_task_handler lv_timer_handler //#define lv_task_handler lv_timer_handler
@ -28,9 +32,9 @@
#define lv_checkbox_set_checked(obj, en) \ #define lv_checkbox_set_checked(obj, en) \
((en) ? lv_obj_add_state(obj, LV_STATE_CHECKED) : lv_obj_clear_state(obj, LV_STATE_CHECKED)) ((en) ? lv_obj_add_state(obj, LV_STATE_CHECKED) : lv_obj_clear_state(obj, LV_STATE_CHECKED))
#define lv_checkbox_is_checked(obj) ((lv_obj_get_state(obj) & LV_STATE_CHECKED)?true:false) #define lv_checkbox_is_checked(obj) ((lv_obj_get_state(obj) & LV_STATE_CHECKED) ? true : false)
#define lv_chart_set_range(chart, ymin, ymax) lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax) //#define lv_chart_set_range(chart, ymin, ymax) lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax)
#define lv_obj_set_style_local_pad_inner lv_obj_set_style_local_pad_top #define lv_obj_set_style_local_pad_inner lv_obj_set_style_local_pad_top
#define lv_dropdown_set_draw_arrow(obj, en) lv_dropdown_set_symbol(obj, en ? LV_SYMBOL_DOWN : NULL) #define lv_dropdown_set_draw_arrow(obj, en) lv_dropdown_set_symbol(obj, en ? LV_SYMBOL_DOWN : NULL)
@ -38,6 +42,8 @@
#define lv_cont_set_layout(obj, fit) #define lv_cont_set_layout(obj, fit)
#define lv_roller_set_auto_fit(obj, fit) #define lv_roller_set_auto_fit(obj, fit)
#define lv_obj_set_top(obj, fit) #define lv_obj_set_top(obj, fit)
#define lv_obj_add_protect(a, b)
#define LV_PROTECT_PRESS_LOST 0
#define LV_BTN_STATE_PRESSED LV_STATE_PRESSED #define LV_BTN_STATE_PRESSED LV_STATE_PRESSED
#define LV_BTN_STATE_DISABLED LV_STATE_DISABLED #define LV_BTN_STATE_DISABLED LV_STATE_DISABLED
@ -50,6 +56,11 @@
#define lv_btn_get_state lv_obj_get_state #define lv_btn_get_state lv_obj_get_state
#define lv_btn_state_t lv_state_t #define lv_btn_state_t lv_state_t
#define lv_disp_buf_t lv_disp_draw_buf_t
#define lv_disp_buf_init lv_disp_draw_buf_init
#define lv_switch_get_state lv_obj_get_state
#define LV_CPICKER_PART_MAIN LV_COLORWHEEL_PART_MAIN #define LV_CPICKER_PART_MAIN LV_COLORWHEEL_PART_MAIN
#define LV_CPICKER_PART_KNOB LV_COLORWHEEL_PART_KNOB #define LV_CPICKER_PART_KNOB LV_COLORWHEEL_PART_KNOB
#define LV_CPICKER_TYPE_RECT 0 #define LV_CPICKER_TYPE_RECT 0
@ -64,21 +75,23 @@
#define LV_CHECKBOX_PART_BG LV_CHECKBOX_PART_MAIN #define LV_CHECKBOX_PART_BG LV_CHECKBOX_PART_MAIN
#define LV_PAGE_PART_SCROLLBAR #define LV_PAGE_PART_SCROLLBAR
#define LV_TEXTAREA_PART_BG LV_TEXTAREA_PART_MAIN #define LV_TEXTAREA_PART_BG LV_PART_MAIN
#define LV_BTNMATRIX_PART_BG LV_BTNMATRIX_PART_MAIN #define LV_BTNMATRIX_PART_BG LV_PART_MAIN
#define LV_KEYBOARD_PART_BG LV_BTNMATRIX_PART_MAIN #define LV_KEYBOARD_PART_BG LV_PART_MAIN
#define LV_KEYBOARD_PART_BTN LV_BTNMATRIX_PART_BTN #define LV_KEYBOARD_PART_BTN LV_PART
#define LV_SPINBOX_PART_BG LV_ARC_PART_MAIN #define LV_SPINBOX_PART_BG LV_PART_MAIN
#define LV_SWITCH_PART_BG LV_SWITCH_PART_MAIN #define LV_SWITCH_PART_BG LV_PART_MAIN
#define LV_SLIDER_PART_BG LV_SLIDER_PART_MAIN #define LV_SLIDER_PART_BG LV_PART_MAIN
#define LV_DROPDOWN_PART_SCROLLBAR LV_DROPDOWN_PART_LIST // ?? #define LV_DROPDOWN_PART_SCROLLBAR LV_DROPDOWN_PART_LIST // ??
#define LV_TEXTAREA_PART_SCROLLBAR LV_TEXTAREA_PART_PLACEHOLDER // ?? #define LV_TEXTAREA_PART_SCROLLBAR LV_TEXTAREA_PART_PLACEHOLDER // ??
#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG #define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG
#define lv_textarea_set_cursor_hidden(a, b)
#define lv_img_get_file_name(img) \ #define lv_img_get_file_name(img) \
(((lv_img_ext_t *)lv_obj_get_ext_attr(img))->src_type == LV_IMG_SRC_FILE) \ (((lv_img_ext_t*)lv_obj_get_ext_attr(img))->src_type == LV_IMG_SRC_FILE) \
? (const char *)((lv_img_ext_t *)lv_obj_get_ext_attr(img))->src \ ? (const char*)((lv_img_ext_t*)lv_obj_get_ext_attr(img))->src \
: "" : ""
// For hasp_theme.c // For hasp_theme.c
@ -87,6 +100,27 @@
#define lv_obj_add_style_list _lv_obj_add_style_list #define lv_obj_add_style_list _lv_obj_add_style_list
#define lv_obj_report_style_mod lv_obj_report_style_change #define lv_obj_report_style_mod lv_obj_report_style_change
#define lv_keyboard_set_cursor_manage(a, b)
#define lv_obj_set_style_value_str(a, b, c)
#define LV_OBJ_PART_MAIN LV_PART_MAIN
#define LV_BTN_PART_MAIN LV_PART_MAIN
#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT
#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT
#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT
#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT
#define LV_COLOR_BLACK lv_color_black()
#define LV_COLOR_WHITE lv_color_white()
#define LV_COLOR_SILVER lv_color_make(0xff, 0xff, 0xff)
#define LV_COLOR_RED lv_color_make(0xff, 0xff, 0xff)
#define LV_COLOR_GRAY lv_color_make(0xff, 0xff, 0xff)
#define LV_IMG_CACHE_DEF_SIZE_PSRAM 20
#define _lv_memset_00(p, size) memset(p, 0, size);
#define LV_ASSERT_MEM(x)
//#endif
#endif #endif
#endif
*/

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ extern "C" {
#define LV_SYMBOL_CLOSE "\xEE\x85\x96" /* 0xE156, close */ #define LV_SYMBOL_CLOSE "\xEE\x85\x96" /* 0xE156, close */
#define LV_SYMBOL_NEW_LINE "\xEE\x98\x8C" /* 0xE60C, subdirectory-arrow-left */ #define LV_SYMBOL_NEW_LINE "\xEE\x98\x8C" /* 0xE60C, subdirectory-arrow-left */
#define LV_SYMBOL_BACKSPACE "\xEE\x81\x8D" /* 0xE04D, arrow-left */ #define LV_SYMBOL_BACKSPACE "\xEE\x81\x8D" /* 0xE04D, arrow-left */
#define LV_SYMBOL_KEYBOARD "\xEF\xA3\xBF"
/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/ /** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/
#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF" #define LV_SYMBOL_DUMMY "\xEF\xA3\xBF"

View File

@ -6,16 +6,13 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lvgl.h"
#include "lv_misc/lv_debug.h"
#include "lv_widgets/lv_canvas.h"
#include "lv_qrcode.h" #include "lv_qrcode.h"
#include "qrcodegen.h" #include "qrcodegen.h"
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define QR_SIZE 150 #define QR_SIZE 140
/********************** /**********************
* TYPEDEFS * TYPEDEFS
@ -49,38 +46,17 @@ lv_obj_t* lv_qrcode_create(lv_obj_t* parent, lv_coord_t size, lv_color_t dark_co
{ {
uint32_t buf_size = LV_CANVAS_BUF_SIZE_INDEXED_1BIT(size, size); uint32_t buf_size = LV_CANVAS_BUF_SIZE_INDEXED_1BIT(size, size);
uint8_t* buf = lv_mem_alloc(buf_size); uint8_t* buf = lv_mem_alloc(buf_size);
LV_ASSERT_MEM(buf); LV_ASSERT_MALLOC(buf);
if(buf == NULL) return NULL; if(buf == NULL) return NULL;
lv_obj_t* canvas = lv_canvas_create(parent, NULL); lv_obj_t* canvas = lv_canvas_create(parent);
if(canvas == NULL) return NULL;
lv_canvas_set_buffer(canvas, buf, size, size, LV_IMG_CF_INDEXED_1BIT); lv_canvas_set_buffer(canvas, buf, size, size, LV_IMG_CF_INDEXED_1BIT);
lv_canvas_set_palette(canvas, 0, dark_color); lv_canvas_set_palette(canvas, 0, dark_color);
lv_canvas_set_palette(canvas, 1, light_color); lv_canvas_set_palette(canvas, 1, light_color);
return canvas; return canvas;
// lv_img_dsc_t * img_buf = lv_img_buf_alloc(20, 20, LV_IMG_CF_TRUE_COLOR);
// if(img_buf == NULL) {
// LV_LOG_ERROR("img_buf failed");
// return NULL;
// }
// lv_obj_t * image = lv_img_create(parent, NULL); // empty image
// if(image == NULL) {
// lv_img_buf_free(img_buf);
// LV_LOG_ERROR("image failed");
// return NULL;
// }
// lv_img_set_auto_size(image, true); // auto size according to img_buf
// lv_img_set_src(image, img_buf); // assign the image buffer
// lv_img_set_zoom(image, 5 * LV_IMG_ZOOM_NONE); // default zoom
// lv_img_set_antialias(image, false); // don't anti-alias
// lv_obj_set_style_local_image_recolor(image, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, dark_color);
// return image;
} }
/** /**
@ -94,8 +70,7 @@ lv_res_t lv_qrcode_update(lv_obj_t* qrcode, const void* data, uint32_t data_len)
{ {
lv_color_t c; lv_color_t c;
c.full = 1; c.full = 1;
lv_canvas_fill_bg(qrcode, c, 0); lv_canvas_fill_bg(qrcode, c, LV_OPA_COVER);
// lv_canvas_zoom();
if(data_len > qrcodegen_BUFFER_LEN_MAX) return LV_RES_INV; if(data_len > qrcodegen_BUFFER_LEN_MAX) return LV_RES_INV;
@ -108,60 +83,58 @@ lv_res_t lv_qrcode_update(lv_obj_t* qrcode, const void* data, uint32_t data_len)
if(!ok) return LV_RES_INV; if(!ok) return LV_RES_INV;
lv_coord_t obj_w = lv_obj_get_width(qrcode); lv_img_dsc_t* imgdsc = lv_canvas_get_img(qrcode);
int qr_size = qrcodegen_getSize(qr0); lv_coord_t obj_w = imgdsc->header.w;
int scale = obj_w / qr_size; int qr_size = qrcodegen_getSize(qr0);
int scaled = qr_size * scale; int scale = obj_w / qr_size;
int margin = (obj_w - scaled) / 2; int scaled = qr_size * scale;
int margin = (obj_w - scaled) / 2;
uint8_t* buf_u8 = (uint8_t*)imgdsc->data + 8; /*+8 skip the palette*/
for(int y = 0; y < scaled; y++) { /* Copy the qr code canvas:
for(int x = 0; x < scaled; x++) { * A simple `lv_canvas_set_px` would work but it's slow for so many pixels.
c.full = qrcodegen_getModule(qr0, x / scale, y / scale) ? 0 : 1; * So buffer 1 byte (8 px) from the qr code and set it in the canvas image */
lv_canvas_set_px(qrcode, x + margin, y + margin, c); uint32_t row_byte_cnt = (imgdsc->header.w + 7) >> 3;
int y;
for(y = margin; y < scaled + margin; y += scale) {
uint8_t b = 0;
uint8_t p = 0;
bool aligned = false;
int x;
for(x = margin; x < scaled + margin; x++) {
bool a = qrcodegen_getModule(qr0, (x - margin) / scale, (y - margin) / scale);
if(aligned == false && (x & 0x7) == 0) aligned = true;
if(aligned == false) {
c.full = a ? 0 : 1;
lv_canvas_set_px(qrcode, x, y, c);
} else {
if(!a) b |= (1 << (7 - p));
p++;
if(p == 8) {
uint32_t px = row_byte_cnt * y + (x >> 3);
buf_u8[px] = b;
b = 0;
p = 0;
}
}
} }
}
return LV_RES_OK; /*Process the last byte of the row*/
} if(p) {
/*Make the rest of the bits white*/
b |= (1 << (8 - p)) - 1;
lv_res_t lv_qrcode_update2(lv_obj_t* qrcode, const void* data, uint32_t data_len) uint32_t px = row_byte_cnt * y + (x >> 3);
{ buf_u8[px] = b;
lv_color_t c; }
// c.full = 1;
if(data_len > qrcodegen_BUFFER_LEN_MAX) return LV_RES_INV; /*The Qr is probably scaled so simply to the repeated rows*/
int s;
/* create a working cache and results buffer */ const uint8_t* row_ori = buf_u8 + row_byte_cnt * y;
uint8_t data_tmp[qrcodegen_BUFFER_LEN_MAX]; for(s = 1; s < scale; s++) {
uint8_t qr_pixels[qrcodegen_BUFFER_LEN_MAX]; memcpy((uint8_t*)buf_u8 + row_byte_cnt * (y + s), row_ori, row_byte_cnt);
memcpy(data_tmp, data, data_len);
/* convert data into pixels */
bool ok = qrcodegen_encodeBinary(data_tmp, data_len, qr_pixels, qrcodegen_Ecc_MEDIUM, qrcodegen_VERSION_MIN,
qrcodegen_VERSION_MAX, qrcodegen_Mask_AUTO, true);
if(!ok) return LV_RES_INV;
// lv_coord_t obj_w = lv_obj_get_width(qrcode);
// int scale = 1;
// int scaled = 0;
// int qr_size = qrcodegen_getSize(qr_pixels);
int margin = 0;
lv_img_ext_t* ext = (lv_img_ext_t*)lv_obj_get_ext_attr(qrcode);
if(!ext || !ext->src) return LV_RES_INV;
lv_img_header_t header;
lv_img_decoder_get_info(ext->src, &header);
lv_img_decoder_dsc_t dec_dsc;
lv_res_t res = lv_img_decoder_open(&dec_dsc, ext->src, LV_COLOR_CYAN);
(void)res; // unused
for(int y = 0; y < dec_dsc.header.h; y++) {
for(int x = 0; x < dec_dsc.header.w; x++) {
c = qrcodegen_getModule(qr_pixels, x, y) ? LV_COLOR_WHITE : LV_COLOR_BLACK;
lv_img_buf_set_px_color((lv_img_dsc_t*)dec_dsc.src, x + margin, y + margin, c);
} }
} }
@ -175,8 +148,8 @@ lv_res_t lv_qrcode_update2(lv_obj_t* qrcode, const void* data, uint32_t data_len
void lv_qrcode_delete(lv_obj_t* qrcode) void lv_qrcode_delete(lv_obj_t* qrcode)
{ {
lv_img_dsc_t* img = lv_canvas_get_img(qrcode); lv_img_dsc_t* img = lv_canvas_get_img(qrcode);
lv_img_cache_invalidate_src(img);
lv_mem_free(img->data); lv_mem_free(img->data);
lv_mem_free(img);
lv_obj_del(qrcode); lv_obj_del(qrcode);
} }

View File

@ -13,8 +13,11 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h" #include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
@ -35,7 +38,7 @@ extern "C" {
* @param light_color light color of the QR code * @param light_color light color of the QR code
* @return pointer to the created QR code object * @return pointer to the created QR code object
*/ */
lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color); lv_obj_t* lv_qrcode_create(lv_obj_t* parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color);
/** /**
* Set the data of a QR code object * Set the data of a QR code object
@ -44,13 +47,13 @@ lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_
* @param data_len length of data in bytes * @param data_len length of data in bytes
* @return LV_RES_OK: if no error; LV_RES_INV: on error * @return LV_RES_OK: if no error; LV_RES_INV: on error
*/ */
lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_len); lv_res_t lv_qrcode_update(lv_obj_t* qrcode, const void* data, uint32_t data_len);
/** /**
* Delete a QR code object * Delete a QR code object
* @param qrcode pointer to a QR code object * @param qrcode pointer to a QR code object
*/ */
void lv_qrcode_delete(lv_obj_t * qrcode); void lv_qrcode_delete(lv_obj_t* qrcode);
/********************** /**********************
* MACROS * MACROS

View File

@ -29,7 +29,7 @@
#endif // ARDUINO_ARCH #endif // ARDUINO_ARCH
#include "lvgl.h" #include "lvgl.h"
#include "lv_misc/lv_debug.h" //#include "lv_misc/lv_debug.h"
#include "lv_zifont.h" #include "lv_zifont.h"
#include "ArduinoLog.h" #include "ArduinoLog.h"
#include "hasp_macro.h" #include "hasp_macro.h"
@ -68,6 +68,7 @@ HASP_ATTRIBUTE_FAST_MEM bool lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* f
uint32_t charInBuffer = 0; // Last Character ID in the Bitmap Buffer uint32_t charInBuffer = 0; // Last Character ID in the Bitmap Buffer
// uint8_t filecharBitmap_p[20 * 1024]; // uint8_t filecharBitmap_p[20 * 1024];
lv_zifont_char_t lastCharInfo; // Holds the last Glyph DSC lv_zifont_char_t lastCharInfo; // Holds the last Glyph DSC
size_t current_bitmap_size = 0;
#if ESP32 #if ESP32
// static lv_zifont_char_t charCache[256 - 32]; // glyphID DSC cache // static lv_zifont_char_t charCache[256 - 32]; // glyphID DSC cache
@ -113,10 +114,11 @@ static inline bool openFont(File& file, const char* filename)
static inline bool initCharacterFrame(size_t size) static inline bool initCharacterFrame(size_t size)
{ {
if(size > _lv_mem_get_size(charBitmap_p)) { if(size > current_bitmap_size) {
lv_mem_free(charBitmap_p); lv_mem_free(charBitmap_p);
charBitmap_p = (uint8_t*)lv_mem_alloc(size); charBitmap_p = (uint8_t*)lv_mem_alloc(size);
LOG_WARNING(TAG_FONT, F("Pixel buffer is %d bytes"), _lv_mem_get_size(charBitmap_p)); current_bitmap_size = size;
LOG_WARNING(TAG_FONT, F("Pixel buffer is %d bytes"), current_bitmap_size);
} }
if(charBitmap_p != NULL) { if(charBitmap_p != NULL) {

View File

@ -63,7 +63,7 @@ typedef struct
uint8_t Fontdataadd8byte; uint8_t Fontdataadd8byte;
uint16_t reserved1; // Reserved 1 uint16_t reserved1; // Reserved 1
uint32_t Actualnumchars; uint32_t Actualnumchars;
uint32_t * reserved3; // Reserved 3 uint32_t* reserved3; // Reserved 3
} zi_font_header_t; } zi_font_header_t;
typedef struct typedef struct
@ -77,15 +77,15 @@ typedef struct
uint32_t Startdataaddress; uint32_t Startdataaddress;
uint8_t Fontdataadd8byte; uint8_t Fontdataadd8byte;
uint16_t last_glyph_id; uint16_t last_glyph_id;
lv_zifont_char_t * last_glyph_dsc; lv_zifont_char_t* last_glyph_dsc;
lv_zifont_char_t * ascii_glyph_dsc; lv_zifont_char_t* ascii_glyph_dsc;
} lv_font_fmt_zifont_dsc_t; } lv_font_fmt_zifont_dsc_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
int lv_zifont_init(void); int lv_zifont_init(void);
int lv_zifont_font_init(lv_font_t ** font, const char * font_path, uint16_t size); int lv_zifont_font_init(lv_font_t** font, const char* font_path, uint16_t size);
/********************** /**********************
* MACROS * MACROS

View File

@ -59,8 +59,8 @@ build_flags =
; -- Hasp build options ---------------------------- ; -- Hasp build options ----------------------------
-D HASP_VER_MAJ=0 -D HASP_VER_MAJ=0
-D HASP_VER_MIN=6 -D HASP_VER_MIN=7
-D HASP_VER_REV=1 -D HASP_VER_REV=0-dev ; 0 or 0-dev
${override.build_flags} ${override.build_flags}
; -- Shared library dependencies in all environments ; -- Shared library dependencies in all environments
@ -74,7 +74,7 @@ lib_deps =
;git+https://github.com/andrethomas/TasmotaSlave.git ;git+https://github.com/andrethomas/TasmotaSlave.git
;git+https://github.com/lvgl/lvgl.git ;git+https://github.com/lvgl/lvgl.git
;Needed for touch rotation: ;Needed for touch rotation:
git+https://github.com/fvanroie/lvgl.git#release/v7 git+https://github.com/lvgl/lvgl.git
;git+https://github.com/lvgl/lvgl.git#797212a3f346e9fdf71aef6f193889357eeae3f0 ;git+https://github.com/lvgl/lvgl.git#797212a3f346e9fdf71aef6f193889357eeae3f0
;git+https://github.com/lvgl/lvgl.git#60ddd13465e4182893d748ae3cc3f69801768e8a ;git+https://github.com/lvgl/lvgl.git#60ddd13465e4182893d748ae3cc3f69801768e8a
;lvgl/lvgl@^7.11.0 ; from PIO library ;lvgl/lvgl@^7.11.0 ; from PIO library
@ -136,7 +136,7 @@ build_flags =
;-D HASP_USE_EEPROM=1 ;-D HASP_USE_EEPROM=1
-D HASP_USE_CONFIG=1 ; Native application, not library -D HASP_USE_CONFIG=1 ; Native application, not library
-D LV_LOG_TRACE_TIMER=1 -D LV_LOG_TRACE_TIMER=1
-D HASP_USE_PNGDECODE=1 -D HASP_USE_PNGDECODE=0
; -- LittleFS build options ------------------------ ; -- LittleFS build options ------------------------
;-D CONFIG_LITTLEFS_FOR_IDF_3_2 ; obsolete in IDF 3.3 ;-D CONFIG_LITTLEFS_FOR_IDF_3_2 ; obsolete in IDF 3.3
@ -154,7 +154,7 @@ lib_ignore =
lib_deps = lib_deps =
ESP Async WebServer ESP Async WebServer
LittleFS_esp32 LittleFS_esp32
git+https://github.com/lvgl/lv_lib_png.git#release/v7 git+https://github.com/lvgl/lv_lib_png.git
ps_ram = ps_ram =
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM

View File

@ -1,7 +1,7 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie /* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */ For full license information read the LICENSE file in the project folder */
#include "hasplib.h" //#include "hasplib.h"
#if HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code #if HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code
@ -26,7 +26,7 @@ void custom_every_second()
void custom_every_5seconds() void custom_every_5seconds()
{ {
Log.verbose(TAG_CUSTOM, "5 seconds have passsed..."); Log.verbose(TAG_CUSTOM, "5 seconds have passsed...");
dispatch_state_subtopic("my_sensor","{\"test\":123}"); dispatch_state_subtopic("my_sensor", "{\"test\":123}");
} }
bool custom_pin_in_use(uint pin) bool custom_pin_in_use(uint pin)

View File

@ -9,7 +9,7 @@
#if TOUCH_DRIVER == 2046 #if TOUCH_DRIVER == 2046
#if defined(USE_FSMC) #if defined(USE_FSMC)
#else #else
#include "drv/old/hasp_drv_tft_espi.h" // #include "drv/old/hasp_drv_tft_espi.h"
#endif #endif
#elif TOUCH_DRIVER == 2046 #elif TOUCH_DRIVER == 2046
@ -63,7 +63,7 @@ void drv_touch_init(uint8_t rotation)
#endif #endif
#elif TOUCH_DRIVER == 911 #elif TOUCH_DRIVER == 911
// GT911_init(); // GT911_init();
#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller #elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
// Touch_init(); // Touch_init();
@ -93,10 +93,10 @@ static inline bool drv_touchpad_getXY(int16_t* touchX, int16_t* touchY)
touched = haspTft.tft.getTouch((uint16_t*)&normal_x, (uint16_t*)&normal_y, 300); touched = haspTft.tft.getTouch((uint16_t*)&normal_x, (uint16_t*)&normal_y, 300);
#elif TOUCH_DRIVER == 0x2046B #elif TOUCH_DRIVER == 0x2046B
touched = XPT2046_getXY(&normal_x, &normal_y, true); touched = XPT2046_getXY(&normal_x, &normal_y, true);
#elif TOUCH_DRIVER == 911 #elif TOUCH_DRIVER == 911
// touched = GT911_getXY(&normal_x, &normal_y, true); // touched = GT911_getXY(&normal_x, &normal_y, true);
#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller #elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
touched = Touch_getXY(&normal_x, &normal_y, false); touched = Touch_getXY(&normal_x, &normal_y, false);
@ -192,13 +192,13 @@ IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* dat
if(hasp_sleep_state /* != HASP_SLEEP_OFF */) hasp_update_sleep_state(); // update Idle if(hasp_sleep_state /* != HASP_SLEEP_OFF */) hasp_update_sleep_state(); // update Idle
if(touch_invert_x) { if(touch_invert_x) {
data->point.x = indev_driver->disp->driver.hor_res - touchX; data->point.x = indev_driver->disp->driver->hor_res - touchX;
} else { } else {
data->point.x = touchX; data->point.x = touchX;
} }
if(touch_invert_y) { if(touch_invert_y) {
data->point.y = indev_driver->disp->driver.ver_res - touchY; data->point.y = indev_driver->disp->driver->ver_res - touchY;
} else { } else {
data->point.y = touchY; data->point.y = touchY;
} }
@ -221,6 +221,6 @@ IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* dat
IRAM_ATTR void drv_touch_loop() IRAM_ATTR void drv_touch_loop()
{ {
#if TOUCH_DRIVER == 911 #if TOUCH_DRIVER == 911
// GT911_loop(); // GT911_loop();
#endif #endif
} }

View File

@ -25,10 +25,8 @@ class BaseTouch {
{} {}
void set_invert(bool invert_display) void set_invert(bool invert_display)
{} {}
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR void read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {}
return false;
}
void calibrate(uint16_t* calData) void calibrate(uint16_t* calData)
{} {}
bool is_driver_pin(uint8_t) bool is_driver_pin(uint8_t)

View File

@ -33,7 +33,7 @@ HASP_ATTRIBUTE_FAST_MEM bool FT6336U_getXY(int16_t* touchX, int16_t* touchY)
} }
} }
IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {
if(ft6336u_touch->read_touch_number() == 1) { if(ft6336u_touch->read_touch_number() == 1) {

View File

@ -37,12 +37,12 @@ IRAM_ATTR void GT911_setXY(int8_t contacts, GTPoint* points)
// } // }
} }
IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {
// LOG_VERBOSE(TAG_GUI, F("Contacts: %d"), GT911_num_touches); // LOG_VERBOSE(TAG_GUI, F("Contacts: %d"), GT911_num_touches);
static GTPoint points[5]; static GTPoint points[5];
if(touch.readInput((uint8_t*)&points)>0) { if(touch.readInput((uint8_t*)&points) > 0) {
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
@ -51,7 +51,7 @@ IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
data->state = LV_INDEV_STATE_PR; data->state = LV_INDEV_STATE_PR;
} else { } else {
data->state = LV_INDEV_STATE_REL; data->state = LV_INDEV_STATE_REL;
} }
touch.loop(); // reset IRQ touch.loop(); // reset IRQ

View File

@ -25,7 +25,7 @@ extern uint8_t hasp_sleep_state;
static Adafruit_STMPE610 stmpe610_touchpanel = Adafruit_STMPE610(TOUCH_CS); static Adafruit_STMPE610 stmpe610_touchpanel = Adafruit_STMPE610(TOUCH_CS);
bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {
data->state = LV_INDEV_STATE_REL; data->state = LV_INDEV_STATE_REL;
@ -33,7 +33,7 @@ bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
while(data->state == LV_INDEV_STATE_REL && stmpe610_touchpanel.touched()) { while(data->state == LV_INDEV_STATE_REL && stmpe610_touchpanel.touched()) {
TS_Point point = stmpe610_touchpanel.getPoint(); TS_Point point = stmpe610_touchpanel.getPoint();
Log.trace(TAG_DRVR, F("STMPE610: x=%i y=%i z=%i"), point.x, point.y, point.z); // Log.trace(TAG_DRVR, F("STMPE610: x=%i y=%i z=%i"), point.x, point.y, point.z);
if(point.z && point.x < 4096 && point.y < 4096) { // valid reading if(point.z && point.x < 4096 && point.y < 4096) { // valid reading
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
@ -48,9 +48,6 @@ bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
#endif #endif
} }
} }
/*Return `false` because we are not buffering and no more data to read*/
return false;
} }
namespace dev { namespace dev {
@ -58,9 +55,9 @@ namespace dev {
class TouchStmpe610 : public BaseTouch { class TouchStmpe610 : public BaseTouch {
public: public:
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR void read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {
return touch_read(indev_driver, data); touch_read(indev_driver, data);
} }
void init(int w, int h) void init(int w, int h)

View File

@ -14,7 +14,7 @@
#include "../../hasp/hasp.h" // for hasp_sleep_state #include "../../hasp/hasp.h" // for hasp_sleep_state
extern uint8_t hasp_sleep_state; extern uint8_t hasp_sleep_state;
IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {
if(haspTft.tft.getTouch((uint16_t*)&data->point.x, (uint16_t*)&data->point.y, 300)) { if(haspTft.tft.getTouch((uint16_t*)&data->point.x, (uint16_t*)&data->point.y, 300)) {
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
@ -23,9 +23,6 @@ IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
} else { } else {
data->state = LV_INDEV_STATE_REL; data->state = LV_INDEV_STATE_REL;
} }
/*Return `false` because we are not buffering and no more data to read*/
return false;
} }
namespace dev { namespace dev {

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 12 px * Size: 12 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 14 px * Size: 14 px
* Bpp: 3 * Bpp: 3
@ -1839,7 +1840,7 @@ lv_font_t robotocondensed_regular_14_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 16 px * Size: 16 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 20 px * Size: 20 px
* Bpp: 3 * Bpp: 3
@ -2421,7 +2422,7 @@ lv_font_t robotocondensed_regular_20_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 22 px * Size: 22 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 24 px * Size: 24 px
* Bpp: 3 * Bpp: 3
@ -2745,7 +2746,7 @@ lv_font_t robotocondensed_regular_24_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 26 px * Size: 26 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 28 px * Size: 28 px
* Bpp: 3 * Bpp: 3
@ -3366,7 +3367,7 @@ lv_font_t robotocondensed_regular_28_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 32 px * Size: 32 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 36 px * Size: 36 px
* Bpp: 3 * Bpp: 3
@ -4416,7 +4417,7 @@ lv_font_t robotocondensed_regular_36_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 38 px * Size: 38 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 40 px * Size: 40 px
* Bpp: 3 * Bpp: 3
@ -4942,7 +4943,7 @@ lv_font_t robotocondensed_regular_40_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 44 px * Size: 44 px
* Bpp: 3 * Bpp: 3
@ -5465,7 +5466,7 @@ lv_font_t robotocondensed_regular_44_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 48 px * Size: 48 px
* Bpp: 3 * Bpp: 3
@ -5791,7 +5792,7 @@ lv_font_t robotocondensed_regular_48_ascii = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -4, .underline_position = -4,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 12 px * Size: 12 px
* Bpp: 3 * Bpp: 3
@ -2202,7 +2203,7 @@ lv_font_t robotocondensed_regular_12_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 14 px * Size: 14 px
* Bpp: 3 * Bpp: 3
@ -2462,7 +2463,7 @@ lv_font_t robotocondensed_regular_14_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 16 px * Size: 16 px
* Bpp: 3 * Bpp: 3
@ -2675,7 +2676,7 @@ lv_font_t robotocondensed_regular_16_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 20 px * Size: 20 px
* Bpp: 3 * Bpp: 3
@ -3213,7 +3214,7 @@ lv_font_t robotocondensed_regular_20_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 22 px * Size: 22 px
* Bpp: 3 * Bpp: 3
@ -3507,7 +3508,7 @@ lv_font_t robotocondensed_regular_22_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 24 px * Size: 24 px
* Bpp: 3 * Bpp: 3
@ -3639,7 +3640,7 @@ lv_font_t robotocondensed_regular_24_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 26 px * Size: 26 px
* Bpp: 3 * Bpp: 3
@ -4068,7 +4069,7 @@ lv_font_t robotocondensed_regular_26_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 28 px * Size: 28 px
* Bpp: 3 * Bpp: 3
@ -4418,7 +4419,7 @@ lv_font_t robotocondensed_regular_28_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 32 px * Size: 32 px
* Bpp: 3 * Bpp: 3
@ -5046,7 +5047,7 @@ lv_font_t robotocondensed_regular_32_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 36 px * Size: 36 px
* Bpp: 3 * Bpp: 3
@ -5822,7 +5823,7 @@ lv_font_t robotocondensed_regular_36_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 38 px * Size: 38 px
* Bpp: 3 * Bpp: 3
@ -6159,7 +6160,7 @@ lv_font_t robotocondensed_regular_38_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 40 px * Size: 40 px
* Bpp: 3 * Bpp: 3
@ -6514,7 +6515,7 @@ lv_font_t robotocondensed_regular_40_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 44 px * Size: 44 px
* Bpp: 3 * Bpp: 3
@ -7216,7 +7217,7 @@ lv_font_t robotocondensed_regular_44_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 48 px * Size: 48 px
* Bpp: 3 * Bpp: 3
@ -7701,7 +7702,7 @@ lv_font_t robotocondensed_regular_48_cyrillic = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -4, .underline_position = -4,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 12 px * Size: 12 px
* Bpp: 3 * Bpp: 3
@ -2058,7 +2059,7 @@ lv_font_t robotocondensed_regular_12_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 14 px * Size: 14 px
* Bpp: 3 * Bpp: 3
@ -2310,7 +2311,7 @@ lv_font_t robotocondensed_regular_14_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 16 px * Size: 16 px
* Bpp: 3 * Bpp: 3
@ -2506,7 +2507,7 @@ lv_font_t robotocondensed_regular_16_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 20 px * Size: 20 px
* Bpp: 3 * Bpp: 3
@ -3018,7 +3019,7 @@ lv_font_t robotocondensed_regular_20_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 22 px * Size: 22 px
* Bpp: 3 * Bpp: 3
@ -3299,7 +3300,7 @@ lv_font_t robotocondensed_regular_22_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 24 px * Size: 24 px
* Bpp: 3 * Bpp: 3
@ -3442,7 +3443,7 @@ lv_font_t robotocondensed_regular_24_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 26 px * Size: 26 px
* Bpp: 3 * Bpp: 3
@ -3854,7 +3855,7 @@ lv_font_t robotocondensed_regular_26_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 28 px * Size: 28 px
* Bpp: 3 * Bpp: 3
@ -4186,7 +4187,7 @@ lv_font_t robotocondensed_regular_28_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 32 px * Size: 32 px
* Bpp: 3 * Bpp: 3
@ -4789,7 +4790,7 @@ lv_font_t robotocondensed_regular_32_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 36 px * Size: 36 px
* Bpp: 3 * Bpp: 3
@ -5536,7 +5537,7 @@ lv_font_t robotocondensed_regular_36_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 38 px * Size: 38 px
* Bpp: 3 * Bpp: 3
@ -5868,7 +5869,7 @@ lv_font_t robotocondensed_regular_38_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 40 px * Size: 40 px
* Bpp: 3 * Bpp: 3
@ -6203,7 +6204,7 @@ lv_font_t robotocondensed_regular_40_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 44 px * Size: 44 px
* Bpp: 3 * Bpp: 3
@ -6867,7 +6868,7 @@ lv_font_t robotocondensed_regular_44_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 48 px * Size: 48 px
* Bpp: 3 * Bpp: 3
@ -7331,7 +7332,7 @@ lv_font_t robotocondensed_regular_48_greek = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -4, .underline_position = -4,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -11,7 +11,11 @@
#include <stdbool.h> #include <stdbool.h>
#include "lvgl.h" #include "lvgl.h"
#if LV_VERSION_CHECK(8, 0, 0)
#include "misc/lv_fs.h"
#else
#include "lv_misc/lv_fs.h" #include "lv_misc/lv_fs.h"
#endif
#include "hasp_font_loader.h" #include "hasp_font_loader.h"
#include "hasplib.h" #include "hasplib.h"

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 12 px * Size: 12 px
* Bpp: 3 * Bpp: 3
@ -2123,7 +2124,7 @@ lv_font_t robotocondensed_regular_12_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 14 px * Size: 14 px
* Bpp: 3 * Bpp: 3
@ -2374,7 +2375,7 @@ lv_font_t robotocondensed_regular_14_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 16 px * Size: 16 px
* Bpp: 3 * Bpp: 3
@ -2575,7 +2576,7 @@ lv_font_t robotocondensed_regular_16_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 20 px * Size: 20 px
* Bpp: 3 * Bpp: 3

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 22 px * Size: 22 px
* Bpp: 3 * Bpp: 3
@ -3410,7 +3411,7 @@ lv_font_t robotocondensed_regular_22_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 24 px * Size: 24 px
* Bpp: 3 * Bpp: 3
@ -3566,7 +3567,7 @@ lv_font_t robotocondensed_regular_24_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 26 px * Size: 26 px
* Bpp: 3 * Bpp: 3
@ -3991,11 +3992,12 @@ lv_font_t robotocondensed_regular_26_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ .dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
.user_data = NULL
}; };

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 28 px * Size: 28 px
* Bpp: 3 * Bpp: 3
@ -4348,7 +4349,7 @@ lv_font_t robotocondensed_regular_28_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 32 px * Size: 32 px
* Bpp: 3 * Bpp: 3
@ -4969,7 +4970,7 @@ lv_font_t robotocondensed_regular_32_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 36 px * Size: 36 px
* Bpp: 3 * Bpp: 3
@ -5753,7 +5754,7 @@ lv_font_t robotocondensed_regular_36_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 38 px * Size: 38 px
* Bpp: 3 * Bpp: 3
@ -6098,7 +6099,7 @@ lv_font_t robotocondensed_regular_38_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 40 px * Size: 40 px
* Bpp: 3 * Bpp: 3
@ -6461,7 +6462,7 @@ lv_font_t robotocondensed_regular_40_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 44 px * Size: 44 px
* Bpp: 3 * Bpp: 3
@ -7153,7 +7154,7 @@ lv_font_t robotocondensed_regular_44_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 48 px * Size: 48 px
* Bpp: 3 * Bpp: 3
@ -7652,7 +7653,7 @@ lv_font_t robotocondensed_regular_48_latin1 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -4, .underline_position = -4,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 12 px * Size: 12 px
* Bpp: 3 * Bpp: 3
@ -2321,7 +2322,7 @@ lv_font_t robotocondensed_regular_12_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 14 px * Size: 14 px
* Bpp: 3 * Bpp: 3
@ -2590,7 +2591,7 @@ lv_font_t robotocondensed_regular_14_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 16 px * Size: 16 px
* Bpp: 3 * Bpp: 3
@ -2792,7 +2793,7 @@ lv_font_t robotocondensed_regular_16_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 20 px * Size: 20 px
* Bpp: 3 * Bpp: 3
@ -3388,7 +3389,7 @@ lv_font_t robotocondensed_regular_20_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -1, .underline_position = -1,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 22 px * Size: 22 px
* Bpp: 3 * Bpp: 3
@ -3689,7 +3690,7 @@ lv_font_t robotocondensed_regular_22_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 24 px * Size: 24 px
* Bpp: 3 * Bpp: 3
@ -3879,7 +3880,7 @@ lv_font_t robotocondensed_regular_24_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 26 px * Size: 26 px
* Bpp: 3 * Bpp: 3
@ -4322,7 +4323,7 @@ lv_font_t robotocondensed_regular_26_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 28 px * Size: 28 px
* Bpp: 3 * Bpp: 3
@ -4710,7 +4711,7 @@ lv_font_t robotocondensed_regular_28_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 1, .underline_thickness = 1,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 32 px * Size: 32 px
* Bpp: 3 * Bpp: 3
@ -5391,7 +5392,7 @@ lv_font_t robotocondensed_regular_32_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -2, .underline_position = -2,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 36 px * Size: 36 px
* Bpp: 3 * Bpp: 3
@ -6252,7 +6253,7 @@ lv_font_t robotocondensed_regular_36_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 38 px * Size: 38 px
* Bpp: 3 * Bpp: 3
@ -6622,7 +6623,7 @@ lv_font_t robotocondensed_regular_38_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 40 px * Size: 40 px
* Bpp: 3 * Bpp: 3
@ -7016,7 +7017,7 @@ lv_font_t robotocondensed_regular_40_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 44 px * Size: 44 px
* Bpp: 3 * Bpp: 3
@ -7754,7 +7755,7 @@ lv_font_t robotocondensed_regular_44_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -3, .underline_position = -3,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -1,4 +1,5 @@
/* clang-format off */ /* clang-format off */
/* clang-format off */
/******************************************************************************* /*******************************************************************************
* Size: 48 px * Size: 48 px
* Bpp: 3 * Bpp: 3
@ -8315,7 +8316,7 @@ lv_font_t robotocondensed_regular_48_latin2 = {
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,
#endif #endif
#if LV_VERSION_CHECK(7, 4, 0) #if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)
.underline_position = -4, .underline_position = -4,
.underline_thickness = 2, .underline_thickness = 2,
#endif #endif

View File

@ -85,13 +85,13 @@ lv_style_t style_mbox_bg; /*Black bg. style with opacity*/
lv_obj_t* kb; lv_obj_t* kb;
// lv_font_t * defaultFont; // lv_font_t * defaultFont;
static lv_font_t* haspFonts[12] = {nullptr}; static const lv_font_t* haspFonts[12] = {nullptr};
uint8_t current_page = 1; uint8_t current_page = 1;
/** /**
* Get Font ID * Get Font ID
*/ */
lv_font_t* hasp_get_font(uint8_t fontid) const lv_font_t* hasp_get_font(uint8_t fontid)
{ {
if(fontid >= sizeof(haspFonts) / sizeof(haspFonts[0])) { if(fontid >= sizeof(haspFonts) / sizeof(haspFonts[0])) {
return nullptr; return nullptr;
@ -230,16 +230,18 @@ void haspReconnect()
// Shows/hides the the global progress bar and updates the value // Shows/hides the the global progress bar and updates the value
void haspProgressVal(uint8_t val) void haspProgressVal(uint8_t val)
{ {
return;
lv_obj_t* layer = lv_disp_get_layer_sys(NULL); lv_obj_t* layer = lv_disp_get_layer_sys(NULL);
lv_obj_t* bar = hasp_find_obj_from_page_id(255U, 10U); lv_obj_t* bar = hasp_find_obj_from_page_id(255U, 10U);
if(layer && bar) { if(layer && bar) {
if(val == 255) { if(val == 255) {
if(!lv_obj_get_hidden(bar)) { if(!lv_obj_get_hidden(bar)) {
lv_obj_set_hidden(bar, true); lv_obj_set_hidden(bar, true);
lv_obj_set_style_local_bg_opa(layer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); lv_obj_set_style_bg_opa(layer, LV_PART_MAIN | LV_STATE_DEFAULT, LV_OPA_0);
// lv_obj_set_style_local_value_str(bar, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, ""); // lv_obj_set_style_value_str(bar, LV_PART_MAIN| LV_STATE_DEFAULT, "");
// lv_obj_set_value_str_txt(bar, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, NULL); // lv_obj_set_value_str_txt(bar, LV_PART_MAIN| LV_STATE_DEFAULT, NULL);
// TODO: call our custom function to free the memory // TODO: call our custom function to free the memory
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
@ -249,7 +251,7 @@ void haspProgressVal(uint8_t val)
} else { } else {
if(lv_obj_get_hidden(bar)) { if(lv_obj_get_hidden(bar)) {
lv_obj_set_hidden(bar, false); lv_obj_set_hidden(bar, false);
lv_obj_set_style_local_bg_opa(layer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); lv_obj_set_style_bg_opa(layer, LV_PART_MAIN | LV_STATE_DEFAULT, LV_OPA_100);
} }
lv_bar_set_value(bar, val, LV_ANIM_OFF); lv_bar_set_value(bar, val, LV_ANIM_OFF);
} }
@ -263,7 +265,7 @@ void haspProgressMsg(const char* msg)
if(lv_obj_t* bar = hasp_find_obj_from_page_id(255U, 10U)) { if(lv_obj_t* bar = hasp_find_obj_from_page_id(255U, 10U)) {
char value_str[10]; char value_str[10];
snprintf_P(value_str, sizeof(value_str), PSTR("value_str")); snprintf_P(value_str, sizeof(value_str), PSTR("value_str"));
hasp_process_obj_attribute(bar, value_str, msg, true); // hasp_process_obj_attribute(bar, value_str, msg, true);
} }
lv_task_handler(); // needed to let the GUI do its work during long updates lv_task_handler(); // needed to let the GUI do its work during long updates
@ -271,7 +273,7 @@ void haspProgressMsg(const char* msg)
/* if(bar) { /* if(bar) {
progress_str.reserve(64); progress_str.reserve(64);
progress_str = msg; progress_str = msg;
lv_obj_set_style_local_value_str(bar, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, progress_str.c_str()); lv_obj_set_style_value_str(bar, LV_PART_MAIN| LV_STATE_DEFAULT, progress_str.c_str());
// lv_task_handler(); // let the GUI do its work // lv_task_handler(); // let the GUI do its work
} */ } */
@ -286,23 +288,24 @@ void haspProgressMsg(const __FlashStringHelper* msg)
#endif #endif
/*Add a custom apply callback*/ /*Add a custom apply callback*/
static void custom_font_apply_cb(lv_theme_t* th, lv_obj_t* obj, lv_theme_style_t name) // static void custom_font_apply_cb(lv_theme_t* th, lv_obj_t* obj, lv_theme_style_t name)
{ // {
/* lv_style_list_t* list; // /* lv_style_list_t* list;
switch(name) { // switch(name) {
case LV_THEME_BTN: // case LV_THEME_BTN:
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); // list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
// _lv_style_list_add_style(list, &my_style); // // _lv_style_list_add_style(list, &my_style);
break; // break;
default: // default:
// nothing // // nothing
; // ;
} */ // } */
} // }
void hasp_set_theme(uint8_t themeid) void hasp_set_theme(uint8_t themeid)
{ {
lv_disp_t* disp = lv_disp_get_default();
lv_theme_t* th = NULL; lv_theme_t* th = NULL;
lv_color_t color_primary = lv_color_hsv_to_rgb(haspThemeHue, 100, 100); lv_color_t color_primary = lv_color_hsv_to_rgb(haspThemeHue, 100, 100);
lv_color_t color_secondary = lv_color_hsv_to_rgb(haspThemeHue, 100, 100); lv_color_t color_secondary = lv_color_hsv_to_rgb(haspThemeHue, 100, 100);
@ -322,6 +325,12 @@ void hasp_set_theme(uint8_t themeid)
uint32_t material_flags = LV_THEME_MATERIAL_FLAG_LIGHT + LV_THEME_MATERIAL_FLAG_NO_TRANSITION; uint32_t material_flags = LV_THEME_MATERIAL_FLAG_LIGHT + LV_THEME_MATERIAL_FLAG_NO_TRANSITION;
#endif #endif
#if(LV_USE_THEME_DEFAULT == 1)
// LV_THEME_MATERIAL_FLAG_NO_TRANSITION : disable transitions(state change animations)
// LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
uint32_t material_flags = LV_THEME_DEFAULT_DARK;
#endif
switch(themeid) { switch(themeid) {
#if(LV_USE_THEME_EMPTY == 1) #if(LV_USE_THEME_EMPTY == 1)
case 0: case 0:
@ -343,8 +352,7 @@ void hasp_set_theme(uint8_t themeid)
#if(LV_USE_THEME_MONO == 1) #if(LV_USE_THEME_MONO == 1)
case 3: case 3:
th = lv_theme_mono_init(color_primary, color_secondary, LV_THEME_DEFAULT_FLAGS, haspFonts[0], haspFonts[1], th = lv_theme_mono_init(disp, true, haspFonts[0]);
haspFonts[2], haspFonts[3]);
break; break;
#endif #endif
@ -359,6 +367,15 @@ void hasp_set_theme(uint8_t themeid)
break; break;
#endif #endif
#if LV_USE_THEME_DEFAULT == 1
case 5: // Dark
// material_flags = LV_THEME_DEFAULT_FLAG_DARK;
case 4: // Light
case 9: // Light (old id)
th = lv_theme_default_init(disp, color_primary, color_secondary, false, haspFonts[1]);
break;
#endif
#if LV_USE_THEME_TEMPLATE == 1 #if LV_USE_THEME_TEMPLATE == 1
case 7: case 7:
th = lv_theme_template_init(LV_COLOR_PURPLE, LV_COLOR_ORANGE, LV_THEME_DEFAULT_FLAGS, haspFonts[0], th = lv_theme_template_init(LV_COLOR_PURPLE, LV_COLOR_ORANGE, LV_THEME_DEFAULT_FLAGS, haspFonts[0],
@ -372,7 +389,8 @@ void hasp_set_theme(uint8_t themeid)
} }
if(th) { if(th) {
lv_theme_set_act(th); // lv_theme_set_act(th);
lv_disp_set_theme(disp, th); /*Assign the theme to the display*/
LOG_INFO(TAG_HASP, F("Custom theme loaded")); LOG_INFO(TAG_HASP, F("Custom theme loaded"));
} else { } else {
LOG_ERROR(TAG_HASP, F("Theme could not be loaded")); LOG_ERROR(TAG_HASP, F("Theme could not be loaded"));

View File

@ -61,7 +61,7 @@ bool haspGetConfig(const JsonObject& settings);
bool haspSetConfig(const JsonObject& settings); bool haspSetConfig(const JsonObject& settings);
#endif #endif
lv_font_t* hasp_get_font(uint8_t fontid); const lv_font_t* hasp_get_font(uint8_t fontid);
HASP_ATTRIBUTE_FAST_MEM void hasp_update_sleep_state(); HASP_ATTRIBUTE_FAST_MEM void hasp_update_sleep_state();
void hasp_get_sleep_state(char* payload); void hasp_get_sleep_state(char* payload);

View File

@ -8,6 +8,8 @@
#include "hasplib.h" #include "hasplib.h"
#include "hasp_attribute_helper.h" #include "hasp_attribute_helper.h"
#if LVGL_VERSION_MAJOR == 7
LV_FONT_DECLARE(unscii_8_icon); LV_FONT_DECLARE(unscii_8_icon);
extern const char** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map extern const char** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map
@ -258,7 +260,7 @@ static void hasp_attribute_get_part_state(lv_obj_t* obj, const char* attr_in, ch
int len = strlen(attr_in); int len = strlen(attr_in);
if(len <= 0 || len >= 32) { if(len <= 0 || len >= 32) {
attr_out[0] = 0; // empty string attr_out[0] = 0; // empty string
part = LV_OBJ_PART_MAIN; part = LV_PART_MAIN;
state = LV_STATE_DEFAULT; state = LV_STATE_DEFAULT;
return; return;
} }
@ -328,7 +330,7 @@ static void hasp_attribute_get_part_state(lv_obj_t* obj, const char* attr_in, ch
break; break;
case LV_HASP_CPICKER: case LV_HASP_CPICKER:
part = index == 1 ? LV_CPICKER_PART_KNOB : LV_CPICKER_PART_MAIN; part = index == 1 ? lv_colorwheel_PART_KNOB : lv_colorwheel_PART_MAIN;
break; break;
case LV_HASP_ROLLER: case LV_HASP_ROLLER:
@ -357,7 +359,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
const char* payload, bool update, int32_t& val) const char* payload, bool update, int32_t& val)
{ {
char attr[32]; char attr[32];
uint8_t part = LV_OBJ_PART_MAIN; uint8_t part = LV_PART_MAIN;
uint8_t state = LV_STATE_DEFAULT; uint8_t state = LV_STATE_DEFAULT;
int16_t var = atoi(payload); int16_t var = atoi(payload);
@ -377,19 +379,19 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
case ATTR_BG_BLEND_MODE: case ATTR_BG_BLEND_MODE:
return attribute_bg_blend_mode(obj, part, state, update, (lv_blend_mode_t)var, val); return attribute_bg_blend_mode(obj, part, state, update, (lv_blend_mode_t)var, val);
// case ATTR_TEXT_BLEND_MODE: // case ATTR_TEXT_BLEND_MODE:
// return lv_obj_set_style_local_text_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_text_blend_mode(obj, part, state, (lv_blend_mode_t)var);
// case ATTR_BORDER_BLEND_MODE: // case ATTR_BORDER_BLEND_MODE:
// return lv_obj_set_style_local_border_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_border_blend_mode(obj, part, state, (lv_blend_mode_t)var);
// case ATTR_OUTLINE_BLEND_MODE: // case ATTR_OUTLINE_BLEND_MODE:
// return lv_obj_set_style_local_outline_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_outline_blend_mode(obj, part, state, (lv_blend_mode_t)var);
// case ATTR_SHADOW_BLEND_MODE: // case ATTR_SHADOW_BLEND_MODE:
// return lv_obj_set_style_local_shadow_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_shadow_blend_mode(obj, part, state, (lv_blend_mode_t)var);
// case ATTR_LINE_BLEND_MODE: // case ATTR_LINE_BLEND_MODE:
// return lv_obj_set_style_local_line_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_line_blend_mode(obj, part, state, (lv_blend_mode_t)var);
// case ATTR_VALUE_BLEND_MODE: // case ATTR_VALUE_BLEND_MODE:
// return lv_obj_set_style_local_value_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_value_blend_mode(obj, part, state, (lv_blend_mode_t)var);
// case ATTR_PATTERN_BLEND_MODE: // case ATTR_PATTERN_BLEND_MODE:
// return lv_obj_set_style_local_pattern_blend_mode(obj, part, state, (lv_blend_mode_t)var); // return lv_obj_set_style_pattern_blend_mode(obj, part, state, (lv_blend_mode_t)var);
#endif #endif
case ATTR_SIZE: case ATTR_SIZE:
@ -417,7 +419,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c) && part != 64) if(Parser::haspPayloadToColor(payload, c) && part != 64)
lv_obj_set_style_local_bg_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); lv_obj_set_style_bg_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_bg_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_bg_color(obj, part));
} }
@ -427,8 +429,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_bg_grad_color(obj, part, state, lv_obj_set_style_bg_grad_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_bg_grad_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_bg_grad_color(obj, part));
} }
@ -466,8 +467,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c) && part != 64) if(Parser::haspPayloadToColor(payload, c) && part != 64)
lv_obj_set_style_local_scale_grad_color(obj, part, state, lv_obj_set_style_scale_grad_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_scale_grad_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_scale_grad_color(obj, part));
} }
@ -477,8 +477,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_scale_end_color(obj, part, state, lv_obj_set_style_scale_end_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_scale_end_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_scale_end_color(obj, part));
} }
@ -505,7 +504,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_text_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); lv_obj_set_style_text_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_text_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_text_color(obj, part));
} }
@ -515,8 +514,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_text_sel_color(obj, part, state, lv_obj_set_style_text_sel_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_text_sel_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_text_sel_color(obj, part));
} }
@ -528,14 +526,14 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, *font); LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, *font);
uint8_t count = 3; uint8_t count = 3;
if(obj_check_type(obj, LV_HASP_ROLLER)) count = my_roller_get_visible_row_count(obj); if(obj_check_type(obj, LV_HASP_ROLLER)) count = my_roller_get_visible_row_count(obj);
lv_obj_set_style_local_text_font(obj, part, state, font); lv_obj_set_style_text_font(obj, part, state, font);
if(obj_check_type(obj, LV_HASP_ROLLER)) lv_roller_set_visible_row_count(obj, count); if(obj_check_type(obj, LV_HASP_ROLLER)) lv_roller_set_visible_row_count(obj, count);
lv_obj_set_style_local_text_font(obj, part, state, font); // again, for roller lv_obj_set_style_text_font(obj, part, state, font); // again, for roller
if(obj_check_type(obj, LV_HASP_DROPDOWN)) { // issue #43 if(obj_check_type(obj, LV_HASP_DROPDOWN)) { // issue #43
lv_obj_set_style_local_text_font(obj, LV_DROPDOWN_PART_MAIN, state, font); lv_obj_set_style_text_font(obj, LV_DROPDOWN_PART_MAIN, state, font);
lv_obj_set_style_local_text_font(obj, LV_DROPDOWN_PART_LIST, state, font); lv_obj_set_style_text_font(obj, LV_DROPDOWN_PART_LIST, state, font);
lv_obj_set_style_local_text_font(obj, LV_DROPDOWN_PART_SELECTED, state, font); lv_obj_set_style_text_font(obj, LV_DROPDOWN_PART_SELECTED, state, font);
}; };
} else { } else {
@ -558,8 +556,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_border_color(obj, part, state, lv_obj_set_style_border_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_border_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_border_color(obj, part));
} }
@ -577,8 +574,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_outline_color(obj, part, state, lv_obj_set_style_outline_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_outline_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_outline_color(obj, part));
} }
@ -601,8 +597,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_shadow_color(obj, part, state, lv_obj_set_style_shadow_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_shadow_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_shadow_color(obj, part));
} }
@ -626,7 +621,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_line_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); lv_obj_set_style_line_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_line_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_line_color(obj, part));
} }
@ -658,8 +653,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_value_color(obj, part, state, lv_obj_set_style_value_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_value_color(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_value_color(obj, part));
} }
@ -668,7 +662,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
case ATTR_VALUE_FONT: { case ATTR_VALUE_FONT: {
lv_font_t* font = haspPayloadToFont(payload); lv_font_t* font = haspPayloadToFont(payload);
if(font) { if(font) {
lv_obj_set_style_local_value_font(obj, part, state, font); lv_obj_set_style_value_font(obj, part, state, font);
} else { } else {
LOG_WARNING(TAG_ATTR, F("Unknown Font ID %s"), attr_p); LOG_WARNING(TAG_ATTR, F("Unknown Font ID %s"), attr_p);
} }
@ -687,8 +681,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_pattern_recolor(obj, part, state, lv_obj_set_style_pattern_recolor(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_pattern_recolor(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_pattern_recolor(obj, part));
} }
@ -696,7 +689,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
} }
case ATTR_PATTERN_IMAGE: case ATTR_PATTERN_IMAGE:
// return lv_obj_set_style_local_pattern_image(obj, part, state, (constvoid *)var); // return lv_obj_set_style_pattern_image(obj, part, state, (constvoid *)var);
// return; // return;
/* Image attributes */ /* Image attributes */
@ -708,8 +701,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_obj_set_style_local_image_recolor(obj, part, state, lv_obj_set_style_image_recolor(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
attr_out_color(obj, attr, lv_obj_get_style_image_recolor(obj, part)); attr_out_color(obj, attr, lv_obj_get_style_image_recolor(obj, part));
} }
@ -930,6 +922,8 @@ static inline bool do_attribute(T& list, lv_obj_t* obj, uint16_t attr_hash, int3
return false; return false;
} }
#endif
static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* payload, char** text, bool update) static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* payload, char** text, bool update)
{ {
if(!obj_check_type(obj, LV_HASP_IMAGE)) return HASP_ATTR_TYPE_NOT_FOUND; if(!obj_check_type(obj, LV_HASP_IMAGE)) return HASP_ATTR_TYPE_NOT_FOUND;
@ -939,10 +933,14 @@ static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* pa
lv_img_set_src(obj, payload); lv_img_set_src(obj, payload);
} else { } else {
switch(lv_img_src_get_type(obj)) { switch(lv_img_src_get_type(obj)) {
case LV_IMG_SRC_FILE: case LV_IMG_SRC_FILE: {
*text = (char*)lv_img_get_file_name(obj); *text = (((lv_img_t*)obj)->src_type == LV_IMG_SRC_FILE) ? (char*)lv_img_get_src(obj) : (char*)"";
// *text = (char*)lv_img_get_file_name(obj);
break;
}
case LV_IMG_SRC_SYMBOL: case LV_IMG_SRC_SYMBOL:
*text = (char*)lv_img_get_src(obj); *text = (char*)lv_img_get_src(obj);
break;
} }
} }
return HASP_ATTR_TYPE_STR; return HASP_ATTR_TYPE_STR;
@ -951,20 +949,35 @@ static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* pa
static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* attr, const char* payload, char** text, static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* attr, const char* payload, char** text,
bool update) bool update)
{ {
lv_label_align_t val; lv_text_align_t val;
if(update) { if(update) {
if(!strcasecmp_P(payload, PSTR("left"))) { if(!strcasecmp_P(payload, PSTR("left"))) {
val = LV_LABEL_ALIGN_LEFT; val = LV_TEXT_ALIGN_LEFT;
} else if(!strcasecmp_P(payload, PSTR("right"))) { } else if(!strcasecmp_P(payload, PSTR("right"))) {
val = LV_LABEL_ALIGN_RIGHT; val = LV_TEXT_ALIGN_RIGHT;
} else if(!strcasecmp_P(payload, PSTR("center"))) { } else if(!strcasecmp_P(payload, PSTR("center"))) {
val = LV_LABEL_ALIGN_CENTER; val = LV_TEXT_ALIGN_CENTER;
} else if(!strcasecmp_P(payload, PSTR("auto"))) { } else if(!strcasecmp_P(payload, PSTR("auto"))) {
val = LV_LABEL_ALIGN_AUTO; val = LV_TEXT_ALIGN_AUTO;
} else { } else {
val = atoi(payload); val = atoi(payload);
if(val > LV_LABEL_ALIGN_AUTO) return HASP_ATTR_TYPE_ALIGN_INVALID; switch(val) {
case 0:
val = LV_TEXT_ALIGN_LEFT;
break;
case 1:
val = LV_TEXT_ALIGN_CENTER;
break;
case 2:
val = LV_TEXT_ALIGN_RIGHT;
break;
case 3:
val = LV_TEXT_ALIGN_AUTO;
break;
default:
return HASP_ATTR_TYPE_ALIGN_INVALID;
}
} }
} }
@ -973,9 +986,9 @@ static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* a
lv_obj_t* label = FindButtonLabel(obj); lv_obj_t* label = FindButtonLabel(obj);
if(label) { if(label) {
if(update) if(update)
lv_label_set_align(label, val); lv_obj_set_style_text_align(label, val, LV_PART_MAIN);
else else
val = lv_label_get_align(label); val = lv_obj_get_style_text_align(label, LV_PART_MAIN);
} else { } else {
return HASP_ATTR_TYPE_NOT_FOUND; // not found return HASP_ATTR_TYPE_NOT_FOUND; // not found
} }
@ -983,23 +996,17 @@ static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* a
} }
case LV_HASP_BTNMATRIX: case LV_HASP_BTNMATRIX:
if(update) if(update)
lv_btnmatrix_set_align(obj, val); lv_obj_set_style_text_align(obj, val, LV_PART_ITEMS);
else else
val = lv_btnmatrix_get_align(obj); val = lv_obj_get_style_text_align(obj, LV_PART_ITEMS);
break; break;
case LV_HASP_LABEL: case LV_HASP_LABEL:
if(update)
lv_label_set_align(obj, val);
else
val = lv_label_get_align(obj);
break;
case LV_HASP_ROLLER: case LV_HASP_ROLLER:
if(update) if(update)
lv_roller_set_align(obj, val); lv_obj_set_style_text_align(obj, val, LV_PART_MAIN);
else else
val = lv_roller_get_align(obj); val = lv_obj_get_style_text_align(obj, LV_PART_MAIN);
break; break;
default: default:
@ -1008,22 +1015,24 @@ static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* a
// return values // return values
switch(val) { switch(val) {
case LV_LABEL_ALIGN_AUTO: case LV_TEXT_ALIGN_LEFT:
strcpy_P(*text, PSTR("auto")); strcpy_P(*text, PSTR("left"));
break; break;
case LV_LABEL_ALIGN_CENTER: case LV_TEXT_ALIGN_CENTER:
strcpy_P(*text, PSTR("center")); strcpy_P(*text, PSTR("center"));
break; break;
case LV_LABEL_ALIGN_RIGHT: case LV_TEXT_ALIGN_RIGHT:
strcpy_P(*text, PSTR("right")); strcpy_P(*text, PSTR("right"));
break; break;
default: default:
strcpy_P(*text, PSTR("left")); strcpy_P(*text, PSTR("auto"));
} }
return HASP_ATTR_TYPE_STR; return HASP_ATTR_TYPE_STR;
} }
#if LVGL_VERSION_MAJOR == 7
static hasp_attribute_type_t attribute_common_mode(lv_obj_t* obj, const char* payload, char** text, int32_t& val, static hasp_attribute_type_t attribute_common_mode(lv_obj_t* obj, const char* payload, char** text, int32_t& val,
bool update) bool update)
{ {
@ -1058,57 +1067,6 @@ static hasp_attribute_type_t attribute_common_mode(lv_obj_t* obj, const char* pa
return HASP_ATTR_TYPE_NOT_FOUND; return HASP_ATTR_TYPE_NOT_FOUND;
} }
static hasp_attribute_type_t attribute_common_text(lv_obj_t* obj, const char* attr, const char* payload, char** text,
bool update)
{
uint8_t obj_type = obj_get_type(obj);
hasp_attr_update_char_const_t list[] = {
{LV_HASP_BUTTON, ATTR_TEXT, my_btn_set_text, my_btn_get_text},
{LV_HASP_LABEL, ATTR_TEXT, my_label_set_text, my_label_get_text},
{LV_HASP_CHECKBOX, ATTR_TEXT, lv_checkbox_set_text, lv_checkbox_get_text},
{LV_HASP_TABVIEW, ATTR_TEXT, my_tabview_set_text, my_tabview_get_text},
{LV_HASP_TAB, ATTR_TEXT, my_tab_set_text, my_tab_get_text},
#if LV_USE_WIN != 0
{LV_HASP_WINDOW, ATTR_TEXT, lv_win_set_title, lv_win_get_title},
#endif
{LV_HASP_MSGBOX, ATTR_TEXT, lv_msgbox_set_text, lv_msgbox_get_text}
};
for(int i = 0; i < sizeof(list) / sizeof(list[0]); i++) {
if(obj_type == list[i].obj_type) {
if(update)
list[i].set(obj, payload);
else
*text = (char*)list[i].get(obj);
return HASP_ATTR_TYPE_STR;
}
}
// Special cases
// {LV_HASP_DROPDOWN, set_text_not_implemented, my_dropdown_get_text},
// {LV_HASP_ROLLER, set_text_not_implemented, my_roller_get_text},
switch(obj_get_type(obj)) {
case LV_HASP_DROPDOWN: {
lv_dropdown_get_selected_str(obj, *text, 128);
if(update) return HASP_ATTR_TYPE_STR_READONLY;
break;
}
case LV_HASP_ROLLER: {
lv_roller_get_selected_str(obj, *text, 128);
if(update) return HASP_ATTR_TYPE_STR_READONLY;
break;
}
default:
return HASP_ATTR_TYPE_NOT_FOUND;
}
return HASP_ATTR_TYPE_STR;
}
static hasp_attribute_type_t specific_options_attribute(lv_obj_t* obj, const char* payload, char** text, bool update) static hasp_attribute_type_t specific_options_attribute(lv_obj_t* obj, const char* payload, char** text, bool update)
{ {
switch(obj_get_type(obj)) { switch(obj_get_type(obj)) {
@ -1348,7 +1306,7 @@ static hasp_attribute_type_t attribute_common_val(lv_obj_t* obj, int32_t& val, b
else else
lv_obj_clear_state(obj, LV_STATE_CHECKED); lv_obj_clear_state(obj, LV_STATE_CHECKED);
} else { } else {
val = lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_CHECKED; val = lv_obj_get_state(obj) & LV_STATE_CHECKED;
} }
} else { } else {
return HASP_ATTR_TYPE_NOT_FOUND; // not checkable return HASP_ATTR_TYPE_NOT_FOUND; // not checkable
@ -1621,6 +1579,59 @@ static hasp_attribute_type_t attribute_common_method(lv_obj_t* obj, uint16_t att
return HASP_ATTR_TYPE_METHOD_OK; return HASP_ATTR_TYPE_METHOD_OK;
} }
#endif
static hasp_attribute_type_t attribute_common_text(lv_obj_t* obj, const char* attr, const char* payload, char** text,
bool update)
{
uint8_t obj_type = obj_get_type(obj);
hasp_attr_update_char_const_t list[] = {
// {LV_HASP_BUTTON, ATTR_TEXT, my_btn_set_text, my_btn_get_text},
{LV_HASP_LABEL, ATTR_TEXT, my_label_set_text, my_label_get_text},
{LV_HASP_CHECKBOX, ATTR_TEXT, lv_checkbox_set_text, lv_checkbox_get_text} //,
// {LV_HASP_TABVIEW, ATTR_TEXT, my_tabview_set_text, my_tabview_get_text},
// {LV_HASP_TAB, ATTR_TEXT, my_tab_set_text, my_tab_get_text},
#if LV_USE_WIN != 0
// {LV_HASP_WINDOW, ATTR_TEXT, lv_win_set_title, lv_win_get_title},
#endif
// {LV_HASP_MSGBOX, ATTR_TEXT, lv_msgbox_set_text, lv_msgbox_get_text}
};
for(int i = 0; i < sizeof(list) / sizeof(list[0]); i++) {
if(obj_type == list[i].obj_type) {
if(update)
list[i].set(obj, payload);
else
*text = (char*)list[i].get(obj);
return HASP_ATTR_TYPE_STR;
}
}
// Special cases
// {LV_HASP_DROPDOWN, set_text_not_implemented, my_dropdown_get_text},
// {LV_HASP_ROLLER, set_text_not_implemented, my_roller_get_text},
switch(obj_get_type(obj)) {
case LV_HASP_DROPDOWN: {
lv_dropdown_get_selected_str(obj, *text, 128);
if(update) return HASP_ATTR_TYPE_STR_READONLY;
break;
}
case LV_HASP_ROLLER: {
lv_roller_get_selected_str(obj, *text, 128);
if(update) return HASP_ATTR_TYPE_STR_READONLY;
break;
}
default:
return HASP_ATTR_TYPE_NOT_FOUND;
}
return HASP_ATTR_TYPE_STR;
}
/** /**
* Change or Retrieve the value of the attribute of an object * Change or Retrieve the value of the attribute of an object
* @param obj lv_obj_t*: the object to get/set the attribute * @param obj lv_obj_t*: the object to get/set the attribute
@ -1632,31 +1643,31 @@ static hasp_attribute_type_t attribute_common_method(lv_obj_t* obj, uint16_t att
static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_hash, int32_t& val, bool update) static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_hash, int32_t& val, bool update)
{ {
switch(attr_hash) { switch(attr_hash) {
case ATTR_ID: // case ATTR_ID:
if(update) // if(update)
obj->user_data.id = (uint8_t)val; // obj->user_data.id = (uint8_t)val;
else // else
val = obj->user_data.id; // val = obj->user_data.id;
break; // attribute_found // break; // attribute_found
case ATTR_GROUPID: // case ATTR_GROUPID:
if(update) // if(update)
obj->user_data.groupid = (uint8_t)val; // obj->user_data.groupid = (uint8_t)val;
else // else
val = obj->user_data.groupid; // val = obj->user_data.groupid;
break; // attribute_found // break; // attribute_found
case ATTR_TRANSITION: // case ATTR_TRANSITION:
if(update) // if(update)
obj->user_data.transitionid = (uint8_t)val; // obj->user_data.transitionid = (uint8_t)val;
else // else
val = obj->user_data.transitionid; // val = obj->user_data.transitionid;
break; // attribute_found // break; // attribute_found
case ATTR_OBJID: // case ATTR_OBJID:
val = obj->user_data.objid; // val = obj->user_data.objid;
if(update && val != obj->user_data.objid) HASP_ATTR_TYPE_INT_READONLY; // if(update && val != obj->user_data.objid) HASP_ATTR_TYPE_INT_READONLY;
break; // attribute_found // break; // attribute_found
case ATTR_X: case ATTR_X:
if(update) if(update)
@ -1677,8 +1688,9 @@ static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_h
lv_obj_set_width(obj, val); lv_obj_set_width(obj, val);
if(obj_check_type(obj, LV_HASP_CPICKER)) { if(obj_check_type(obj, LV_HASP_CPICKER)) {
#if LVGL_VERSION_MAJOR == 7 #if LVGL_VERSION_MAJOR == 7
lv_cpicker_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) ? LV_CPICKER_TYPE_DISC lv_colorwheel_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj)
: LV_CPICKER_TYPE_RECT); ? lv_colorwheel_TYPE_DISC
: lv_colorwheel_TYPE_RECT);
#endif #endif
} }
} else { } else {
@ -1691,8 +1703,9 @@ static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_h
lv_obj_set_height(obj, val); lv_obj_set_height(obj, val);
if(obj_check_type(obj, LV_HASP_CPICKER)) { if(obj_check_type(obj, LV_HASP_CPICKER)) {
#if LVGL_VERSION_MAJOR == 7 #if LVGL_VERSION_MAJOR == 7
lv_cpicker_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) ? LV_CPICKER_TYPE_DISC lv_colorwheel_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj)
: LV_CPICKER_TYPE_RECT); ? lv_colorwheel_TYPE_DISC
: lv_colorwheel_TYPE_RECT);
#endif #endif
} }
} else { } else {
@ -1702,26 +1715,27 @@ static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_h
case ATTR_OPACITY: case ATTR_OPACITY:
if(update) if(update)
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, val); lv_obj_set_style_opa(obj, LV_PART_MAIN | LV_STATE_DEFAULT, val);
else else
val = lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN); val = lv_obj_get_style_opa(obj, LV_OBJ_PART_MAIN);
break; // attribute_found break; // attribute_found
case ATTR_EXT_CLICK_H: // case ATTR_EXT_CLICK_H:
if(update) // if(update)
lv_obj_set_ext_click_area(obj, val, val, lv_obj_get_ext_click_pad_top(obj), // lv_obj_set_ext_click_area(obj, val, val, lv_obj_get_ext_click_pad_top(obj),
lv_obj_get_ext_click_pad_bottom(obj)); // lv_obj_get_ext_click_pad_bottom(obj));
else // else
val = lv_obj_get_ext_click_pad_left(obj); // val = lv_obj_get_ext_click_pad_left(obj);
break; // attribute_found // break; // attribute_found
case ATTR_EXT_CLICK_V: // case ATTR_EXT_CLICK_V:
if(update) // if(update)
lv_obj_set_ext_click_area(obj, lv_obj_get_ext_click_pad_left(obj), lv_obj_get_ext_click_pad_right(obj), // lv_obj_set_ext_click_area(obj, lv_obj_get_ext_click_pad_left(obj),
val, val); // lv_obj_get_ext_click_pad_right(obj),
else // val, val);
val = lv_obj_get_ext_click_pad_top(obj); // else
break; // attribute_found // val = lv_obj_get_ext_click_pad_top(obj);
// break; // attribute_found
default: default:
return HASP_ATTR_TYPE_NOT_FOUND; // attribute_not found return HASP_ATTR_TYPE_NOT_FOUND; // attribute_not found
@ -1769,15 +1783,15 @@ static hasp_attribute_type_t attribute_common_bool(lv_obj_t* obj, uint16_t attr_
else else
lv_obj_add_state(obj, LV_STATE_DISABLED); lv_obj_add_state(obj, LV_STATE_DISABLED);
else else
val = !(lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_DISABLED); val = !(lv_obj_get_state(obj) & LV_STATE_DISABLED);
break; // attribute_found break; // attribute_found
case ATTR_SWIPE: // case ATTR_SWIPE:
if(update) // if(update)
obj->user_data.swipeid = (!!val) % 16; // obj->user_data.swipeid = (!!val) % 16;
else // else
val = obj->user_data.swipeid; // val = obj->user_data.swipeid;
break; // attribute_found // break; // attribute_found
case ATTR_TOGGLE: case ATTR_TOGGLE:
switch(obj_get_type(obj)) { switch(obj_get_type(obj)) {
@ -1795,7 +1809,7 @@ static hasp_attribute_type_t attribute_common_bool(lv_obj_t* obj, uint16_t attr_
lv_btnmatrix_set_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKABLE); lv_btnmatrix_set_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKABLE);
} else { } else {
lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKABLE); lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKABLE);
lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECK_STATE); lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKED);
} }
} else { } else {
val = lv_btn_get_checkable(obj); val = lv_btn_get_checkable(obj);
@ -1926,17 +1940,17 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
case ATTR_MIN: case ATTR_MIN:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = attribute_common_range(obj, val, update, true, false); // ret = attribute_common_range(obj, val, update, true, false);
break; break;
case ATTR_MAX: case ATTR_MAX:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = attribute_common_range(obj, val, update, false, true); // ret = attribute_common_range(obj, val, update, false, true);
break; break;
case ATTR_VAL: case ATTR_VAL:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = attribute_common_val(obj, val, update); // ret = attribute_common_val(obj, val, update);
break; break;
case ATTR_TXT: // TODO: remove case ATTR_TXT: // TODO: remove
@ -1958,21 +1972,24 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
break; break;
case ATTR_MODE: case ATTR_MODE:
ret = attribute_common_mode(obj, payload, &text, val, update); // ret = attribute_common_mode(obj, payload, &text, val, update);
break; break;
case ATTR_OPTIONS: case ATTR_OPTIONS:
ret = specific_options_attribute(obj, payload, &text, update); // ret = specific_options_attribute(obj, payload, &text, update);
break; break;
// case ATTR_BTN_POS: // case ATTR_BTN_POS:
case ATTR_ACTION: case ATTR_ACTION:
if(update) if(obj->user_data) {
obj->user_data.actionid = Parser::get_action_id(payload); lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
else if(update)
val = obj->user_data.actionid; user_data->actionid = Parser::get_action_id(payload);
ret = HASP_ATTR_TYPE_INT; else
val = user_data->actionid;
ret = HASP_ATTR_TYPE_INT;
}
break; break;
// case ATTR_SYMBOL: // case ATTR_SYMBOL:
@ -1986,7 +2003,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
case ATTR_TO_BACK: case ATTR_TO_BACK:
case ATTR_OPEN: case ATTR_OPEN:
case ATTR_CLOSE: case ATTR_CLOSE:
ret = attribute_common_method(obj, attr_hash, attribute, payload); // ret = attribute_common_method(obj, attr_hash, attribute, payload);
break; break;
case ATTR_COMMENT: case ATTR_COMMENT:
@ -2009,14 +2026,14 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
case ATTR_COUNT: case ATTR_COUNT:
case ATTR_BTN_POS: case ATTR_BTN_POS:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = specific_int_attribute(obj, attr_hash, val, update); // ret = specific_int_attribute(obj, attr_hash, val, update);
break; break;
case ATTR_OFFSET_X: case ATTR_OFFSET_X:
case ATTR_OFFSET_Y: case ATTR_OFFSET_Y:
case ATTR_MAX_HEIGHT: case ATTR_MAX_HEIGHT:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = specific_coord_attribute(obj, attr_hash, val, update); // ret = specific_coord_attribute(obj, attr_hash, val, update);
break; break;
case ATTR_ADJUSTABLE: case ATTR_ADJUSTABLE:
@ -2025,19 +2042,19 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
case ATTR_SHOW_SELECTED: case ATTR_SHOW_SELECTED:
case ATTR_Y_INVERT: case ATTR_Y_INVERT:
val = Parser::is_true(payload); val = Parser::is_true(payload);
ret = specific_bool_attribute(obj, attr_hash, val, update); // ret = specific_bool_attribute(obj, attr_hash, val, update);
break; break;
case ATTR_NEXT: case ATTR_NEXT:
case ATTR_PREV: case ATTR_PREV:
case ATTR_BACK: case ATTR_BACK:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = specific_page_attribute(obj, attr_hash, val, update); // ret = specific_page_attribute(obj, attr_hash, val, update);
break; break;
case ATTR_DIRECTION: case ATTR_DIRECTION:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = special_attribute_direction(obj, attr_hash, val, update); // ret = special_attribute_direction(obj, attr_hash, val, update);
break; break;
case ATTR_SRC: case ATTR_SRC:
@ -2045,7 +2062,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
break; break;
default: { default: {
ret = hasp_local_style_attr(obj, attribute, attr_hash, payload, update, val); // ret = hasp_local_style_attr(obj, attribute, attr_hash, payload, update, val);
} }
} }
@ -2054,22 +2071,22 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
case LV_HASP_ARC: case LV_HASP_ARC:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = hasp_process_arc_attribute(obj, attr_hash, val, update); // ret = hasp_process_arc_attribute(obj, attr_hash, val, update);
break; break;
case LV_HASP_GAUGE: case LV_HASP_GAUGE:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = hasp_process_gauge_attribute(obj, attr_hash, val, update); // ret = hasp_process_gauge_attribute(obj, attr_hash, val, update);
break; break;
case LV_HASP_LINEMETER: case LV_HASP_LINEMETER:
val = strtol(payload, nullptr, DEC); val = strtol(payload, nullptr, DEC);
ret = hasp_process_lmeter_attribute(obj, attr_hash, val, update); // ret = hasp_process_lmeter_attribute(obj, attr_hash, val, update);
break; break;
case LV_HASP_LINE: case LV_HASP_LINE:
if(attr_hash == ATTR_POINTS) // if(attr_hash == ATTR_POINTS)
ret = my_line_set_points(obj, payload) ? HASP_ATTR_TYPE_METHOD_OK : HASP_ATTR_TYPE_RANGE_ERROR; // ret = my_line_set_points(obj, payload) ? HASP_ATTR_TYPE_METHOD_OK : HASP_ATTR_TYPE_RANGE_ERROR;
break; break;
case LV_HASP_CPICKER: case LV_HASP_CPICKER:
@ -2077,9 +2094,9 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
if(update) { if(update) {
lv_color32_t c; lv_color32_t c;
if(Parser::haspPayloadToColor(payload, c)) if(Parser::haspPayloadToColor(payload, c))
lv_cpicker_set_color(obj, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); lv_colorwheel_set_rgb(obj, lv_color_make(c.ch.red, c.ch.green, c.ch.blue));
} else { } else {
color = lv_cpicker_get_color(obj); color = lv_colorwheel_get_rgb(obj);
} }
ret = HASP_ATTR_TYPE_COLOR; ret = HASP_ATTR_TYPE_COLOR;
} }

View File

@ -6,6 +6,19 @@
#include "hasplib.h" #include "hasplib.h"
static inline void lv_obj_set_event_cb(lv_obj_t* obj, lv_event_cb_t cb)
{
lv_obj_add_event_cb(obj, cb, LV_EVENT_ALL, NULL);
}
#define lv_style_int_t lv_coord_t
#define lv_anim_value_t lv_coord_t
void attr_out_str(lv_obj_t* obj, const char* attribute, const char* data);
void attr_out_int(lv_obj_t* obj, const char* attribute, int32_t val);
void attr_out_color(lv_obj_t* obj, const char* attribute, lv_color_t color);
#if LVGL_VERSION_MAJOR >= 7
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -21,10 +34,6 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
bool attribute_set_normalized_value(lv_obj_t* obj, hasp_update_value_t& value); bool attribute_set_normalized_value(lv_obj_t* obj, hasp_update_value_t& value);
void attr_out_str(lv_obj_t* obj, const char* attribute, const char* data);
void attr_out_int(lv_obj_t* obj, const char* attribute, int32_t val);
void attr_out_color(lv_obj_t* obj, const char* attribute, lv_color_t color);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
@ -143,45 +152,118 @@ struct hasp_attr_update_char_const_t
const char* (*get)(const lv_obj_t*); const char* (*get)(const lv_obj_t*);
}; };
#define _HASP_ATTRIBUTE_OLD(prop_name, func_name, value_type) \ #define _HASP_ATTRIBUTE_V7(prop_name, func_name, value_type) \
static inline void attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, bool update, \ static inline hasp_attribute_type_t attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, \
const char* attr, value_type val) \ bool update, value_type val, int32_t& res) \
{ \ { \
if(update) { \ if(update) lv_obj_set_style_##func_name(obj, part, state, (value_type)val); \
return lv_obj_set_style_local_##func_name(obj, part, state, (value_type)val); \ res = (int32_t)lv_obj_get_style_##func_name(obj, part); \
} else { \ return HASP_ATTR_TYPE_INT; \
value_type temp = lv_obj_get_style_##func_name(obj, part); \
/*lv_obj_get_style_##func_name(obj, part, state, &temp);*/ \
return attr_out_int(obj, attr, temp); \
} \
} }
#define _HASP_ATTRIBUTE(prop_name, func_name, value_type) \ #define _HASP_ATTRIBUTE(prop_name, func_name, value_type) \
static inline hasp_attribute_type_t attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, \ static inline hasp_attribute_type_t attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, \
bool update, value_type val, int32_t& res) \ bool update, value_type val, int32_t& res) \
{ \ { \
if(update) lv_obj_set_style_local_##func_name(obj, part, state, (value_type)val); \ if(update) lv_obj_set_style_##func_name(obj, (value_type)val, part); \
res = (int32_t)lv_obj_get_style_##func_name(obj, part); \ res = (int32_t)lv_obj_get_style_##func_name(obj, part); \
return HASP_ATTR_TYPE_INT; \ return HASP_ATTR_TYPE_INT; \
} }
_HASP_ATTRIBUTE(RADIUS, radius, lv_style_int_t) _HASP_ATTRIBUTE(ALIGN, align, lv_align_t)
_HASP_ATTRIBUTE(ANIM_SPEED, anim_speed, uint32_t)
_HASP_ATTRIBUTE(ANIM_TIME, anim_time, uint32_t)
// _HASP_ATTRIBUTE(ARC_COLOR, arc_color, lv_color_t)
// _HASP_ATTRIBUTE(ARC_COLOR_FILTERED, arc_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(ARC_IMG_SRC, arc_img_src, const void*)
_HASP_ATTRIBUTE(ARC_OPA, arc_opa, lv_opa_t)
_HASP_ATTRIBUTE(ARC_ROUNDED, arc_rounded, lv_coord_t)
_HASP_ATTRIBUTE(ARC_WIDTH, arc_width, lv_coord_t)
_HASP_ATTRIBUTE(BASE_DIR, base_dir, lv_base_dir_t)
// _HASP_ATTRIBUTE(BG_COLOR, bg_color, lv_color_t)
// _HASP_ATTRIBUTE(BG_COLOR_FILTERED, bg_color_filtered, lv_color_t)
// _HASP_ATTRIBUTE(BG_GRAD_COLOR, bg_grad_color, lv_color_t)
// _HASP_ATTRIBUTE(BG_GRAD_COLOR_FILTERED, bg_grad_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t)
_HASP_ATTRIBUTE(BG_GRAD_STOP, bg_grad_stop, lv_coord_t)
_HASP_ATTRIBUTE(BG_IMG_OPA, bg_img_opa, lv_opa_t)
// _HASP_ATTRIBUTE(BG_IMG_RECOLOR, bg_img_recolor, lv_color_t)
// _HASP_ATTRIBUTE(BG_IMG_RECOLOR_FILTERED, bg_img_recolor_filtered, lv_color_t)
_HASP_ATTRIBUTE(BG_IMG_RECOLOR_OPA, bg_img_recolor_opa, lv_opa_t)
_HASP_ATTRIBUTE(BG_IMG_SRC, bg_img_src, const void*)
_HASP_ATTRIBUTE(BG_IMG_TILED, bg_img_tiled, bool)
_HASP_ATTRIBUTE(BG_MAIN_STOP, bg_main_stop, lv_coord_t)
_HASP_ATTRIBUTE(BG_OPA, bg_opa, lv_opa_t)
_HASP_ATTRIBUTE(BLEND_MODE, blend_mode, lv_blend_mode_t)
// _HASP_ATTRIBUTE(BORDER_COLOR, border_color, lv_color_t)
// _HASP_ATTRIBUTE(BORDER_COLOR_FILTERED, border_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(BORDER_OPA, border_opa, lv_opa_t)
_HASP_ATTRIBUTE(BORDER_POST, border_post, bool)
_HASP_ATTRIBUTE(BORDER_SIDE, border_side, lv_border_side_t)
_HASP_ATTRIBUTE(BORDER_WIDTH, border_width, lv_coord_t)
_HASP_ATTRIBUTE(CLIP_CORNER, clip_corner, bool) _HASP_ATTRIBUTE(CLIP_CORNER, clip_corner, bool)
_HASP_ATTRIBUTE(SIZE, size, lv_style_int_t) _HASP_ATTRIBUTE(COLOR_FILTER_DSC, color_filter_dsc, const lv_color_filter_dsc_t*)
_HASP_ATTRIBUTE(TRANSFORM_WIDTH, transform_width, lv_style_int_t) _HASP_ATTRIBUTE(COLOR_FILTER_OPA, color_filter_opa, lv_opa_t)
_HASP_ATTRIBUTE(TRANSFORM_HEIGHT, transform_height, lv_style_int_t) _HASP_ATTRIBUTE(HEIGHT, height, lv_coord_t)
_HASP_ATTRIBUTE(OPA_SCALE, opa_scale, lv_opa_t) _HASP_ATTRIBUTE(IMG_OPA, img_opa, lv_opa_t)
_HASP_ATTRIBUTE(MARGIN_TOP, margin_top, lv_style_int_t) // _HASP_ATTRIBUTE(IMG_RECOLOR, img_recolor, lv_color_t)
_HASP_ATTRIBUTE(MARGIN_BOTTOM, margin_bottom, lv_style_int_t) // _HASP_ATTRIBUTE(IMG_RECOLOR_FILTERED, img_recolor_filtered, lv_color_t)
_HASP_ATTRIBUTE(MARGIN_LEFT, margin_left, lv_style_int_t) _HASP_ATTRIBUTE(IMG_RECOLOR_OPA, img_recolor_opa, lv_opa_t)
_HASP_ATTRIBUTE(MARGIN_RIGHT, margin_right, lv_style_int_t) _HASP_ATTRIBUTE(LAYOUT, layout, uint16_t)
_HASP_ATTRIBUTE(PAD_TOP, pad_top, lv_style_int_t) // _HASP_ATTRIBUTE(LINE_COLOR, line_color, lv_color_t)
_HASP_ATTRIBUTE(PAD_BOTTOM, pad_bottom, lv_style_int_t) // _HASP_ATTRIBUTE(LINE_COLOR_FILTERED, line_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(PAD_LEFT, pad_left, lv_style_int_t) _HASP_ATTRIBUTE(LINE_DASH_GAP, line_dash_gap, lv_coord_t)
_HASP_ATTRIBUTE(PAD_RIGHT, pad_right, lv_style_int_t) _HASP_ATTRIBUTE(LINE_DASH_WIDTH, line_dash_width, lv_coord_t)
_HASP_ATTRIBUTE(LINE_OPA, line_opa, lv_opa_t)
_HASP_ATTRIBUTE(LINE_ROUNDED, line_rounded, lv_coord_t)
_HASP_ATTRIBUTE(LINE_WIDTH, line_width, lv_coord_t)
_HASP_ATTRIBUTE(MAX_HEIGHT, max_height, lv_coord_t)
_HASP_ATTRIBUTE(MAX_WIDTH, max_width, lv_coord_t)
_HASP_ATTRIBUTE(MIN_HEIGHT, min_height, lv_coord_t)
_HASP_ATTRIBUTE(MIN_WIDTH, min_width, lv_coord_t)
_HASP_ATTRIBUTE(OPA, opa, lv_opa_t)
// _HASP_ATTRIBUTE(OUTLINE_COLOR, outline_color, lv_color_t)
// _HASP_ATTRIBUTE(OUTLINE_COLOR_FILTERED, outline_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(OUTLINE_OPA, outline_opa, lv_opa_t)
_HASP_ATTRIBUTE(OUTLINE_PAD, outline_pad, lv_coord_t)
_HASP_ATTRIBUTE(OUTLINE_WIDTH, outline_width, lv_coord_t)
_HASP_ATTRIBUTE(PAD_BOTTOM, pad_bottom, lv_coord_t)
_HASP_ATTRIBUTE(PAD_COLUMN, pad_column, lv_coord_t)
_HASP_ATTRIBUTE(PAD_LEFT, pad_left, lv_coord_t)
_HASP_ATTRIBUTE(PAD_RIGHT, pad_right, lv_coord_t)
_HASP_ATTRIBUTE(PAD_ROW, pad_row, lv_coord_t)
_HASP_ATTRIBUTE(PAD_TOP, pad_top, lv_coord_t)
_HASP_ATTRIBUTE(RADIUS, radius, lv_coord_t)
// _HASP_ATTRIBUTE(SHADOW_COLOR, shadow_color, lv_color_t)
// _HASP_ATTRIBUTE(SHADOW_COLOR_FILTERED, shadow_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(SHADOW_OFS_X, shadow_ofs_x, lv_coord_t)
_HASP_ATTRIBUTE(SHADOW_OFS_Y, shadow_ofs_y, lv_coord_t)
_HASP_ATTRIBUTE(SHADOW_OPA, shadow_opa, lv_opa_t)
_HASP_ATTRIBUTE(SHADOW_SPREAD, shadow_spread, lv_coord_t)
_HASP_ATTRIBUTE(SHADOW_WIDTH, shadow_width, lv_coord_t)
_HASP_ATTRIBUTE(TEXT_ALIGN, text_align, lv_text_align_t)
// _HASP_ATTRIBUTE(TEXT_COLOR, text_color, lv_color_t)
// _HASP_ATTRIBUTE(TEXT_COLOR_FILTERED, text_color_filtered, lv_color_t)
_HASP_ATTRIBUTE(TEXT_DECOR, text_decor, lv_text_decor_t)
_HASP_ATTRIBUTE(TEXT_FONT, text_font, const lv_font_t*)
_HASP_ATTRIBUTE(TEXT_LETTER_SPACE, text_letter_space, lv_coord_t)
_HASP_ATTRIBUTE(TEXT_LINE_SPACE, text_line_space, lv_coord_t)
_HASP_ATTRIBUTE(TEXT_OPA, text_opa, lv_opa_t)
_HASP_ATTRIBUTE(TRANSFORM_ANGLE, transform_angle, lv_coord_t)
_HASP_ATTRIBUTE(TRANSFORM_HEIGHT, transform_height, lv_coord_t)
_HASP_ATTRIBUTE(TRANSFORM_WIDTH, transform_width, lv_coord_t)
_HASP_ATTRIBUTE(TRANSFORM_ZOOM, transform_zoom, lv_coord_t)
_HASP_ATTRIBUTE(TRANSITION, transition, const lv_style_transition_dsc_t*)
_HASP_ATTRIBUTE(TRANSLATE_X, translate_x, lv_coord_t)
_HASP_ATTRIBUTE(TRANSLATE_Y, translate_y, lv_coord_t)
_HASP_ATTRIBUTE(WIDTH, width, lv_coord_t)
_HASP_ATTRIBUTE(X, x, lv_coord_t)
_HASP_ATTRIBUTE(Y, y, lv_coord_t)
#if LVGL_VERSION_MAJOR == 7 #if LVGL_VERSION_MAJOR == 7
_HASP_ATTRIBUTE(PAD_INNER, pad_inner, lv_style_int_t) _HASP_ATTRIBUTE(PAD_INNER, pad_inner, lv_style_int_t)
#endif #endif
#if LV_USE_BLEND_MODES #if LV_USE_BLEND_MODES
_HASP_ATTRIBUTE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t)
_HASP_ATTRIBUTE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t)
@ -193,21 +275,7 @@ _HASP_ATTRIBUTE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t)
_HASP_ATTRIBUTE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t)
_HASP_ATTRIBUTE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t)
#endif #endif
_HASP_ATTRIBUTE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t)
_HASP_ATTRIBUTE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t)
_HASP_ATTRIBUTE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t)
//_HASP_ATTRIBUTE(BG_COLOR, bg_color, lv_color_t, _color, nonscalar)
//_HASP_ATTRIBUTE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(BG_OPA, bg_opa, lv_opa_t)
_HASP_ATTRIBUTE(BORDER_WIDTH, border_width, lv_style_int_t)
_HASP_ATTRIBUTE(BORDER_SIDE, border_side, lv_border_side_t)
_HASP_ATTRIBUTE(BORDER_POST, border_post, bool)
//_HASP_ATTRIBUTE(BORDER_COLOR, border_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(BORDER_OPA, border_opa, lv_opa_t)
_HASP_ATTRIBUTE(OUTLINE_WIDTH, outline_width, lv_style_int_t)
_HASP_ATTRIBUTE(OUTLINE_PAD, outline_pad, lv_style_int_t)
//_HASP_ATTRIBUTE(OUTLINE_COLOR, outline_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(OUTLINE_OPA, outline_opa, lv_opa_t)
#if LV_USE_SHADOW #if LV_USE_SHADOW
_HASP_ATTRIBUTE(SHADOW_WIDTH, shadow_width, lv_style_int_t) _HASP_ATTRIBUTE(SHADOW_WIDTH, shadow_width, lv_style_int_t)
_HASP_ATTRIBUTE(SHADOW_OFS_X, shadow_ofs_x, lv_style_int_t) _HASP_ATTRIBUTE(SHADOW_OFS_X, shadow_ofs_x, lv_style_int_t)
@ -216,51 +284,6 @@ _HASP_ATTRIBUTE(SHADOW_SPREAD, shadow_spread, lv_style_int_t)
//_HASP_ATTRIBUTE(SHADOW_COLOR, shadow_color, lv_color_t, _color, nonscalar) //_HASP_ATTRIBUTE(SHADOW_COLOR, shadow_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(SHADOW_OPA, shadow_opa, lv_opa_t) _HASP_ATTRIBUTE(SHADOW_OPA, shadow_opa, lv_opa_t)
#endif #endif
_HASP_ATTRIBUTE(PATTERN_REPEAT, pattern_repeat, bool)
//_HASP_ATTRIBUTE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(PATTERN_OPA, pattern_opa, lv_opa_t)
_HASP_ATTRIBUTE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t)
//_HASP_ATTRIBUTE(PATTERN_IMAGE, pattern_image, const void *, _data_ptr, scalar)
_HASP_ATTRIBUTE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t)
_HASP_ATTRIBUTE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t)
_HASP_ATTRIBUTE(VALUE_OFS_X, value_ofs_x, lv_style_int_t)
_HASP_ATTRIBUTE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t)
_HASP_ATTRIBUTE(VALUE_ALIGN, value_align, lv_align_t)
//_HASP_ATTRIBUTE(VALUE_COLOR, value_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(VALUE_OPA, value_opa, lv_opa_t)
//_HASP_ATTRIBUTE(VALUE_FONT, value_font, const lv_font_t *, _data_ptr, scalar)
//_HASP_ATTRIBUTE(VALUE_STR, value_str, const char *, _data_ptr, scalar)
_HASP_ATTRIBUTE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t)
_HASP_ATTRIBUTE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t)
_HASP_ATTRIBUTE(TEXT_DECOR, text_decor, lv_text_decor_t)
//_HASP_ATTRIBUTE(TEXT_COLOR, text_color, lv_color_t, _color, nonscalar)
//_HASP_ATTRIBUTE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(TEXT_OPA, text_opa, lv_opa_t)
//_HASP_ATTRIBUTE(TEXT_FONT, text_font, const lv_font_t *, _data_ptr, scalar)
_HASP_ATTRIBUTE(LINE_WIDTH, line_width, lv_style_int_t)
_HASP_ATTRIBUTE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t)
_HASP_ATTRIBUTE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t)
_HASP_ATTRIBUTE(LINE_ROUNDED, line_rounded, bool)
//_HASP_ATTRIBUTE(LINE_COLOR, line_color, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(LINE_OPA, line_opa, lv_opa_t)
//_HASP_ATTRIBUTE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color, nonscalar)
_HASP_ATTRIBUTE(IMAGE_OPA, image_opa, lv_opa_t)
_HASP_ATTRIBUTE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t)
_HASP_ATTRIBUTE(TRANSITION_TIME, transition_time, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_DELAY, transition_delay, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_PROP_1, transition_prop_1, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_PROP_2, transition_prop_2, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_PROP_3, transition_prop_3, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_PROP_4, transition_prop_4, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_PROP_5, transition_prop_5, lv_style_int_t)
_HASP_ATTRIBUTE(TRANSITION_PROP_6, transition_prop_6, lv_style_int_t)
_HASP_ATTRIBUTE(SCALE_WIDTH, scale_width, lv_style_int_t)
_HASP_ATTRIBUTE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t)
_HASP_ATTRIBUTE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t)
_HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
//_HASP_ATTRIBUTE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color, nonscalar)
//_HASP_ATTRIBUTE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color, nonscalar)
/* attribute hashes */ /* attribute hashes */
/* Object Part Attributes */ /* Object Part Attributes */
@ -487,3 +510,5 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
#define ATTR_TEXT_SSID 62981 #define ATTR_TEXT_SSID 62981
#endif #endif
#endif

View File

@ -3,6 +3,8 @@
#include "hasplib.h" #include "hasplib.h"
#if LVGL_VERSION_MAJOR == 7
const char* my_tabview_get_tab_name(const lv_obj_t* tabview, uint16_t id) const char* my_tabview_get_tab_name(const lv_obj_t* tabview, uint16_t id)
{ {
if(id >= lv_tabview_get_tab_count(tabview)) return NULL; if(id >= lv_tabview_get_tab_count(tabview)) return NULL;
@ -115,19 +117,18 @@ lv_coord_t my_dropdown_get_max_height(lv_obj_t* obj)
return lv_dropdown_get_max_height(obj); return lv_dropdown_get_max_height(obj);
} }
#endif
// OK // OK
lv_obj_t* FindButtonLabel(lv_obj_t* btn) lv_obj_t* FindButtonLabel(const lv_obj_t* btn)
{ {
if(btn) { if(btn) {
lv_obj_t* label = lv_obj_get_child_back(btn, NULL); for(uint32_t i = 0; i < lv_obj_get_child_cnt(btn); i++) {
if(label) { lv_obj_t* child = lv_obj_get_child(btn, i);
if(obj_check_type(label, LV_HASP_LABEL)) { if(lv_obj_check_type(child, &lv_label_class)) return child;
return label;
}
} else {
LOG_ERROR(TAG_ATTR, F("FindButtonLabel NULL Pointer encountered"));
} }
LOG_ERROR(TAG_ATTR, F("FindButtonLabel NULL Pointer encountered"));
} else { } else {
LOG_WARNING(TAG_ATTR, F("Button not defined")); LOG_WARNING(TAG_ATTR, F("Button not defined"));
} }
@ -186,30 +187,13 @@ static void my_label_set_text(lv_obj_t* label, const char* text)
// OK // OK
static const char* my_btn_get_text(const lv_obj_t* obj) static const char* my_btn_get_text(const lv_obj_t* obj)
{ {
if(!obj) { if(obj) {
LOG_WARNING(TAG_ATTR, F("Button not defined")); const lv_obj_t* label = FindButtonLabel(obj);
return NULL; if(label) return lv_label_get_text(label);
}
lv_obj_t* label = lv_obj_get_child_back(obj, NULL);
if(label) {
#if 1
if(obj_check_type(label, LV_HASP_LABEL)) return lv_label_get_text(label);
#else
lv_obj_type_t list;
lv_obj_get_type(label, &list);
if(obj_check_type(list.type[0], LV_HASP_LABEL)) {
text = lv_label_get_text(label);
return true;
}
#endif
} else {
LOG_WARNING(TAG_ATTR, F("my_btn_get_text NULL Pointer encountered")); LOG_WARNING(TAG_ATTR, F("my_btn_get_text NULL Pointer encountered"));
} else {
LOG_WARNING(TAG_ATTR, F("Button not defined"));
} }
return NULL; return NULL;
} }
@ -217,11 +201,11 @@ static const char* my_btn_get_text(const lv_obj_t* obj)
static inline void my_btn_set_text(lv_obj_t* obj, const char* value) static inline void my_btn_set_text(lv_obj_t* obj, const char* value)
{ {
lv_obj_t* label = FindButtonLabel(obj); lv_obj_t* label = FindButtonLabel(obj);
if(label) { if(label) my_label_set_text(label, value);
my_label_set_text(label, value);
}
} }
#if LVGL_VERSION_MAJOR == 7
/** /**
* Set a new value_str for an object. Memory will be allocated to store the text by the object. * Set a new value_str for an object. Memory will be allocated to store the text by the object.
* @param obj pointer to a object * @param obj pointer to a object
@ -229,6 +213,8 @@ static inline void my_btn_set_text(lv_obj_t* obj, const char* value)
*/ */
void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, const char* text) void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, const char* text)
{ {
#if 0
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
const void* value_str_p = lv_obj_get_style_value_str(obj, part); const void* value_str_p = lv_obj_get_style_value_str(obj, part);
@ -236,7 +222,7 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co
if(text == NULL || text[0] == 0) { if(text == NULL || text[0] == 0) {
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
lv_obj_set_style_local_value_str(obj, part, state, NULL); lv_obj_set_style_value_str(obj, part, state, NULL);
lv_mem_free(value_str_p); lv_mem_free(value_str_p);
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
return; return;
@ -256,12 +242,12 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
strncpy((char*)value_str_p, text, len); strncpy((char*)value_str_p, text, len);
lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p); lv_obj_set_style_value_str(obj, part, state, (char*)value_str_p);
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
return; return;
} }
// lv_obj_set_style_local_value_str(obj, part, state, str_p); // lv_obj_set_style_value_str(obj, part, state, str_p);
if(value_str_p == text) { if(value_str_p == text) {
/*If set its own text then reallocate it (maybe its size changed)*/ /*If set its own text then reallocate it (maybe its size changed)*/
@ -288,10 +274,11 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co
value_str_p = lv_mem_alloc(len); value_str_p = lv_mem_alloc(len);
LV_ASSERT_MEM(value_str_p); LV_ASSERT_MEM(value_str_p);
if(value_str_p != NULL) strcpy((char*)value_str_p, text); if(value_str_p != NULL) strcpy((char*)value_str_p, text);
lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p); lv_obj_set_style_value_str(obj, part, state, (char*)value_str_p);
} }
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
#endif
} }
void my_list_set_options(lv_obj_t* obj, const char* payload) void my_list_set_options(lv_obj_t* obj, const char* payload)
@ -572,7 +559,7 @@ static bool attribute_update_lv_property(lv_obj_t * obj, const char * attr_p, ui
if(prop_type < LV_STYLE_ID_COLOR) { if(prop_type < LV_STYLE_ID_COLOR) {
if(update) { if(update) {
_lv_obj_set_style_local_int(obj, part, prop | (state << LV_STYLE_STATE_POS), atoi(payload)) _lv_obj_set_style_int(obj, part, prop | (state << LV_STYLE_STATE_POS), atoi(payload))
} else { } else {
attr_out_str(obj, attr_p, lv_obj_get_style_value_str(obj, part)); attr_out_str(obj, attr_p, lv_obj_get_style_value_str(obj, part));
} }
@ -582,3 +569,4 @@ static bool attribute_update_lv_property(lv_obj_t * obj, const char * attr_p, ui
} }
} }
#endif #endif
#endif // LVGL_VERSION_MAJOR == 7

View File

@ -27,33 +27,41 @@
#include "hasplib.h" #include "hasplib.h"
#if LVGL_VERSION_MAJOR == 7
#include "lv_core/lv_obj.h" // for tabview ext #include "lv_core/lv_obj.h" // for tabview ext
#else
#include "core/lv_obj.h" // for tabview ext
#endif
static lv_style_int_t last_value_sent; static lv_style_int_t last_value_sent;
static lv_color_t last_color_sent; static lv_color_t last_color_sent;
void swipe_event_handler(lv_obj_t* obj, lv_event_t event); void swipe_event_handler(lv_event_t* e);
/** /**
* Clean-up allocated memory before an object is deleted * Clean-up allocated memory before an object is deleted
* @param obj pointer to an object to clean-up * @param obj pointer to an object to clean-up
*/ */
void delete_event_handler(lv_obj_t* obj, lv_event_t event) void delete_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
if(event != LV_EVENT_DELETE) return; if(event != LV_EVENT_DELETE) return;
switch(obj_get_type(obj)) { switch(obj_get_type(obj)) {
case LV_HASP_LINE: // case LV_HASP_LINE:
line_clear_points(obj); // line_clear_points(obj);
break; // break;
case LV_HASP_BTNMATRIX: // case LV_HASP_BTNMATRIX:
my_btnmatrix_map_clear(obj); // my_btnmatrix_map_clear(obj);
break; // break;
case LV_HASP_MSGBOX: // case LV_HASP_MSGBOX:
my_msgbox_map_clear(obj); // my_msgbox_map_clear(obj);
break; // break;
case LV_HASP_IMAGE: case LV_HASP_IMAGE:
lv_img_cache_invalidate_src(NULL); lv_img_cache_invalidate_src(NULL);
@ -67,11 +75,11 @@ void delete_event_handler(lv_obj_t* obj, lv_event_t event)
} }
// TODO: delete value_str data for ALL parts // TODO: delete value_str data for ALL parts
my_obj_set_value_str_text(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, NULL); // V8 my_obj_set_value_str_text(obj, LV_PART_MAIN| LV_STATE_DEFAULT, NULL);
} }
/* ============================== Timer Event ============================ */ /* ============================== Timer Event ============================ */
void event_timer_calendar(lv_task_t* task) void event_timer_calendar(lv_timer_t* task)
{ {
hasp_task_user_data_t* data = (hasp_task_user_data_t*)task->user_data; hasp_task_user_data_t* data = (hasp_task_user_data_t*)task->user_data;
lv_obj_t* obj = NULL; lv_obj_t* obj = NULL;
@ -79,7 +87,7 @@ void event_timer_calendar(lv_task_t* task)
if(data) obj = hasp_find_obj_from_page_id(data->pageid, data->objid); if(data) obj = hasp_find_obj_from_page_id(data->pageid, data->objid);
if(!obj || !data || !obj_check_type(obj, LV_HASP_CALENDER)) { if(!obj || !data || !obj_check_type(obj, LV_HASP_CALENDER)) {
if(data) lv_mem_free(data); // the object that the user_data points to is gone if(data) lv_mem_free(data); // the object that the user_data points to is gone
lv_task_del(task); // the calendar object for this task was deleted lv_timer_del(task); // the calendar object for this task was deleted
LOG_WARNING(TAG_EVENT, "event_timer_calendar could not find the linked object"); LOG_WARNING(TAG_EVENT, "event_timer_calendar could not find the linked object");
return; return;
} }
@ -93,13 +101,13 @@ void event_timer_calendar(lv_task_t* task)
(void)rslt; // unused (void)rslt; // unused
if(timeinfo->tm_year < 120) { if(timeinfo->tm_year < 120) {
lv_task_set_period(task, 60000); // try again in a minute lv_timer_set_period(task, 60000); // try again in a minute
LOG_WARNING(TAG_EVENT, "event_timer_calendar could not sync the clock"); LOG_WARNING(TAG_EVENT, "event_timer_calendar could not sync the clock");
return; return;
} else { } else {
uint32_t next_hour = (3600 - (t % 3600)) * 1000; // ms to next top of hour uint32_t next_hour = (3600 - (t % 3600)) * 1000; // ms to next top of hour
// lv_task_set_period(task, next_hour + 128); // small offset so all tasks don't run at once // lv_timer_set_period(task, next_hour + 128); // small offset so all tasks don't run at once
lv_task_set_period(task, data->interval); lv_timer_set_period(task, data->interval);
} }
date.day = timeinfo->tm_mday; date.day = timeinfo->tm_mday;
@ -109,10 +117,10 @@ void event_timer_calendar(lv_task_t* task)
LOG_VERBOSE(TAG_EVENT, "event_timer_calendar called with user %d:%d:%d", timeinfo->tm_hour, timeinfo->tm_min, LOG_VERBOSE(TAG_EVENT, "event_timer_calendar called with user %d:%d:%d", timeinfo->tm_hour, timeinfo->tm_min,
timeinfo->tm_sec); timeinfo->tm_sec);
lv_calendar_set_today_date(obj, &date); lv_calendar_set_today_date(obj, date.year, date.month, date.day);
} }
void event_timer_clock(lv_task_t* task) void event_timer_clock(lv_timer_t* task)
{ {
hasp_task_user_data_t* data = (hasp_task_user_data_t*)task->user_data; hasp_task_user_data_t* data = (hasp_task_user_data_t*)task->user_data;
lv_obj_t* obj; lv_obj_t* obj;
@ -120,7 +128,7 @@ void event_timer_clock(lv_task_t* task)
if(data) obj = hasp_find_obj_from_page_id(data->pageid, data->objid); if(data) obj = hasp_find_obj_from_page_id(data->pageid, data->objid);
if(!obj || !data) { if(!obj || !data) {
if(data) lv_mem_free(data); // the object that the user_data points to is gone if(data) lv_mem_free(data); // the object that the user_data points to is gone
lv_task_del(task); // the calendar object for this task was deleted lv_timer_del(task); // the calendar object for this task was deleted
LOG_WARNING(TAG_EVENT, "event_timer_clock could not find the linked object"); LOG_WARNING(TAG_EVENT, "event_timer_clock could not find the linked object");
return; return;
} }
@ -142,11 +150,11 @@ void event_timer_clock(lv_task_t* task)
// timeinfo->tm_sec); // timeinfo->tm_sec);
lv_label_set_text(obj, buffer); lv_label_set_text(obj, buffer);
lv_task_set_period(task, data->interval); lv_timer_set_period(task, data->interval);
} }
/* ============================== Timer Event ============================ */ /* ============================== Timer Event ============================ */
void event_timer_refresh(lv_task_t* task) void event_timer_refresh(lv_timer_t* task)
{ {
lv_obj_t* obj = (lv_obj_t*)task->user_data; lv_obj_t* obj = (lv_obj_t*)task->user_data;
printf("event_timer_refresh called with user data\n"); printf("event_timer_refresh called with user data\n");
@ -168,16 +176,19 @@ void event_timer_refresh(lv_task_t* task)
* @param event type of event that occured * @param event type of event that occured
* @param eventid returns the hasp eventid * @param eventid returns the hasp eventid
*/ */
static bool translate_event(lv_obj_t* obj, lv_event_t event, uint8_t& eventid) static bool translate_event(lv_event_t* e, uint8_t& eventid)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
switch(event) { switch(event) {
case LV_EVENT_GESTURE: case LV_EVENT_GESTURE:
swipe_event_handler(obj, event); swipe_event_handler(e);
break; break;
case LV_EVENT_DELETE: case LV_EVENT_DELETE:
LOG_VERBOSE(TAG_EVENT, F(D_OBJECT_DELETED)); LOG_VERBOSE(TAG_EVENT, F(D_OBJECT_DELETED));
delete_event_handler(obj, event); delete_event_handler(e);
break; break;
case LV_EVENT_PRESSED: case LV_EVENT_PRESSED:
@ -247,7 +258,7 @@ static inline void event_update_group(uint8_t group, lv_obj_t* obj, bool power,
dispatch_normalized_group_values(value); dispatch_normalized_group_values(value);
} }
static void log_event(const char* name, lv_event_t event) static void log_event(const char* name, lv_event_code_t event)
{ {
return; return;
@ -309,8 +320,11 @@ static void log_event(const char* name, lv_event_t event)
* @param obj pointer to a button matrix * @param obj pointer to a button matrix
* @param event type of event that occured * @param event type of event that occured
*/ */
void wakeup_event_handler(lv_obj_t* obj, lv_event_t event) void wakeup_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
// log_event("wakeup", event); // log_event("wakeup", event);
if(event == LV_EVENT_RELEASED && obj == lv_disp_get_layer_sys(NULL)) { if(event == LV_EVENT_RELEASED && obj == lv_disp_get_layer_sys(NULL)) {
@ -322,20 +336,23 @@ void wakeup_event_handler(lv_obj_t* obj, lv_event_t event)
} }
} }
void swipe_event_handler(lv_obj_t* obj, lv_event_t event) void swipe_event_handler(lv_event_t* e)
{ {
if(!obj || obj->user_data.swipeid == 0) return; lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
if(!obj || !user_data || user_data->swipeid == 0) return; // no swipe set
if(event == LV_EVENT_GESTURE) { if(event == LV_EVENT_GESTURE) {
lv_gesture_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act()); lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act());
switch(dir) { switch(dir) {
case LV_GESTURE_DIR_LEFT: case LV_DIR_LEFT:
haspPages.next(LV_SCR_LOAD_ANIM_NONE); haspPages.next(LV_SCR_LOAD_ANIM_NONE);
break; break;
case LV_GESTURE_DIR_RIGHT: case LV_DIR_RIGHT:
haspPages.prev(LV_SCR_LOAD_ANIM_NONE); haspPages.prev(LV_SCR_LOAD_ANIM_NONE);
break; break;
case LV_GESTURE_DIR_BOTTOM: case LV_DIR_BOTTOM:
haspPages.back(LV_SCR_LOAD_ANIM_NONE); haspPages.back(LV_SCR_LOAD_ANIM_NONE);
break; break;
default: default:
@ -350,13 +367,16 @@ void swipe_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a button object * @param obj pointer to a button object
* @param event type of event that occured * @param event type of event that occured
*/ */
void generic_event_handler(lv_obj_t* obj, lv_event_t event) void generic_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("generic", event); log_event("generic", event);
switch(event) { switch(event) {
case LV_EVENT_GESTURE: case LV_EVENT_GESTURE:
swipe_event_handler(obj, event); swipe_event_handler(e);
return; return;
case LV_EVENT_PRESSED: case LV_EVENT_PRESSED:
@ -394,9 +414,33 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event)
case LV_EVENT_DELETE: case LV_EVENT_DELETE:
LOG_VERBOSE(TAG_EVENT, F(D_OBJECT_DELETED)); LOG_VERBOSE(TAG_EVENT, F(D_OBJECT_DELETED));
delete_event_handler(obj, event); // free and destroy persistent memory allocated for certain objects delete_event_handler(e); // free and destroy persistent memory allocated for certain objects
return; return;
case LV_EVENT_COVER_CHECK: /**< Check if the object fully covers an area. The event parameter is
*`lv_cover_check_info_t
*`.*/
case LV_EVENT_REFR_EXT_DRAW_SIZE: /**< Get the required extra draw area around the object (e.g. for shadow). The
event parameter is `lv_coord_t *` to store the size.*/
case LV_EVENT_DRAW_MAIN_BEGIN: /**< Starting the main drawing phase*/
case LV_EVENT_DRAW_MAIN: /**< Perform the main drawing*/
case LV_EVENT_DRAW_MAIN_END: /**< Finishing the main drawing phase*/
case LV_EVENT_DRAW_POST_BEGIN: /**< Starting the post draw phase (when all children are drawn)*/
case LV_EVENT_DRAW_POST: /**< Perform the post draw phase (when all children are drawn)*/
case LV_EVENT_DRAW_POST_END: /**< Finishing the post draw phase (when all children are drawn)*/
case LV_EVENT_DRAW_PART_BEGIN: /**< Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t
*`. */
case LV_EVENT_DRAW_PART_END: /**< Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`.
*/
return; // drawing events
case LV_EVENT_CHILD_CHANGED: /**< Child was removed/added*/
case LV_EVENT_SIZE_CHANGED: /**< Object coordinates/size have changed*/
case LV_EVENT_STYLE_CHANGED: /**< Object's style has changed*/
case LV_EVENT_LAYOUT_CHANGED: /**< The children position has changed due to a layout recalculation*/
case LV_EVENT_GET_SELF_SIZE: /**< Get the internal size of a widget*/
return; // special events
case LV_EVENT_PRESSING: case LV_EVENT_PRESSING:
case LV_EVENT_FOCUSED: case LV_EVENT_FOCUSED:
case LV_EVENT_DEFOCUSED: case LV_EVENT_DEFOCUSED:
@ -411,10 +455,11 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event)
if(last_value_sent == HASP_EVENT_LOST) return; if(last_value_sent == HASP_EVENT_LOST) return;
/* If an actionid is attached, perform that action on UP event only */ /* If an actionid is attached, perform that action on UP event only */
if(obj->user_data.actionid) { lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
if(user_data->actionid) {
if(last_value_sent == HASP_EVENT_UP || last_value_sent == HASP_EVENT_RELEASE) { if(last_value_sent == HASP_EVENT_UP || last_value_sent == HASP_EVENT_RELEASE) {
lv_scr_load_anim_t transitionid = (lv_scr_load_anim_t)obj->user_data.transitionid; lv_scr_load_anim_t transitionid = (lv_scr_load_anim_t)user_data->transitionid;
switch(obj->user_data.actionid) { switch(user_data->actionid) {
case HASP_NUM_PAGE_PREV: case HASP_NUM_PAGE_PREV:
haspPages.prev(transitionid); haspPages.prev(transitionid);
break; break;
@ -425,7 +470,7 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event)
haspPages.next(transitionid); haspPages.next(transitionid);
break; break;
default: default:
haspPages.set(obj->user_data.actionid, transitionid); haspPages.set(user_data->actionid, transitionid);
} }
dispatch_current_page(); dispatch_current_page();
} }
@ -439,8 +484,9 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event)
// Update group objects and gpios on release // Update group objects and gpios on release
if(last_value_sent != LV_EVENT_LONG_PRESSED || last_value_sent != LV_EVENT_LONG_PRESSED_REPEAT) { if(last_value_sent != LV_EVENT_LONG_PRESSED || last_value_sent != LV_EVENT_LONG_PRESSED_REPEAT) {
bool state = Parser::get_event_state(last_value_sent); bool state = Parser::get_event_state(last_value_sent);
event_update_group(obj->user_data.groupid, obj, state, state, HASP_EVENT_OFF, HASP_EVENT_ON); lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
event_update_group(user_data->groupid, obj, state, state, HASP_EVENT_OFF, HASP_EVENT_ON);
} }
} }
@ -449,16 +495,20 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a switch object * @param obj pointer to a switch object
* @param event type of event that occured * @param event type of event that occured
*/ */
void toggle_event_handler(lv_obj_t* obj, lv_event_t event) void toggle_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("toggle", event); log_event("toggle", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(!translate_event(obj, event, hasp_event_id)) return; if(!translate_event(e, hasp_event_id)) return;
if(hasp_event_id != HASP_EVENT_DOWN && hasp_event_id != HASP_EVENT_UP) return; // only up or down wanted if(hasp_event_id != HASP_EVENT_DOWN && hasp_event_id != HASP_EVENT_UP) return; // only up or down wanted
/* Get the new value */ /* Get the new value */
switch(obj->user_data.objid) { lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
switch(user_data->objid) {
case LV_HASP_SWITCH: case LV_HASP_SWITCH:
last_value_sent = lv_switch_get_state(obj); last_value_sent = lv_switch_get_state(obj);
break; break;
@ -466,12 +516,12 @@ void toggle_event_handler(lv_obj_t* obj, lv_event_t event)
/* case LV_HASP_CHECKBOX: /* case LV_HASP_CHECKBOX:
// This lvgl value is incorrect, it returns pressed instead of checked // This lvgl value is incorrect, it returns pressed instead of checked
// last_value_sent = lv_checkbox_is_checked(obj); // last_value_sent = lv_checkbox_is_checked(obj);
last_value_sent = lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_CHECKED; last_value_sent = lv_obj_get_state(obj) & LV_STATE_CHECKED;
break; */ break; */
case LV_HASP_CHECKBOX: case LV_HASP_CHECKBOX:
case LV_HASP_BUTTON: { case LV_HASP_BUTTON: {
last_value_sent = lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_CHECKED; last_value_sent = lv_obj_get_state(obj) & LV_STATE_CHECKED;
break; break;
} }
@ -482,9 +532,8 @@ void toggle_event_handler(lv_obj_t* obj, lv_event_t event)
event_object_val_event(obj, hasp_event_id, last_value_sent); event_object_val_event(obj, hasp_event_id, last_value_sent);
// Update group objects and gpios on release // Update group objects and gpios on release
if(obj->user_data.groupid && hasp_event_id == HASP_EVENT_UP) { if(user_data->groupid && hasp_event_id == HASP_EVENT_UP) {
event_update_group(obj->user_data.groupid, obj, last_value_sent, last_value_sent, HASP_EVENT_OFF, event_update_group(user_data->groupid, obj, last_value_sent, last_value_sent, HASP_EVENT_OFF, HASP_EVENT_ON);
HASP_EVENT_ON);
} }
} }
@ -493,12 +542,15 @@ void toggle_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a dropdown list or roller * @param obj pointer to a dropdown list or roller
* @param event type of event that occured * @param event type of event that occured
*/ */
void selector_event_handler(lv_obj_t* obj, lv_event_t event) void selector_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("selector", event); log_event("selector", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED
/* Get the new value */ /* Get the new value */
char buffer[128]; char buffer[128];
@ -507,7 +559,8 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event)
uint16_t max = 0; uint16_t max = 0;
/* Get the text, val and max properties */ /* Get the text, val and max properties */
switch(obj->user_data.objid) { lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
switch(user_data->objid) {
case LV_HASP_DROPDOWN: case LV_HASP_DROPDOWN:
val = lv_dropdown_get_selected(obj); val = lv_dropdown_get_selected(obj);
max = lv_dropdown_get_option_cnt(obj) - 1; max = lv_dropdown_get_option_cnt(obj) - 1;
@ -521,26 +574,26 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event)
break; break;
case LV_HASP_TABVIEW: { case LV_HASP_TABVIEW: {
val = lv_tabview_get_tab_act(obj); // val = lv_tabview_get_tab_act(obj);
max = lv_tabview_get_tab_count(obj) - 1; // max = lv_tabview_get_tab_count(obj) - 1;
lv_tabview_ext_t* ext = (lv_tabview_ext_t*)lv_obj_get_ext_attr(obj); // lv_tabview_ext_t* ext = (lv_tabview_ext_t*)lv_obj_get_ext_attr(obj);
strcpy(buffer, ext->tab_name_ptr[val]); // strcpy(buffer, ext->tab_name_ptr[val]);
break; break;
} }
case LV_HASP_TABLE: { // case LV_HASP_TABLE: {
uint16_t row; // uint16_t row;
uint16_t col; // uint16_t col;
if(lv_table_get_pressed_cell(obj, &row, &col) != LV_RES_OK) return; // outside any cell // // if(lv_table_get_pressed_cell(obj, &row, &col) != LV_RES_OK) return; // outside any cell
const char* txt = lv_table_get_cell_value(obj, row, col); // const char* txt = lv_table_get_cell_value(obj, row, col);
strncpy(buffer, txt, sizeof(buffer)); // strncpy(buffer, txt, sizeof(buffer));
snprintf_P(property, sizeof(property), PSTR("row\":%d,\"col\":%d,\"text"), row, col); // snprintf_P(property, sizeof(property), PSTR("row\":%d,\"col\":%d,\"text"), row, col);
attr_out_str(obj, property, buffer); // attr_out_str(obj, property, buffer);
return; // done sending // return; // done sending
} // }
default: default:
return; // Invalid selector type return; // Invalid selector type
@ -550,9 +603,9 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event)
last_value_sent = val; last_value_sent = val;
event_object_selection_changed(obj, hasp_event_id, val, buffer); event_object_selection_changed(obj, hasp_event_id, val, buffer);
if(obj->user_data.groupid && max > 0) // max a cannot be 0, its the divider if(user_data->groupid && max > 0) // max a cannot be 0, its the divider
if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == LV_EVENT_VALUE_CHANGED) { if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == LV_EVENT_VALUE_CHANGED) {
event_update_group(obj->user_data.groupid, obj, !!last_value_sent, last_value_sent, 0, max); event_update_group(user_data->groupid, obj, !!last_value_sent, last_value_sent, 0, max);
} }
// set the property // set the property
@ -565,18 +618,21 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a dropdown list or roller * @param obj pointer to a dropdown list or roller
* @param event type of event that occured * @param event type of event that occured
*/ */
void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event) void btnmatrix_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("btnmatrix", event); log_event("btnmatrix", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED
/* Get the new value */ /* Get the new value */
char buffer[128]; char buffer[128];
uint16_t val = 0; uint16_t val = 0;
val = lv_btnmatrix_get_active_btn(obj); // val = lv_btnmatrix_get_active_btn(obj);
if(val != LV_BTNMATRIX_BTN_NONE) { if(val != LV_BTNMATRIX_BTN_NONE) {
const char* txt = lv_btnmatrix_get_btn_text(obj, val); const char* txt = lv_btnmatrix_get_btn_text(obj, val);
strncpy(buffer, txt, sizeof(buffer)); strncpy(buffer, txt, sizeof(buffer));
@ -591,7 +647,7 @@ void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event)
// if(max > 0) // max a cannot be 0, its the divider // if(max > 0) // max a cannot be 0, its the divider
// if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == LV_EVENT_VALUE_CHANGED) { // if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == LV_EVENT_VALUE_CHANGED) {
// event_update_group(obj->user_data.groupid, obj, last_value_sent, 0, max); // event_update_group(user_data->groupid, obj, last_value_sent, 0, max);
// } // }
} }
@ -600,22 +656,25 @@ void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a dropdown list or roller * @param obj pointer to a dropdown list or roller
* @param event type of event that occured * @param event type of event that occured
*/ */
void msgbox_event_handler(lv_obj_t* obj, lv_event_t event) void msgbox_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = lv_event_get_current_target(e);
log_event("msgbox", event); log_event("msgbox", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED
/* Get the new value */ /* Get the new value */
char buffer[128]; char buffer[128];
uint16_t val = 0; uint16_t val = 0;
val = lv_msgbox_get_active_btn(obj); // val = lv_msgbox_get_active_btn(obj);
if(val != LV_BTNMATRIX_BTN_NONE) { if(val != LV_BTNMATRIX_BTN_NONE) {
const char* txt = lv_msgbox_get_active_btn_text(obj); const char* txt = lv_msgbox_get_active_btn_text(obj);
strncpy(buffer, txt, sizeof(buffer)); strncpy(buffer, txt, sizeof(buffer));
if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == HASP_EVENT_RELEASE) lv_msgbox_start_auto_close(obj, 0); if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == HASP_EVENT_RELEASE) lv_msgbox_close(obj);
} else { } else {
buffer[0] = 0; // empty string buffer[0] = 0; // empty string
} }
@ -624,7 +683,7 @@ void msgbox_event_handler(lv_obj_t* obj, lv_event_t event)
last_value_sent = val; last_value_sent = val;
event_object_selection_changed(obj, hasp_event_id, val, buffer); event_object_selection_changed(obj, hasp_event_id, val, buffer);
// if(max > 0) event_update_group(obj->user_data.groupid, obj, val, 0, max); // if(max > 0) event_update_group(user_data->groupid, obj, val, 0, max);
} }
/** /**
@ -632,28 +691,30 @@ void msgbox_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a slider * @param obj pointer to a slider
* @param event type of event that occured * @param event type of event that occured
*/ */
void slider_event_handler(lv_obj_t* obj, lv_event_t event) void slider_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("slider", event); log_event("slider", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(!translate_event(obj, event, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return; if(!translate_event(e, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return;
/* Get the new value */ /* Get the new value */
int16_t val; int16_t val;
int16_t min; int16_t min;
int16_t max; int16_t max;
if(obj->user_data.objid == LV_HASP_SLIDER) { lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
if(user_data->objid == LV_HASP_SLIDER) {
val = lv_slider_get_value(obj); val = lv_slider_get_value(obj);
min = lv_slider_get_min_value(obj); min = lv_slider_get_min_value(obj);
max = lv_slider_get_max_value(obj); max = lv_slider_get_max_value(obj);
} else if(user_data->objid == LV_HASP_ARC) {
} else if(obj->user_data.objid == LV_HASP_ARC) {
val = lv_arc_get_value(obj); val = lv_arc_get_value(obj);
min = lv_arc_get_min_value(obj); min = lv_arc_get_min_value(obj);
max = lv_arc_get_max_value(obj); max = lv_arc_get_max_value(obj);
} else { } else {
return; // not a slider return; // not a slider
} }
@ -663,8 +724,8 @@ void slider_event_handler(lv_obj_t* obj, lv_event_t event)
last_value_sent = val; last_value_sent = val;
event_object_val_event(obj, hasp_event_id, val); event_object_val_event(obj, hasp_event_id, val);
if(obj->user_data.groupid && (hasp_event_id == HASP_EVENT_CHANGED || hasp_event_id == HASP_EVENT_UP) && min != max) if(user_data->groupid && (hasp_event_id == HASP_EVENT_CHANGED || hasp_event_id == HASP_EVENT_UP) && min != max)
event_update_group(obj->user_data.groupid, obj, !!val, val, min, max); event_update_group(user_data->groupid, obj, !!val, val, min, max);
} }
/** /**
@ -672,12 +733,15 @@ void slider_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a color picker * @param obj pointer to a color picker
* @param event type of event that occured * @param event type of event that occured
*/ */
void cpicker_event_handler(lv_obj_t* obj, lv_event_t event) void cpicker_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("cpicker", event); log_event("cpicker", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(!translate_event(obj, event, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return; if(!translate_event(e, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return;
/* Get the new value */ /* Get the new value */
lv_color_t color = lv_cpicker_get_color(obj); lv_color_t color = lv_cpicker_get_color(obj);
@ -696,23 +760,26 @@ void cpicker_event_handler(lv_obj_t* obj, lv_event_t event)
eventname, c32.ch.red, c32.ch.green, c32.ch.blue, c32.ch.red, c32.ch.green, c32.ch.blue); eventname, c32.ch.red, c32.ch.green, c32.ch.blue, c32.ch.red, c32.ch.green, c32.ch.blue);
event_send_object_data(obj, data); event_send_object_data(obj, data);
// event_update_group(obj->user_data.groupid, obj, val, min, max); // event_update_group(user_data->groupid, obj, val, min, max);
} }
void calendar_event_handler(lv_obj_t* obj, lv_event_t event) void calendar_event_handler(lv_event_t* e)
{ {
lv_event_code_t event = lv_event_get_code(e);
lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
log_event("calendar", event); log_event("calendar", event);
uint8_t hasp_event_id; uint8_t hasp_event_id;
if(event != LV_EVENT_PRESSED && event != LV_EVENT_RELEASED && event != LV_EVENT_VALUE_CHANGED) return; if(event != LV_EVENT_PRESSED && event != LV_EVENT_RELEASED && event != LV_EVENT_VALUE_CHANGED) return;
if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED
/* Get the new value */ /* Get the new value */
lv_calendar_date_t* date; lv_calendar_date_t* date;
if(hasp_event_id == HASP_EVENT_CHANGED) if(hasp_event_id == HASP_EVENT_CHANGED)
date = lv_calendar_get_pressed_date(obj); // pressed date lv_calendar_get_pressed_date(obj, date); // pressed date
else else
date = lv_calendar_get_showed_date(obj); // current month date = (lv_calendar_date_t*)lv_calendar_get_showed_date(obj); // current month
if(!date) return; if(!date) return;
lv_style_int_t val = date->day + date->month * 31; lv_style_int_t val = date->day + date->month * 31;
@ -728,5 +795,5 @@ void calendar_event_handler(lv_obj_t* obj, lv_event_t event)
eventname, date->day, date->year, date->month, date->day); eventname, date->day, date->year, date->month, date->day);
event_send_object_data(obj, data); event_send_object_data(obj, data);
// event_update_group(obj->user_data.groupid, obj, val, min, max); // event_update_group(user_data->groupid, obj, val, min, max);
} }

View File

@ -11,20 +11,22 @@
#define HASP_NUM_PAGE_BACK (HASP_NUM_PAGES + 2) #define HASP_NUM_PAGE_BACK (HASP_NUM_PAGES + 2)
#define HASP_NUM_PAGE_NEXT (HASP_NUM_PAGES + 3) #define HASP_NUM_PAGE_NEXT (HASP_NUM_PAGES + 3)
#define lv_task_t lv_timer_t
// Timer event Handlers // Timer event Handlers
void event_timer_calendar(lv_task_t* task); void event_timer_calendar(lv_task_t* task);
void event_timer_clock(lv_task_t* task); void event_timer_clock(lv_task_t* task);
// Object event Handlers // Object event Handlers
void delete_event_handler(lv_obj_t* obj, lv_event_t event); void delete_event_handler(lv_event_t* e);
void wakeup_event_handler(lv_obj_t* obj, lv_event_t event); void wakeup_event_handler(lv_event_t* e);
void generic_event_handler(lv_obj_t* obj, lv_event_t event); void generic_event_handler(lv_event_t* e);
void toggle_event_handler(lv_obj_t* obj, lv_event_t event); void toggle_event_handler(lv_event_t* e);
void slider_event_handler(lv_obj_t* obj, lv_event_t event); void slider_event_handler(lv_event_t* e);
void selector_event_handler(lv_obj_t* obj, lv_event_t event); void selector_event_handler(lv_event_t* e);
void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event); void btnmatrix_event_handler(lv_event_t* e);
void msgbox_event_handler(lv_obj_t* obj, lv_event_t event); void msgbox_event_handler(lv_event_t* e);
void cpicker_event_handler(lv_obj_t* obj, lv_event_t event); void cpicker_event_handler(lv_event_t* e);
void calendar_event_handler(lv_obj_t* obj, lv_event_t event); void calendar_event_handler(lv_event_t* e);
#endif // HASP_EVENT_H #endif // HASP_EVENT_H

View File

@ -22,16 +22,34 @@ const char* msgbox_default_map[] = {"OK", ""}; // memory pointer to hasp default
// ##################### Object Finders ######################################################## // ##################### Object Finders ########################################################
static inline uint8_t hasp_get_id(const lv_obj_t* obj)
{
if(!obj || !obj->user_data) return 0;
return ((lv_obj_user_data_t*)obj->user_data)->id;
}
static inline uint8_t hasp_get_objid(const lv_obj_t* obj)
{
if(!obj || !obj->user_data) return 0;
return ((lv_obj_user_data_t*)obj->user_data)->objid;
}
static inline uint8_t hasp_get_groupid(const lv_obj_t* obj)
{
if(!obj || !obj->user_data) return 0;
return ((lv_obj_user_data_t*)obj->user_data)->groupid;
}
// Return a child object from a parent with a specific objid // Return a child object from a parent with a specific objid
lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid) lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid)
{ {
if(objid == 0 || parent == nullptr) return parent; if(objid == 0 || parent == nullptr) return parent;
lv_obj_t* child; for(uint32_t i = 0; i < lv_obj_get_child_cnt(parent); i++) {
child = lv_obj_get_child(parent, NULL); lv_obj_t* child = lv_obj_get_child(parent, i);
while(child) {
/* child found, return it */ /* child found, return it */
if(objid == child->user_data.id) return child; if(objid == hasp_get_id(child)) return child;
/* check grandchildren */ /* check grandchildren */
lv_obj_t* grandchild = hasp_find_obj_from_parent_id(child, objid); lv_obj_t* grandchild = hasp_find_obj_from_parent_id(child, objid);
@ -39,21 +57,19 @@ lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid)
/* check tabs */ /* check tabs */
if(obj_check_type(child, LV_HASP_TABVIEW)) { if(obj_check_type(child, LV_HASP_TABVIEW)) {
uint16_t tabcount = lv_tabview_get_tab_count(child); // uint16_t tabcount = lv_tabview_get_tab_count(child);
for(uint16_t i = 0; i < tabcount; i++) { // for(uint16_t i = 0; i < tabcount; i++) {
lv_obj_t* tab = lv_tabview_get_tab(child, i); // lv_obj_t* tab = lv_tabview_get_tab(child, i);
LOG_VERBOSE(TAG_HASP, "Found tab %i", i); // LOG_VERBOSE(TAG_HASP, "Found tab %i", i);
if(tab->user_data.objid && objid == tab->user_data.objid) return tab; /* tab found, return it */ // if(tab->user_data && objid == hasp_get_objid(tab)) return tab; /* tab found, return it */
/* check grandchildren */ // /* check grandchildren */
grandchild = hasp_find_obj_from_parent_id(tab, objid); // grandchild = hasp_find_obj_from_parent_id(tab, objid);
if(grandchild) return grandchild; /* grandchild found, return it */ // if(grandchild) return grandchild; /* grandchild found, return it */
} // }
} }
/* try next sibling */
child = lv_obj_get_child(parent, child);
} }
return NULL; return NULL;
} }
@ -67,8 +83,8 @@ lv_obj_t* hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid)
bool hasp_find_id_from_obj(const lv_obj_t* obj, uint8_t* pageid, uint8_t* objid) bool hasp_find_id_from_obj(const lv_obj_t* obj, uint8_t* pageid, uint8_t* objid)
{ {
if(!obj || !haspPages.get_id(obj, pageid)) return false; if(!obj || !haspPages.get_id(obj, pageid)) return false;
if(obj->user_data.id == 0 && obj != haspPages.get_obj(*pageid)) return false; if(hasp_get_id(obj) == 0 && obj != haspPages.get_obj(*pageid)) return false;
*objid = obj->user_data.id; *objid = hasp_get_id(obj);
return true; return true;
} }
@ -78,32 +94,28 @@ void hasp_object_tree(const lv_obj_t* parent, uint8_t pageid, uint16_t level)
/* Output parent info */ /* Output parent info */
char indent[31]; char indent[31];
memset(indent, 32, 31); memset(indent, 0x20, 31);
if(level < 15) indent[level * 2] = 0; if(level < 15) indent[level * 2] = 0;
indent[30] = 0; indent[30] = 0;
LOG_VERBOSE(TAG_HASP, F("%s- " HASP_OBJECT_NOTATION ": %s"), indent, pageid, parent->user_data.id, LOG_VERBOSE(TAG_HASP, F("%s- " HASP_OBJECT_NOTATION ": %s"), indent, pageid, hasp_get_id(parent),
obj_get_type_name(parent)); obj_get_type_name(parent));
lv_obj_t* child; uint32_t i;
child = lv_obj_get_child(parent, NULL); for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
while(child) { lv_obj_t* child = lv_obj_get_child(parent, i);
/* child found, process it */
hasp_object_tree(child, pageid, level + 1); hasp_object_tree(child, pageid, level + 1);
/* try next sibling */
child = lv_obj_get_child(parent, child);
} }
/* check tabs */ /* check tabs */
if(obj_check_type(parent, LV_HASP_TABVIEW)) { if(obj_check_type(parent, LV_HASP_TABVIEW)) {
#if 1 #if 1
uint16_t tabcount = lv_tabview_get_tab_count(parent); // uint16_t tabcount = lv_tabview_get_tab_count(parent);
for(uint16_t i = 0; i < tabcount; i++) { // for(uint16_t i = 0; i < tabcount; i++) {
lv_obj_t* tab = lv_tabview_get_tab(parent, i); // lv_obj_t* tab = lv_tabview_get_tab(parent, i);
LOG_VERBOSE(TAG_HASP, "Found tab %i", i); // LOG_VERBOSE(TAG_HASP, "Found tab %i", i);
if(tab->user_data.objid) hasp_object_tree(tab, pageid, level + 1); // if(tab->user_data.objid) hasp_object_tree(tab, pageid, level + 1);
} // }
#endif #endif
} }
} }
@ -126,23 +138,22 @@ void object_set_group_values(lv_obj_t* parent, hasp_update_value_t& value)
if(parent == nullptr) return; if(parent == nullptr) return;
// Update object if it's in the same group // Update object if it's in the same group
if(value.group == parent->user_data.groupid && value.obj != parent) { if(value.group == hasp_get_groupid(parent) && value.obj != parent) {
attribute_set_normalized_value(parent, value); // attribute_set_normalized_value(parent, value);
} }
/* check tabs */ /* check tabs */
if(obj_get_type(parent) == LV_HASP_TABVIEW) { if(obj_get_type(parent) == LV_HASP_TABVIEW) {
uint16_t tabcount = lv_tabview_get_tab_count(parent); // uint16_t tabcount = lv_tabview_get_tab_count(parent);
for(uint16_t i = 0; i < tabcount; i++) { // for(uint16_t i = 0; i < tabcount; i++) {
lv_obj_t* tab = lv_tabview_get_tab(parent, i); // lv_obj_t* tab = lv_tabview_get_tab(parent, i);
object_set_group_values(tab, value); // object_set_group_values(tab, value);
} // }
} else { } else {
lv_obj_t* child; uint32_t i;
child = lv_obj_get_child(parent, NULL); for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
while(child) { lv_obj_t* child = lv_obj_get_child(parent, i);
object_set_group_values(child, value); object_set_group_values(child, value);
child = lv_obj_get_child(parent, child);
} }
} }
} }
@ -205,7 +216,7 @@ static inline int hasp_parse_json_attributes(lv_obj_t* obj, const JsonObject& do
return i; return i;
} }
static void object_add_task(lv_obj_t* obj, uint8_t pageid, uint8_t objid, lv_task_cb_t task_xcb, uint16_t interval) static void object_add_task(lv_obj_t* obj, uint8_t pageid, uint8_t objid, lv_timer_cb_t task_xcb, uint16_t interval)
{ {
hasp_task_user_data_t* user_data = (hasp_task_user_data_t*)lv_mem_alloc(sizeof(hasp_task_user_data_t)); hasp_task_user_data_t* user_data = (hasp_task_user_data_t*)lv_mem_alloc(sizeof(hasp_task_user_data_t));
if(!user_data) return; if(!user_data) return;
@ -213,10 +224,29 @@ static void object_add_task(lv_obj_t* obj, uint8_t pageid, uint8_t objid, lv_tas
user_data->pageid = pageid; user_data->pageid = pageid;
user_data->objid = objid; user_data->objid = objid;
user_data->interval = interval; user_data->interval = interval;
lv_task_t* task = lv_task_create(task_xcb, 25, LV_TASK_PRIO_LOWEST, (void*)user_data); lv_timer_t* task = lv_timer_create(task_xcb, 25, (void*)user_data);
(void)task; // unused (void)task; // unused
} }
bool object_set_user_data(lv_obj_t* obj, uint8_t id, uint8_t objid)
{
if(!obj) return false;
if(!obj->user_data) obj->user_data = (lv_obj_user_data_t*)lv_mem_alloc(sizeof(lv_obj_user_data_t));
if(!obj->user_data) return false;
/* id tag the object */
lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
user_data->id = id;
user_data->objid = objid;
user_data->transitionid = 0;
user_data->actionid = 0;
user_data->groupid = 0;
user_data->swipeid = 0;
return true;
}
/** /**
* Create a new object according to the json config * Create a new object according to the json config
* @param config Json representation for this object * @param config Json representation for this object
@ -279,63 +309,70 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
config.remove(FPSTR(FP_OBJID)); config.remove(FPSTR(FP_OBJID));
} }
switch(sdbm) { uint8_t objid = 0;
/* ----- Basic Objects ------ */
case LV_HASP_BTNMATRIX:
case HASP_OBJ_BTNMATRIX:
obj = lv_btnmatrix_create(parent_obj, NULL);
if(obj) {
lv_btnmatrix_set_recolor(obj, true);
lv_obj_set_event_cb(obj, btnmatrix_event_handler);
lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj); switch(sdbm) {
btnmatrix_default_map = ext->map_p; // store the static pointer to the default lvgl btnmap /* ----- Basic Objects ------ */
obj->user_data.objid = LV_HASP_BTNMATRIX; // case LV_HASP_BTNMATRIX:
} // case HASP_OBJ_BTNMATRIX:
break; // objid = LV_HASP_BTNMATRIX;
// obj = lv_btnmatrix_create(parent_obj);
// if(obj) {
// lv_btnmatrix_set_recolor(obj, true);
// lv_obj_set_event_cb(obj, btnmatrix_event_handler);
// lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj);
// btnmatrix_default_map = ext->map_p; // store the static pointer to the default lvgl btnmap
// // obj->user_data.objid = LV_HASP_BTNMATRIX;
// }
// break;
case LV_HASP_TABLE: case LV_HASP_TABLE:
case HASP_OBJ_TABLE: case HASP_OBJ_TABLE:
obj = lv_table_create(parent_obj, NULL); objid = LV_HASP_TABLE;
obj = lv_table_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, selector_event_handler); lv_obj_set_event_cb(obj, selector_event_handler);
obj->user_data.objid = LV_HASP_TABLE; // obj->user_data.objid = LV_HASP_TABLE;
} }
break; break;
case LV_HASP_BUTTON: case LV_HASP_BUTTON:
case HASP_OBJ_BTN: case HASP_OBJ_BTN:
obj = lv_btn_create(parent_obj, NULL); objid = LV_HASP_BUTTON;
obj = lv_btn_create(parent_obj);
if(obj) { if(obj) {
lv_obj_t* lbl = lv_label_create(obj, NULL); lv_obj_t* lbl = lv_label_create(obj);
if(lbl) { if(lbl) {
lv_label_set_text(lbl, ""); lv_label_set_text(lbl, "");
lv_label_set_recolor(lbl, true); lv_label_set_recolor(lbl, true);
lbl->user_data.objid = LV_HASP_LABEL; object_set_user_data(lbl, 0, LV_HASP_LABEL);
lv_obj_align(lbl, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(lbl, LV_ALIGN_CENTER, 0, 0);
} }
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_BUTTON; // obj->user_data.objid = LV_HASP_BUTTON;
} }
break; break;
case LV_HASP_CHECKBOX: case LV_HASP_CHECKBOX:
case HASP_OBJ_CHECKBOX: case HASP_OBJ_CHECKBOX:
obj = lv_checkbox_create(parent_obj, NULL); objid = LV_HASP_CHECKBOX;
obj = lv_checkbox_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, toggle_event_handler); lv_obj_set_event_cb(obj, toggle_event_handler);
obj->user_data.objid = LV_HASP_CHECKBOX; // obj->user_data.objid = LV_HASP_CHECKBOX;
} }
break; break;
case LV_HASP_LABEL: case LV_HASP_LABEL:
case HASP_OBJ_LABEL: case HASP_OBJ_LABEL:
obj = lv_label_create(parent_obj, NULL); objid = LV_HASP_LABEL;
obj = lv_label_create(parent_obj);
if(obj) { if(obj) {
lv_label_set_long_mode(obj, LV_LABEL_LONG_CROP); lv_label_set_long_mode(obj, LV_LABEL_LONG_CLIP);
lv_label_set_recolor(obj, true); lv_label_set_recolor(obj, true);
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_LABEL; // obj->user_data.objid = LV_HASP_LABEL;
// object_add_task(obj, pageid, id, event_timer_clock, 1000); // object_add_task(obj, pageid, id, event_timer_clock, 1000);
} }
@ -343,52 +380,58 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
case LV_HASP_IMAGE: case LV_HASP_IMAGE:
case HASP_OBJ_IMG: case HASP_OBJ_IMG:
obj = lv_img_create(parent_obj, NULL); objid = LV_HASP_IMAGE;
obj = lv_img_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_IMAGE; // obj->user_data.objid = LV_HASP_IMAGE;
} }
break; break;
case LV_HASP_ARC: case LV_HASP_ARC:
case HASP_OBJ_ARC: case HASP_OBJ_ARC:
obj = lv_arc_create(parent_obj, NULL); objid = LV_HASP_ARC;
obj = lv_arc_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_ARC; // obj->user_data.objid = LV_HASP_ARC;
} }
break; break;
case LV_HASP_CONTAINER: case LV_HASP_CONTAINER:
case HASP_OBJ_CONT: case HASP_OBJ_CONT:
obj = lv_cont_create(parent_obj, NULL); objid = LV_HASP_CONTAINER;
obj = lv_cont_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_CONTAINER; // obj->user_data.objid = LV_HASP_CONTAINER;
} }
break; break;
case LV_HASP_OBJECT: case LV_HASP_OBJECT:
case HASP_OBJ_OBJ: case HASP_OBJ_OBJ:
obj = lv_obj_create(parent_obj, NULL); objid = LV_HASP_OBJECT;
obj = lv_obj_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_OBJECT; // obj->user_data.objid = LV_HASP_OBJECT;
} }
break; break;
case LV_HASP_PAGE: case LV_HASP_PAGE:
case HASP_OBJ_PAGE: case HASP_OBJ_PAGE:
obj = lv_page_create(parent_obj, NULL); objid = LV_HASP_PAGE;
if(obj) obj->user_data.objid = LV_HASP_PAGE; obj = lv_page_create(parent_obj);
// if(obj) obj->user_data.objid = LV_HASP_PAGE;
// No event handler for pages // No event handler for pages
break; break;
#if LV_USE_WIN && LVGL_VERSION_MAJOR == 7 #if LV_USE_WIN && LVGL_VERSION_MAJOR == 7
case LV_HASP_WINDOW: case LV_HASP_WINDOW:
case HASP_OBJ_WIN: case HASP_OBJ_WIN:
obj = lv_win_create(parent_obj, NULL); objid = LV_HASP_WINDOW;
if(obj) obj->user_data.objid = LV_HASP_WINDOW; obj = lv_win_create(parent_obj);
// if(obj) obj->user_data.objid = LV_HASP_WINDOW;
// No event handler for pages // No event handler for pages
break; break;
@ -397,65 +440,72 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
#if LVGL_VERSION_MAJOR == 8 #if LVGL_VERSION_MAJOR == 8
case LV_HASP_LED: case LV_HASP_LED:
case HASP_OBJ_LED: case HASP_OBJ_LED:
obj = lv_led_create(parent_obj); objid = LV_HASP_LED;
obj = lv_led_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_LED; // obj->user_data.objid = LV_HASP_LED;
} }
break; break;
case LV_HASP_TILEVIEW: case LV_HASP_TILEVIEW:
case HASP_OBJ_TILEVIEW: case HASP_OBJ_TILEVIEW:
obj = lv_tileview_create(parent_obj); objid = LV_HASP_TILEVIEW;
if(obj) obj->user_data.objid = LV_HASP_TILEVIEW; obj = lv_tileview_create(parent_obj);
// if(obj) obj->user_data.objid = LV_HASP_TILEVIEW;
// No event handler for tileviews // No event handler for tileviews
break; break;
case LV_HASP_TABVIEW: case LV_HASP_TABVIEW:
case HASP_OBJ_TABVIEW: case HASP_OBJ_TABVIEW:
obj = lv_tabview_create(parent_obj, LV_DIR_TOP, 100); objid = LV_HASP_TABVIEW;
obj = lv_tabview_create(parent_obj, LV_DIR_TOP, 100);
// No event handler for tabs // No event handler for tabs
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, selector_event_handler); lv_obj_set_event_cb(obj, selector_event_handler);
obj->user_data.objid = LV_HASP_TABVIEW; // obj->user_data.objid = LV_HASP_TABVIEW;
} }
break; break;
#else #else
case LV_HASP_LED: case LV_HASP_LED:
case HASP_OBJ_LED: case HASP_OBJ_LED:
obj = lv_led_create(parent_obj, NULL); objid = LV_HASP_LED;
obj = lv_led_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_LED; // obj->user_data.objid = LV_HASP_LED;
} }
break; break;
case LV_HASP_TILEVIEW: case LV_HASP_TILEVIEW:
case HASP_OBJ_TILEVIEW: case HASP_OBJ_TILEVIEW:
obj = lv_tileview_create(parent_obj, NULL); objid = LV_HASP_TILEVIEW;
if(obj) obj->user_data.objid = LV_HASP_TILEVIEW; obj = lv_tileview_create(parent_obj);
// if(obj) obj->user_data.objid = LV_HASP_TILEVIEW;
// No event handler for tileviews // No event handler for tileviews
break; break;
case LV_HASP_TABVIEW: case LV_HASP_TABVIEW:
case HASP_OBJ_TABVIEW: case HASP_OBJ_TABVIEW:
obj = lv_tabview_create(parent_obj, NULL); objid = LV_HASP_TABVIEW;
obj = lv_tabview_create(parent_obj);
// No event handler for tabs // No event handler for tabs
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, selector_event_handler); lv_obj_set_event_cb(obj, selector_event_handler);
obj->user_data.objid = LV_HASP_TABVIEW; // obj->user_data.objid = LV_HASP_TABVIEW;
} }
break; break;
case LV_HASP_TAB: case LV_HASP_TAB:
case HASP_OBJ_TAB: case HASP_OBJ_TAB:
objid = LV_HASP_TAB;
if(parent_obj && parent_obj->user_data.objid == LV_HASP_TABVIEW) { if(parent_obj && parent_obj->user_data.objid == LV_HASP_TABVIEW) {
obj = lv_tabview_add_tab(parent_obj, "Tab"); obj = lv_tabview_add_tab(parent_obj, "Tab");
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_TAB; // obj->user_data.objid = LV_HASP_TAB;
} }
} else { } else {
LOG_WARNING(TAG_HASP, F("Parent of a tab must be a tabview object")); LOG_WARNING(TAG_HASP, F("Parent of a tab must be a tabview object"));
@ -467,19 +517,21 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
/* ----- Color Objects ------ */ /* ----- Color Objects ------ */
case LV_HASP_CPICKER: case LV_HASP_CPICKER:
case HASP_OBJ_CPICKER: case HASP_OBJ_CPICKER:
obj = lv_cpicker_create(parent_obj, NULL); objid = LV_HASP_CPICKER;
obj = lv_colorwheel_create(parent_obj, true);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, cpicker_event_handler); lv_obj_set_event_cb(obj, cpicker_event_handler);
obj->user_data.objid = LV_HASP_CPICKER; // obj->user_data.objid = LV_HASP_CPICKER;
} }
break; break;
#if LV_USE_SPINNER != 0 #if LV_USE_SPINNER != 0
case LV_HASP_SPINNER: case LV_HASP_SPINNER:
case HASP_OBJ_SPINNER: case HASP_OBJ_SPINNER:
obj = lv_spinner_create(parent_obj, NULL); objid = LV_HASP_SPINNER;
obj = lv_spinner_create(parent_obj, 2000, 90);
if(obj) { if(obj) {
obj->user_data.objid = LV_HASP_SPINNER; // obj->user_data.objid = LV_HASP_SPINNER;
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
} }
break; break;
@ -488,150 +540,163 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
/* ----- Range Objects ------ */ /* ----- Range Objects ------ */
case LV_HASP_SLIDER: case LV_HASP_SLIDER:
case HASP_OBJ_SLIDER: case HASP_OBJ_SLIDER:
obj = lv_slider_create(parent_obj, NULL); objid = LV_HASP_SLIDER;
obj = lv_slider_create(parent_obj);
if(obj) { if(obj) {
lv_slider_set_range(obj, 0, 100); lv_slider_set_range(obj, 0, 100);
lv_obj_set_event_cb(obj, slider_event_handler); lv_obj_set_event_cb(obj, slider_event_handler);
obj->user_data.objid = LV_HASP_SLIDER; // obj->user_data.objid = LV_HASP_SLIDER;
} }
// 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;
case LV_HASP_GAUGE: // case LV_HASP_GAUGE:
case HASP_OBJ_GAUGE: // case HASP_OBJ_GAUGE:
obj = lv_gauge_create(parent_obj, NULL); // objid = LV_HASP_GAUGE;
if(obj) { // obj = lv_gauge_create(parent_obj);
lv_gauge_set_range(obj, 0, 100); // if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); // lv_gauge_set_range(obj, 0, 100);
obj->user_data.objid = LV_HASP_GAUGE; // lv_obj_set_event_cb(obj, generic_event_handler);
} // // obj->user_data.objid = LV_HASP_GAUGE;
break; // }
// break;
case LV_HASP_LINE: case LV_HASP_LINE:
case HASP_OBJ_LINE: case HASP_OBJ_LINE:
obj = lv_line_create(parent_obj, NULL); objid = LV_HASP_LINE;
obj = lv_line_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, delete_event_handler); lv_obj_set_event_cb(obj, delete_event_handler);
obj->user_data.objid = LV_HASP_LINE; // obj->user_data.objid = LV_HASP_LINE;
} }
break; break;
case LV_HASP_BAR: case LV_HASP_BAR:
case HASP_OBJ_BAR: case HASP_OBJ_BAR:
obj = lv_bar_create(parent_obj, NULL); objid = LV_HASP_BAR;
obj = lv_bar_create(parent_obj);
if(obj) { if(obj) {
lv_bar_set_range(obj, 0, 100); lv_bar_set_range(obj, 0, 100);
lv_obj_set_event_cb(obj, generic_event_handler); lv_obj_set_event_cb(obj, generic_event_handler);
obj->user_data.objid = LV_HASP_BAR; // obj->user_data.objid = LV_HASP_BAR;
} }
break; break;
case LV_HASP_LINEMETER: // case LV_HASP_LINEMETER:
case HASP_OBJ_LMETER: // obsolete // case HASP_OBJ_LMETER: // obsolete
case HASP_OBJ_LINEMETER: // case HASP_OBJ_LINEMETER:
obj = lv_linemeter_create(parent_obj, NULL); // objid = LV_HASP_LINEMETER;
if(obj) { // obj = lv_linemeter_create(parent_obj);
lv_linemeter_set_range(obj, 0, 100); // if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); // lv_linemeter_set_range(obj, 0, 100);
obj->user_data.objid = LV_HASP_LINEMETER; // lv_obj_set_event_cb(obj, generic_event_handler);
} // // obj->user_data.objid = LV_HASP_LINEMETER;
break; // }
// break;
case LV_HASP_SPINBOX: case LV_HASP_SPINBOX:
case HASP_OBJ_SPINBOX: case HASP_OBJ_SPINBOX:
obj = lv_spinbox_create(parent_obj, NULL); objid = LV_HASP_SPINBOX;
obj = lv_spinbox_create(parent_obj);
if(obj) { if(obj) {
lv_spinbox_set_range(obj, 0, 100); lv_spinbox_set_range(obj, 0, 100);
lv_obj_set_event_cb(obj, slider_event_handler); lv_obj_set_event_cb(obj, slider_event_handler);
obj->user_data.objid = LV_HASP_SPINBOX; // obj->user_data.objid = LV_HASP_SPINBOX;
} }
break; break;
case LV_HASP_LIST: case LV_HASP_LIST:
case HASP_OBJ_LIST: case HASP_OBJ_LIST:
obj = lv_list_create(parent_obj, NULL); objid = LV_HASP_LIST;
obj = lv_list_create(parent_obj);
if(obj) { if(obj) {
// Callbacks are set on the individual buttons // Callbacks are set on the individual buttons
obj->user_data.objid = LV_HASP_LIST; // obj->user_data.objid = LV_HASP_LIST;
} }
break; break;
case LV_HASP_CHART: // case LV_HASP_CHART:
case HASP_OBJ_CHART: // case HASP_OBJ_CHART:
obj = lv_chart_create(parent_obj, NULL); // objid = LV_HASP_CHART;
if(obj) { // obj = lv_chart_create(parent_obj);
lv_chart_set_range(obj, 0, 100); // if(obj) {
lv_obj_set_event_cb(obj, generic_event_handler); // lv_chart_set_range(obj, 0, 100);
// lv_obj_set_event_cb(obj, generic_event_handler);
lv_chart_add_series(obj, LV_COLOR_RED); // lv_chart_add_series(obj, LV_COLOR_RED);
lv_chart_add_series(obj, LV_COLOR_GREEN); // lv_chart_add_series(obj, LV_COLOR_GREEN);
lv_chart_add_series(obj, LV_COLOR_BLUE); // lv_chart_add_series(obj, LV_COLOR_BLUE);
lv_chart_series_t* ser = my_chart_get_series(obj, 2); // lv_chart_series_t* ser = my_chart_get_series(obj, 2);
lv_chart_set_next(obj, ser, 10); // lv_chart_set_next(obj, ser, 10);
lv_chart_set_next(obj, ser, 20); // lv_chart_set_next(obj, ser, 20);
lv_chart_set_next(obj, ser, 30); // lv_chart_set_next(obj, ser, 30);
lv_chart_set_next(obj, ser, 40); // lv_chart_set_next(obj, ser, 40);
obj->user_data.objid = LV_HASP_CHART; // // obj->user_data.objid = LV_HASP_CHART;
} // }
break; // break;
/* ----- On/Off Objects ------ */ /* ----- On/Off Objects ------ */
case LV_HASP_SWITCH: case LV_HASP_SWITCH:
case HASP_OBJ_SWITCH: case HASP_OBJ_SWITCH:
obj = lv_switch_create(parent_obj, NULL); objid = LV_HASP_SWITCH;
obj = lv_switch_create(parent_obj);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, toggle_event_handler); lv_obj_set_event_cb(obj, toggle_event_handler);
obj->user_data.objid = LV_HASP_SWITCH; // obj->user_data.objid = LV_HASP_SWITCH;
} }
break; break;
/* ----- List Object ------- */ /* ----- Dropdown Object ------- */
case LV_HASP_DROPDOWN: case LV_HASP_DROPDOWN:
case HASP_OBJ_DROPDOWN: case HASP_OBJ_DROPDOWN:
obj = lv_dropdown_create(parent_obj, NULL); objid = LV_HASP_DROPDOWN;
obj = lv_dropdown_create(parent_obj);
if(obj) { if(obj) {
lv_dropdown_set_draw_arrow(obj, true); lv_dropdown_set_draw_arrow(obj, true);
// lv_dropdown_set_anim_time(obj, 200); // lv_dropdown_set_anim_time(obj, 200);
lv_obj_set_top(obj, true); lv_obj_set_top(obj, true);
// lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); // // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
lv_obj_set_event_cb(obj, selector_event_handler); lv_obj_set_event_cb(obj, selector_event_handler);
obj->user_data.objid = LV_HASP_DROPDOWN; // obj->user_data.objid = LV_HASP_DROPDOWN;
} }
break; break;
case LV_HASP_ROLLER: case LV_HASP_ROLLER:
case HASP_OBJ_ROLLER: case HASP_OBJ_ROLLER:
obj = lv_roller_create(parent_obj, NULL); objid = LV_HASP_ROLLER;
// lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); obj = lv_roller_create(parent_obj);
// // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
if(obj) { if(obj) {
lv_roller_set_auto_fit(obj, false); lv_roller_set_auto_fit(obj, false);
lv_obj_set_event_cb(obj, selector_event_handler); lv_obj_set_event_cb(obj, selector_event_handler);
obj->user_data.objid = LV_HASP_ROLLER; // obj->user_data.objid = LV_HASP_ROLLER;
} }
break; break;
case LV_HASP_MSGBOX: // case LV_HASP_MSGBOX:
case HASP_OBJ_MSGBOX: // case HASP_OBJ_MSGBOX:
obj = lv_msgbox_create(parent_obj, NULL); // objid = LV_HASP_MSGBOX;
if(obj) { // obj = lv_msgbox_create(parent_obj);
lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); // if(obj) {
lv_obj_set_auto_realign(obj, true); // // lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_event_cb(obj, msgbox_event_handler); // lv_obj_set_auto_realign(obj, true);
if(msgbox_default_map) lv_msgbox_add_btns(obj, msgbox_default_map); // lv_obj_set_event_cb(obj, msgbox_event_handler);
obj->user_data.objid = LV_HASP_MSGBOX; // if(msgbox_default_map) lv_msgbox_add_btns(obj, msgbox_default_map);
} // // obj->user_data.objid = LV_HASP_MSGBOX;
break; // }
// break;
case LV_HASP_CALENDER: case LV_HASP_CALENDER:
case HASP_OBJ_CALENDAR: case HASP_OBJ_CALENDAR:
obj = lv_calendar_create(parent_obj, NULL); objid = LV_HASP_CALENDER;
// lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); obj = lv_calendar_create(parent_obj);
// // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
if(obj) { if(obj) {
lv_obj_set_event_cb(obj, calendar_event_handler); lv_obj_set_event_cb(obj, calendar_event_handler);
obj->user_data.objid = LV_HASP_CALENDER; // obj->user_data.objid = LV_HASP_CALENDER;
object_add_task(obj, pageid, id, event_timer_calendar, 5000); object_add_task(obj, pageid, id, event_timer_calendar, 5000);
} }
@ -650,16 +715,15 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// Prevent losing press when the press is slid out of the objects. // Prevent losing press when the press is slid out of the objects.
// (E.g. a Button can be released out of it if it was being pressed) // (E.g. a Button can be released out of it if it was being pressed)
lv_obj_add_protect(obj, LV_PROTECT_PRESS_LOST); // V8 lv_obj_add_protect(obj, LV_PROTECT_PRESS_LOST);
lv_obj_set_gesture_parent(obj, false); // V8 lv_obj_set_gesture_parent(obj, false);
/* id tag the object */ if(!object_set_user_data(obj, id, objid)) return;
obj->user_data.id = id;
#ifdef HASP_DEBUG
uint8_t temp; // needed for debug tests uint8_t temp; // needed for debug tests
(void)temp; (void)temp;
#ifdef HASP_DEBUG
/** testing start **/ /** testing start **/
if(!hasp_find_id_from_obj(obj, &pageid, &temp)) { if(!hasp_find_id_from_obj(obj, &pageid, &temp)) {
LOG_ERROR(TAG_HASP, F(D_OBJECT_LOST)); LOG_ERROR(TAG_HASP, F(D_OBJECT_LOST));

View File

@ -78,6 +78,7 @@ enum lv_hasp_obj_type_t {
}; };
void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id); void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id);
bool object_set_user_data(lv_obj_t* obj, uint8_t id, uint8_t objid);
lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid); lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid);
lv_obj_t* hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid); lv_obj_t* hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid);
@ -99,10 +100,14 @@ void object_set_normalized_group_values(hasp_update_value_t& value);
*/ */
inline const char* obj_get_type_name(const lv_obj_t* obj) inline const char* obj_get_type_name(const lv_obj_t* obj)
{ {
#if LV_VERSION_CHECK(8, 0, 0)
return "unknown";
#else
lv_obj_type_t list; lv_obj_type_t list;
lv_obj_get_type(obj, &list); lv_obj_get_type(obj, &list);
const char* objtype = list.type[0]; const char* objtype = list.type[0];
return objtype + 3; // skip lv_ return objtype + 3; // skip lv_
#endif
} }
/** /**
* Get the hasp object type of a given LVGL object * Get the hasp object type of a given LVGL object
@ -112,7 +117,8 @@ inline const char* obj_get_type_name(const lv_obj_t* obj)
*/ */
inline lv_hasp_obj_type_t obj_get_type(const lv_obj_t* obj) inline lv_hasp_obj_type_t obj_get_type(const lv_obj_t* obj)
{ {
return (lv_hasp_obj_type_t)obj->user_data.objid; lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
return (lv_hasp_obj_type_t)user_data->objid;
} }
/** /**
* Check if an lvgl objecttype name corresponds to a given HASP object ID * Check if an lvgl objecttype name corresponds to a given HASP object ID
@ -124,8 +130,9 @@ inline lv_hasp_obj_type_t obj_get_type(const lv_obj_t* obj)
inline bool obj_check_type(const lv_obj_t* obj, lv_hasp_obj_type_t haspobjtype) inline bool obj_check_type(const lv_obj_t* obj, lv_hasp_obj_type_t haspobjtype)
{ {
#if 1 #if 1
if(!obj) return false; if(!obj || !obj->user_data) return false;
return obj->user_data.objid == (uint8_t)haspobjtype; lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data;
return user_data->objid == (uint8_t)haspobjtype;
#else #else
lv_obj_type_t list; lv_obj_type_t list;
lv_obj_get_type(obj, &list); lv_obj_get_type(obj, &list);

View File

@ -31,9 +31,8 @@ void Page::init(uint8_t start_page)
for(int i = 0; i < count(); i++) { for(int i = 0; i < count(); i++) {
lv_obj_t* prev_page_obj = _pages[i]; lv_obj_t* prev_page_obj = _pages[i];
_pages[i] = lv_obj_create(NULL);
_pages[i] = lv_obj_create(NULL, NULL); object_set_user_data(_pages[i], 0, LV_HASP_SCREEN);
_pages[i]->user_data.objid = LV_HASP_SCREEN;
lv_obj_set_event_cb(_pages[i], generic_event_handler); lv_obj_set_event_cb(_pages[i], generic_event_handler);
/**< If the `indev` was pressing this object but swiped out while pressing do not search other object.*/ /**< If the `indev` was pressing this object but swiped out while pressing do not search other object.*/

View File

@ -1,6 +1,8 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie /* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */ For full license information read the LICENSE file in the project folder */
#if 0
#include "hasp_attribute.h" /*To see all the hashes*/ #include "hasp_attribute.h" /*To see all the hashes*/
static void set_style_attribute(lv_style_t * style, lv_state_t state, int16_t val) static void set_style_attribute(lv_style_t * style, lv_state_t state, int16_t val)
@ -227,3 +229,5 @@ static void set_style_attribute(lv_style_t * style, lv_state_t state, int16_t va
default:; default:;
} }
} }
#endif

File diff suppressed because it is too large Load Diff

View File

@ -138,39 +138,10 @@ void debugStop()
/* ===== Special Event Processors ===== */ /* ===== Special Event Processors ===== */
void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, const char* funcname, const char* descr) void debugLvglLogEvent(const char* line)
{ {
#if LV_USE_LOG != 0 #if LV_USE_LOG != 0
/* used for duplicate detection */ LOG_VERBOSE(TAG_LVGL, line);
static const char* last_funcname;
static uint32_t lastDbgLine;
// static uint32_t lastDbgFreeMem;
/* Reduce the number of repeated debug message */
if(line == lastDbgLine && funcname == last_funcname) return;
// lv_mem_monitor_t mem_mon;
// lv_mem_monitor(&mem_mon);
/* Reduce the number of repeated debug message */
// if(line != lastDbgLine || mem_mon.free_biggest_size != lastDbgFreeMem) {
switch(level) {
case LV_LOG_LEVEL_TRACE:
LOG_VERBOSE(TAG_LVGL, descr);
break;
case LV_LOG_LEVEL_WARN:
LOG_WARNING(TAG_LVGL, descr);
break;
case LV_LOG_LEVEL_ERROR:
LOG_ERROR(TAG_LVGL, descr);
break;
default:
LOG_TRACE(TAG_LVGL, descr);
}
last_funcname = funcname;
lastDbgLine = line;
// lastDbgFreeMem = mem_mon.free_biggest_size;
//}
#endif #endif
} }

View File

@ -134,7 +134,7 @@ extern "C" {
#endif #endif
// Functions used by ANDROID, WINDOWS and POSSIX // Functions used by ANDROID, WINDOWS and POSSIX
void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, const char* funcname, const char* descr); void debugLvglLogEvent(const char* line);
IRAM_ATTR void debugLoop(void); IRAM_ATTR void debugLoop(void);
void debugEverySecond(void); void debugEverySecond(void);
void debugStart(void); void debugStart(void);

Some files were not shown because too many files have changed in this diff Show More