mirror of https://github.com/arendst/Tasmota.git
HASPmota `dropdown_list` and fixes (#21208)
This commit is contained in:
parent
e6d9d826ac
commit
042eecc378
|
@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## [13.4.1.1]
|
||||
### Added
|
||||
- HASPmota `dropdown_list` and fixes
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
|
|
@ -763,6 +763,9 @@ class lvh_obj : lvh_root
|
|||
end
|
||||
end
|
||||
def get_label_mode()
|
||||
if self._lv_label != nil
|
||||
return self._lv_label.get_long_mode()
|
||||
end
|
||||
end
|
||||
|
||||
#====================================================================
|
||||
|
@ -1080,10 +1083,10 @@ end
|
|||
#################################################################################
|
||||
|
||||
#====================================================================
|
||||
# flex
|
||||
# fixed - container for a box with fixed sub-objects (no placement)
|
||||
#====================================================================
|
||||
#@ solidify:lvh_flex,weak
|
||||
class lvh_flex : lvh_obj
|
||||
#@ solidify:lvh_fixed,weak
|
||||
class lvh_fixed : lvh_obj
|
||||
# static var _lv_class = lv.obj # from parent class
|
||||
# label do not need a sub-label
|
||||
def post_init()
|
||||
|
@ -1095,6 +1098,19 @@ class lvh_flex : lvh_obj
|
|||
obj.set_style_margin_all(0, 0)
|
||||
obj.set_style_bg_opa(0, 0)
|
||||
obj.set_size(lv.pct(100), lv.pct(100))
|
||||
end
|
||||
end
|
||||
|
||||
#====================================================================
|
||||
# flex - container for sub-objects placed along with flex directives
|
||||
#====================================================================
|
||||
#@ solidify:lvh_flex,weak
|
||||
class lvh_flex : lvh_fixed
|
||||
# static var _lv_class = lv.obj # from parent class
|
||||
# label do not need a sub-label
|
||||
def post_init()
|
||||
super(self).post_init() # call super
|
||||
var obj = self._lv_obj
|
||||
obj.set_flex_flow(lv.FLEX_FLOW_ROW)
|
||||
end
|
||||
end
|
||||
|
@ -1415,6 +1431,7 @@ end
|
|||
#@ solidify:lvh_dropdown,weak
|
||||
class lvh_dropdown : lvh_obj
|
||||
static var _lv_class = lv.dropdown
|
||||
var _symbol # we need to keep a reference to the string used for symbol to avoid GC
|
||||
static var _dir = [ lv.DIR_BOTTOM, lv.DIR_TOP, lv.DIR_LEFT, lv.DIR_RIGHT ] # 0 = down, 1 = up, 2 = left, 3 = right
|
||||
|
||||
def set_val(t)
|
||||
|
@ -1445,8 +1462,16 @@ class lvh_dropdown : lvh_obj
|
|||
|
||||
# direction needs a conversion from HASPmota numbers and LVGL's
|
||||
def set_direction(t)
|
||||
t = int(t)
|
||||
# 0 = down, 1 = up, 2 = left, 3 = right
|
||||
self._lv_obj.set_dir(self._dir[int(t)])
|
||||
if (t < 0) || (t > 3) t = 0 end
|
||||
self._lv_obj.set_dir(self._dir[t])
|
||||
if t == 1 self._symbol = lv.SYMBOL_UP
|
||||
elif t == 2 self._symbol = lv.SYMBOL_LEFT
|
||||
elif t == 3 self._symbol = lv.SYMBOL_RIGHT
|
||||
else self._symbol = lv.SYMBOL_DOWN
|
||||
end
|
||||
self._lv_obj.set_symbol(self._symbol)
|
||||
end
|
||||
def get_direction()
|
||||
var dir = self._lv_obj.get_dir()
|
||||
|
@ -1470,6 +1495,24 @@ class lvh_dropdown : lvh_obj
|
|||
return (static_text == nil)
|
||||
end
|
||||
end
|
||||
#====================================================================
|
||||
# dropdown_list (accessing the list object)
|
||||
#====================================================================
|
||||
#@ solidify:lvh_dropdown_list,weak
|
||||
class lvh_dropdown_list : lvh_obj
|
||||
static var _lv_class = nil
|
||||
|
||||
def post_init()
|
||||
self._lv_obj = nil # default to nil object, whatever it was initialized with
|
||||
# check if it is the parent is a spangroup
|
||||
if isinstance(self._parent_lvh, self._page._oh.lvh_dropdown)
|
||||
self._lv_obj = lv.list(self._parent_lvh._lv_obj.get_list()._p)
|
||||
else
|
||||
print("HSP: '_dropdown_list' should have a parent of type 'dropdown'")
|
||||
end
|
||||
# super(self).post_init() # call super - don't call post_init to not register a callback
|
||||
end
|
||||
end
|
||||
|
||||
#====================================================================
|
||||
# bar
|
||||
|
@ -2180,6 +2223,7 @@ class HASPmota
|
|||
# assign lvh_page to a static attribute
|
||||
static lvh_root = lvh_root
|
||||
static lvh_obj = lvh_obj
|
||||
static lvh_fixed = lvh_fixed
|
||||
static lvh_flex = lvh_flex
|
||||
static lvh_page = lvh_page
|
||||
static lvh_scr = lvh_scr
|
||||
|
@ -2193,6 +2237,7 @@ class HASPmota
|
|||
static lvh_line = lvh_line
|
||||
static lvh_img = lvh_img
|
||||
static lvh_dropdown = lvh_dropdown
|
||||
static lvh_dropdown_list = lvh_dropdown_list
|
||||
static lvh_roller = lvh_roller
|
||||
static lvh_btnmatrix = lvh_btnmatrix
|
||||
# static lvh_msgbox = lvh_msgbox
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1235,7 +1235,7 @@ https://rya.nc/tasmota-fingerprint.html"
|
|||
#define BE_LV_WIDGET_IMAGEBUTTON // LVGL 9
|
||||
// #define BE_LV_WIDGET_KEYBOARD
|
||||
#define BE_LV_WIDGET_LED
|
||||
// #define BE_LV_WIDGET_LIST
|
||||
#define BE_LV_WIDGET_LIST
|
||||
#define BE_LV_WIDGET_METER
|
||||
#define BE_LV_WIDGET_MSGBOX
|
||||
#define BE_LV_WIDGET_QRCODE
|
||||
|
|
|
@ -104,8 +104,10 @@ void lv_flush_callback(lv_display_t *disp, const lv_area_t *area, uint8_t *color
|
|||
lv_disp_flush_ready(disp);
|
||||
|
||||
if (pixels_len >= 10000 && (!renderer->lvgl_param.use_dma)) {
|
||||
AddLog(LOG_LEVEL_DEBUG, D_LOG_LVGL "Refreshed %d pixels in %d ms (%i pix/ms)", pixels_len, chrono_time,
|
||||
chrono_time > 0 ? pixels_len / chrono_time : -1);
|
||||
if (HighestLogLevel() >= LOG_LEVEL_DEBUG_MORE) {
|
||||
AddLog(LOG_LEVEL_DEBUG_MORE, D_LOG_LVGL "Refreshed %d pixels in %d ms (%i pix/ms)", pixels_len, chrono_time,
|
||||
chrono_time > 0 ? pixels_len / chrono_time : -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,10 +409,13 @@ void start_lvgl(const char * uconfig) {
|
|||
do {
|
||||
//lvgl_buffer_size = LV_HOR_RES_MAX * LV_BUFFER_ROWS;
|
||||
uint32_t flushlines = renderer->lvgl_pars()->fluslines;
|
||||
lvgl_buffer_size = renderer->width() * (flushlines ? flushlines:LV_BUFFER_ROWS);
|
||||
if (0 == flushlines) flushlines = LV_BUFFER_ROWS;
|
||||
|
||||
lvgl_buffer_size = renderer->width() * flushlines;
|
||||
if (renderer->lvgl_pars()->use_dma) {
|
||||
lvgl_buffer_size /= 2;
|
||||
if (lvgl_buffer_size < 1000000) {
|
||||
AddLog(LOG_LEVEL_ERROR, "LVG: Allocating buffer2 %i bytes in main memory (flushlines %i)", lvgl_buffer_size * sizeof(lv_color_t), flushlines);
|
||||
lvgl_glue->lv_pixel_buf2 = new lv_color_t[lvgl_buffer_size];
|
||||
}
|
||||
if (!lvgl_glue->lv_pixel_buf2) {
|
||||
|
@ -419,6 +424,7 @@ void start_lvgl(const char * uconfig) {
|
|||
}
|
||||
}
|
||||
|
||||
AddLog(LOG_LEVEL_ERROR, "LVG: Allocating buffer1 %i KB in main memory (flushlines %i)", (lvgl_buffer_size * sizeof(lv_color_t)) / 1024, flushlines);
|
||||
lvgl_glue->lv_pixel_buf = new lv_color_t[lvgl_buffer_size];
|
||||
if (!lvgl_glue->lv_pixel_buf) {
|
||||
status_ok = false;
|
||||
|
|
Loading…
Reference in New Issue