mirror of https://github.com/arendst/Tasmota.git
Merge pull request #14182 from s-hadinger/lvgl_modularization
LVGL modularization
This commit is contained in:
commit
b5f913ed18
|
@ -0,0 +1,116 @@
|
|||
/********************************************************************
|
||||
* Tasmota LVGL lv_signal_bars widget
|
||||
*******************************************************************/
|
||||
#include "be_constobj.h"
|
||||
|
||||
#ifdef USE_LVGL
|
||||
|
||||
extern int lv0_start(bvm *vm);
|
||||
|
||||
extern int lv0_register_button_encoder(bvm *vm); // add buttons with encoder logic
|
||||
|
||||
extern int lv0_load_montserrat_font(bvm *vm);
|
||||
extern int lv0_load_seg7_font(bvm *vm);
|
||||
extern int lv0_load_robotocondensed_latin1_font(bvm *vm);
|
||||
|
||||
extern int lv0_screenshot(bvm *vm);
|
||||
extern int lv0_load_freetype_font(bvm *vm);
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: init
|
||||
********************************************************************/
|
||||
be_local_closure(lv_tasmota_init, /* name */
|
||||
be_nested_proto(
|
||||
3, /* nstack */
|
||||
1, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[23]) { /* constants */
|
||||
/* K0 */ be_nested_str(lv),
|
||||
/* K1 */ be_nested_str(start),
|
||||
/* K2 */ be_nested_str(font_montserrat),
|
||||
/* K3 */ be_nested_str(montserrat_font),
|
||||
/* K4 */ be_nested_str(font_seg7),
|
||||
/* K5 */ be_nested_str(seg7_font),
|
||||
/* K6 */ be_nested_str(load_freetype_font),
|
||||
/* K7 */ be_nested_str(register_button_encoder),
|
||||
/* K8 */ be_nested_str(screenshot),
|
||||
/* K9 */ be_nested_str(clock_icon),
|
||||
/* K10 */ be_nested_str(lv_clock_icon),
|
||||
/* K11 */ be_nested_str(signal_arcs),
|
||||
/* K12 */ be_nested_str(lv_signal_arcs),
|
||||
/* K13 */ be_nested_str(signal_bars),
|
||||
/* K14 */ be_nested_str(lv_signal_bars),
|
||||
/* K15 */ be_nested_str(wifi_arcs_icon),
|
||||
/* K16 */ be_nested_str(lv_wifi_arcs_icon),
|
||||
/* K17 */ be_nested_str(wifi_arcs),
|
||||
/* K18 */ be_nested_str(lv_wifi_arcs),
|
||||
/* K19 */ be_nested_str(wifi_bars_icon),
|
||||
/* K20 */ be_nested_str(lv_wifi_bars_icon),
|
||||
/* K21 */ be_nested_str(wifi_bars),
|
||||
/* K22 */ be_nested_str(lv_wifi_bars),
|
||||
}),
|
||||
&be_const_str_init,
|
||||
&be_const_str_solidified,
|
||||
( &(const binstruction[33]) { /* code */
|
||||
0xA4060000, // 0000 IMPORT R1 K0
|
||||
0x88080101, // 0001 GETMBR R2 R0 K1
|
||||
0x90060202, // 0002 SETMBR R1 K1 R2
|
||||
0x88080102, // 0003 GETMBR R2 R0 K2
|
||||
0x90060402, // 0004 SETMBR R1 K2 R2
|
||||
0x88080102, // 0005 GETMBR R2 R0 K2
|
||||
0x90060602, // 0006 SETMBR R1 K3 R2
|
||||
0x88080104, // 0007 GETMBR R2 R0 K4
|
||||
0x90060802, // 0008 SETMBR R1 K4 R2
|
||||
0x88080104, // 0009 GETMBR R2 R0 K4
|
||||
0x90060A02, // 000A SETMBR R1 K5 R2
|
||||
0x88080106, // 000B GETMBR R2 R0 K6
|
||||
0x90060C02, // 000C SETMBR R1 K6 R2
|
||||
0x88080107, // 000D GETMBR R2 R0 K7
|
||||
0x90060E02, // 000E SETMBR R1 K7 R2
|
||||
0x88080108, // 000F GETMBR R2 R0 K8
|
||||
0x90061002, // 0010 SETMBR R1 K8 R2
|
||||
0xB80A1400, // 0011 GETNGBL R2 K10
|
||||
0x90061202, // 0012 SETMBR R1 K9 R2
|
||||
0xB80A1800, // 0013 GETNGBL R2 K12
|
||||
0x90061602, // 0014 SETMBR R1 K11 R2
|
||||
0xB80A1C00, // 0015 GETNGBL R2 K14
|
||||
0x90061A02, // 0016 SETMBR R1 K13 R2
|
||||
0xB80A2000, // 0017 GETNGBL R2 K16
|
||||
0x90061E02, // 0018 SETMBR R1 K15 R2
|
||||
0xB80A2400, // 0019 GETNGBL R2 K18
|
||||
0x90062202, // 001A SETMBR R1 K17 R2
|
||||
0xB80A2800, // 001B GETNGBL R2 K20
|
||||
0x90062602, // 001C SETMBR R1 K19 R2
|
||||
0xB80A2C00, // 001D GETNGBL R2 K22
|
||||
0x90062A02, // 001E SETMBR R1 K21 R2
|
||||
0x4C080000, // 001F LDNIL R2
|
||||
0x80040400, // 0020 RET 1 R2
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/* @const_object_info_begin
|
||||
module lv_tasmota (scope: global) {
|
||||
init, closure(lv_tasmota_init_closure)
|
||||
|
||||
start, func(lv0_start)
|
||||
|
||||
font_montserrat, func(lv0_load_montserrat_font)
|
||||
montserrat_font, func(lv0_load_montserrat_font)
|
||||
font_seg7, func(lv0_load_seg7_font)
|
||||
seg7_font, func(lv0_load_seg7_font)
|
||||
register_button_encoder, func(lv0_register_button_encoder)
|
||||
screenshot, func(lv0_screenshot)
|
||||
|
||||
load_freetype_font, func(lv0_load_freetype_font)
|
||||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_lv_tasmota.h"
|
||||
|
||||
#endif // USE_LVGL
|
|
@ -44,6 +44,7 @@ be_extern_native_module(unishox);
|
|||
be_extern_native_module(animate);
|
||||
#ifdef USE_LVGL
|
||||
be_extern_native_module(lv);
|
||||
be_extern_native_module(lv_tasmota);
|
||||
#endif // USE_LVGL
|
||||
|
||||
/* user-defined modules declare start */
|
||||
|
@ -118,6 +119,7 @@ BERRY_LOCAL const bntvmodule* const be_module_table[] = {
|
|||
|
||||
#ifdef USE_LVGL
|
||||
&be_native_module(lv),
|
||||
&be_native_module(lv_tasmota),
|
||||
#endif // USE_LVGL
|
||||
#ifdef USE_ENERGY_SENSOR
|
||||
&be_native_module(energy),
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#- ------------------------------------------------------------ -#
|
||||
# Module `lv_tasmota` - piggybacks on `lv` to extend it
|
||||
#- ------------------------------------------------------------ -#
|
||||
lv_tasmota = module("lv_tasmota")
|
||||
|
||||
# rename `lv` to `lv_ntv` and replace `lv` with `lv_tasmota`
|
||||
def init(lv_tasmota)
|
||||
import lv
|
||||
lv.start = lv_tasmota.start
|
||||
|
||||
lv.font_montserrat = lv_tasmota.font_montserrat
|
||||
lv.montserrat_font = lv_tasmota.font_montserrat
|
||||
|
||||
lv.font_seg7 = lv_tasmota.font_seg7
|
||||
lv.seg7_font = lv_tasmota.font_seg7
|
||||
|
||||
lv.load_freetype_font = lv_tasmota.load_freetype_font
|
||||
|
||||
lv.register_button_encoder = lv_tasmota.register_button_encoder
|
||||
lv.screenshot = lv_tasmota.screenshot
|
||||
|
||||
# add widgets
|
||||
lv.clock_icon = lv_clock_icon
|
||||
lv.signal_arcs = lv_signal_arcs
|
||||
lv.signal_bars = lv_signal_bars
|
||||
lv.wifi_arcs_icon = lv_wifi_arcs_icon
|
||||
lv.wifi_arcs = lv_wifi_arcs
|
||||
lv.wifi_bars_icon = lv_wifi_bars_icon
|
||||
lv.wifi_bars = lv_wifi_bars
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
lv_tasmota.init = init
|
||||
|
||||
return lv_tasmota
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
python3 tools/pycoc/main.py -o generate src default ../berry_mapping/src ../../libesp32_lvgl/lv_berry/src -c default/berry_conf.h
|
||||
python3 tools/pycoc/main.py -o generate src default ../berry_mapping/src ../../libesp32_lvgl/lv_berry/src ../../libesp32_lvgl/lv_berry/generate -c default/berry_conf.h
|
||||
|
|
|
@ -264,6 +264,7 @@ extern const bcstring be_const_str_classof;
|
|||
extern const bcstring be_const_str_clear;
|
||||
extern const bcstring be_const_str_clear_first_time;
|
||||
extern const bcstring be_const_str_clear_to;
|
||||
extern const bcstring be_const_str_clock_icon;
|
||||
extern const bcstring be_const_str_close;
|
||||
extern const bcstring be_const_str_closure;
|
||||
extern const bcstring be_const_str_cmd;
|
||||
|
@ -362,6 +363,8 @@ extern const bcstring be_const_str_find_op;
|
|||
extern const bcstring be_const_str_finish;
|
||||
extern const bcstring be_const_str_floor;
|
||||
extern const bcstring be_const_str_flush;
|
||||
extern const bcstring be_const_str_font_montserrat;
|
||||
extern const bcstring be_const_str_font_seg7;
|
||||
extern const bcstring be_const_str_for;
|
||||
extern const bcstring be_const_str_format;
|
||||
extern const bcstring be_const_str_from_to;
|
||||
|
@ -469,6 +472,7 @@ extern const bcstring be_const_str_list;
|
|||
extern const bcstring be_const_str_list_handlers;
|
||||
extern const bcstring be_const_str_listdir;
|
||||
extern const bcstring be_const_str_load;
|
||||
extern const bcstring be_const_str_load_freetype_font;
|
||||
extern const bcstring be_const_str_load_templates;
|
||||
extern const bcstring be_const_str_local;
|
||||
extern const bcstring be_const_str_log;
|
||||
|
@ -477,10 +481,18 @@ extern const bcstring be_const_str_loop;
|
|||
extern const bcstring be_const_str_lower;
|
||||
extern const bcstring be_const_str_lv;
|
||||
extern const bcstring be_const_str_lv_;
|
||||
extern const bcstring be_const_str_lv_clock_icon;
|
||||
extern const bcstring be_const_str_lv_event;
|
||||
extern const bcstring be_const_str_lv_event_cb;
|
||||
extern const bcstring be_const_str_lv_module_init;
|
||||
extern const bcstring be_const_str_lv_obj;
|
||||
extern const bcstring be_const_str_lv_obj_class;
|
||||
extern const bcstring be_const_str_lv_signal_arcs;
|
||||
extern const bcstring be_const_str_lv_signal_bars;
|
||||
extern const bcstring be_const_str_lv_wifi_arcs;
|
||||
extern const bcstring be_const_str_lv_wifi_arcs_icon;
|
||||
extern const bcstring be_const_str_lv_wifi_bars;
|
||||
extern const bcstring be_const_str_lv_wifi_bars_icon;
|
||||
extern const bcstring be_const_str_lvgl_event_dispatch;
|
||||
extern const bcstring be_const_str_make_cb;
|
||||
extern const bcstring be_const_str_map;
|
||||
|
@ -494,6 +506,7 @@ extern const bcstring be_const_str_min;
|
|||
extern const bcstring be_const_str_minute;
|
||||
extern const bcstring be_const_str_module;
|
||||
extern const bcstring be_const_str_month;
|
||||
extern const bcstring be_const_str_montserrat_font;
|
||||
extern const bcstring be_const_str_name;
|
||||
extern const bcstring be_const_str_nan;
|
||||
extern const bcstring be_const_str_nil;
|
||||
|
@ -559,6 +572,7 @@ extern const bcstring be_const_str_real;
|
|||
extern const bcstring be_const_str_reapply;
|
||||
extern const bcstring be_const_str_redirect;
|
||||
extern const bcstring be_const_str_refr_size;
|
||||
extern const bcstring be_const_str_register_button_encoder;
|
||||
extern const bcstring be_const_str_register_obj;
|
||||
extern const bcstring be_const_str_remote_ip;
|
||||
extern const bcstring be_const_str_remote_port;
|
||||
|
@ -594,6 +608,7 @@ extern const bcstring be_const_str_save;
|
|||
extern const bcstring be_const_str_save_before_restart;
|
||||
extern const bcstring be_const_str_scale_uint;
|
||||
extern const bcstring be_const_str_scan;
|
||||
extern const bcstring be_const_str_screenshot;
|
||||
extern const bcstring be_const_str_search;
|
||||
extern const bcstring be_const_str_sec;
|
||||
extern const bcstring be_const_str_seg7_font;
|
||||
|
@ -637,6 +652,8 @@ extern const bcstring be_const_str_setrange;
|
|||
extern const bcstring be_const_str_settings;
|
||||
extern const bcstring be_const_str_shared_key;
|
||||
extern const bcstring be_const_str_show;
|
||||
extern const bcstring be_const_str_signal_arcs;
|
||||
extern const bcstring be_const_str_signal_bars;
|
||||
extern const bcstring be_const_str_sin;
|
||||
extern const bcstring be_const_str_sinh;
|
||||
extern const bcstring be_const_str_size;
|
||||
|
@ -729,6 +746,10 @@ extern const bcstring be_const_str_widget_width_def;
|
|||
extern const bcstring be_const_str_width;
|
||||
extern const bcstring be_const_str_width_def;
|
||||
extern const bcstring be_const_str_wifi;
|
||||
extern const bcstring be_const_str_wifi_arcs;
|
||||
extern const bcstring be_const_str_wifi_arcs_icon;
|
||||
extern const bcstring be_const_str_wifi_bars;
|
||||
extern const bcstring be_const_str_wifi_bars_icon;
|
||||
extern const bcstring be_const_str_wire;
|
||||
extern const bcstring be_const_str_wire1;
|
||||
extern const bcstring be_const_str_wire2;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
|||
#include "be_constobj.h"
|
||||
|
||||
static be_define_const_map_slots(m_liblv_tasmota_map) {
|
||||
{ be_const_key(seg7_font, -1), be_const_func(lv0_load_seg7_font) },
|
||||
{ be_const_key(font_seg7, -1), be_const_func(lv0_load_seg7_font) },
|
||||
{ be_const_key(start, -1), be_const_func(lv0_start) },
|
||||
{ be_const_key(font_montserrat, -1), be_const_func(lv0_load_montserrat_font) },
|
||||
{ be_const_key(montserrat_font, -1), be_const_func(lv0_load_montserrat_font) },
|
||||
{ be_const_key(load_freetype_font, -1), be_const_func(lv0_load_freetype_font) },
|
||||
{ be_const_key(init, 0), be_const_closure(lv_tasmota_init_closure) },
|
||||
{ be_const_key(screenshot, 1), be_const_func(lv0_screenshot) },
|
||||
{ be_const_key(register_button_encoder, -1), be_const_func(lv0_register_button_encoder) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
m_liblv_tasmota_map,
|
||||
9
|
||||
);
|
||||
|
||||
static be_define_const_module(
|
||||
m_liblv_tasmota,
|
||||
"lv_tasmota"
|
||||
);
|
||||
|
||||
BE_EXPORT_VARIABLE be_define_const_native_module(lv_tasmota);
|
|
@ -0,0 +1,3 @@
|
|||
# `autoexec.be` for module `lv` with `font_robotocondensed_latin1(size)`
|
||||
|
||||
import robotocondensed_latin1
|
|
@ -0,0 +1,22 @@
|
|||
# Extend module `lv` with `font_robotocondensed_latin1(size)`
|
||||
|
||||
var font_robotocondensed_latin1 = module("font_robotocondensed_latin1")
|
||||
|
||||
font_robotocondensed_latin1.init = def (m)
|
||||
import lv
|
||||
var wd = tasmota.wd # save current working dir
|
||||
|
||||
lv.font_robotocondensed_latin1 = def (size)
|
||||
return lv.load_font("A:" + wd + "robotocondensed_latin1_" + str(size) + ".bin")
|
||||
end
|
||||
end
|
||||
|
||||
return font_robotocondensed_latin1
|
||||
|
||||
#-
|
||||
|
||||
font_robotocondensed_latin1.init(font_robotocondensed_latin1)
|
||||
print(lv.font_robotocondensed_latin1)
|
||||
print(lv.font_robotocondensed_latin1(32))
|
||||
|
||||
-#
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
|
||||
rm robotocondensed_latin1.tapp
|
||||
zip -j -0 robotocondensed_latin1.tapp autoexec.be robotocondensed_latin1.be robotocondensed_latin1_12.bin robotocondensed_latin1_16.bin robotocondensed_latin1_24.bin robotocondensed_latin1_32.bin
|
||||
|
|
@ -11,18 +11,8 @@
|
|||
#include "lv_theme_openhasp.h"
|
||||
|
||||
extern int lv0_member(bvm *vm); // resolve virtual members
|
||||
|
||||
extern int lv0_start(bvm *vm);
|
||||
|
||||
extern int lv0_register_button_encoder(bvm *vm); // add buttons with encoder logic
|
||||
|
||||
extern int lv0_load_montserrat_font(bvm *vm);
|
||||
extern int lv0_load_seg7_font(bvm *vm);
|
||||
extern int lv0_load_robotocondensed_latin1_font(bvm *vm);
|
||||
extern int lv0_load_font(bvm *vm);
|
||||
extern int lv0_load_freetype_font(bvm *vm);
|
||||
|
||||
extern int lv0_screenshot(bvm *vm);
|
||||
|
||||
static int lv_get_hor_res(void) {
|
||||
return lv_disp_get_hor_res(lv_disp_get_default());
|
||||
|
@ -655,29 +645,54 @@ const be_const_member_t lv0_constants[] = {
|
|||
{ "TEXT_FLAG_FIT", LV_TEXT_FLAG_FIT },
|
||||
{ "TEXT_FLAG_NONE", LV_TEXT_FLAG_NONE },
|
||||
{ "TEXT_FLAG_RECOLOR", LV_TEXT_FLAG_RECOLOR },
|
||||
{ "&font_montserrat", (int32_t) &lv0_load_montserrat_font },
|
||||
{ "&font_robotocondensed_latin1", (int32_t) &lv0_load_robotocondensed_latin1_font },
|
||||
{ "&font_seg7", (int32_t) &lv0_load_seg7_font },
|
||||
{ "&load_font", (int32_t) &lv0_load_font },
|
||||
{ "&load_freetype_font", (int32_t) &lv0_load_freetype_font },
|
||||
{ "&montserrat_font", (int32_t) &lv0_load_montserrat_font },
|
||||
{ "®ister_button_encoder", (int32_t) &lv0_register_button_encoder },
|
||||
{ "&screenshot", (int32_t) &lv0_screenshot },
|
||||
{ "&seg7_font", (int32_t) &lv0_load_seg7_font },
|
||||
|
||||
};
|
||||
|
||||
const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]);
|
||||
|
||||
/* generated */
|
||||
/********************************************************************
|
||||
** Solidified function: lv_module_init
|
||||
********************************************************************/
|
||||
be_local_closure(lv_lv_module_init, /* name */
|
||||
be_nested_proto(
|
||||
3, /* nstack */
|
||||
1, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 2]) { /* constants */
|
||||
/* K0 */ be_nested_str(lv),
|
||||
/* K1 */ be_nested_str(member),
|
||||
}),
|
||||
&be_const_str_lv_module_init,
|
||||
&be_const_str_solidified,
|
||||
( &(const binstruction[ 6]) { /* code */
|
||||
0x6004000B, // 0000 GETGBL R1 G11
|
||||
0x58080000, // 0001 LDCONST R2 K0
|
||||
0x7C040200, // 0002 CALL R1 1
|
||||
0x88080101, // 0003 GETMBR R2 R0 K1
|
||||
0x90060202, // 0004 SETMBR R1 K1 R2
|
||||
0x80040200, // 0005 RET 1 R1
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified module: lv
|
||||
********************************************************************/
|
||||
be_local_module(lv,
|
||||
"lv",
|
||||
be_nested_map(2,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_nested_key("member", 719708611, 6, -1), be_const_func(lv0_member) },
|
||||
{ be_nested_key("start", 1697318111, 5, 0), be_const_func(lv0_start) },
|
||||
{ be_const_key(init, -1), be_const_closure(lv_lv_module_init_closure) },
|
||||
{ be_const_key(member, 0), be_const_func(lv0_member) },
|
||||
}))
|
||||
);
|
||||
BE_EXPORT_VARIABLE be_define_const_native_module(lv);
|
||||
|
||||
/********************************************************************/
|
||||
|
|
|
@ -19,7 +19,7 @@ extern int lco_toint(bvm *vm); // generic function
|
|||
extern int lv_x_member(bvm *vm);
|
||||
extern int lv_x_tostring(bvm *vm); // generic function
|
||||
|
||||
extern int lvs_init(bvm *vm);
|
||||
extern int lv_be_style_init(bvm *vm);
|
||||
extern int lv_x_tostring(bvm *vm);
|
||||
|
||||
BE_EXPORT_VARIABLE extern const bclass be_class_lv_obj;
|
||||
|
@ -879,7 +879,7 @@ be_local_class(lv_style,
|
|||
NULL,
|
||||
be_nested_map(4,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_nested_key("init", 380752755, 4, -1), be_const_func(lvs_init) },
|
||||
{ be_nested_key("init", 380752755, 4, -1), be_const_func(lv_be_style_init) },
|
||||
{ be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lv_x_tostring) },
|
||||
{ be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) },
|
||||
{ be_nested_key("member", 719708611, 6, 0), be_const_func(lv_x_member) },
|
||||
|
|
|
@ -2,17 +2,7 @@
|
|||
// Functions
|
||||
// ======================================================================
|
||||
|
||||
register_button_encoder=&lv0_register_button_encoder
|
||||
|
||||
montserrat_font=&lv0_load_montserrat_font
|
||||
seg7_font=&lv0_load_seg7_font
|
||||
font_montserrat=&lv0_load_montserrat_font
|
||||
font_seg7=&lv0_load_seg7_font
|
||||
font_robotocondensed_latin1=&lv0_load_robotocondensed_latin1_font
|
||||
load_font=&lv0_load_font
|
||||
load_freetype_font=&lv0_load_freetype_font
|
||||
|
||||
screenshot=&lv0_screenshot
|
||||
|
||||
// ======================================================================
|
||||
// Colors
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#- ------------------------------------------------------------ -#
|
||||
# Module `lv` - allows to extend the soidified `lv` module
|
||||
#- ------------------------------------------------------------ -#
|
||||
lv = module("lv")
|
||||
|
||||
# rename `lv` to `lv_ntv` and replace `lv` with `lv_tasmota`
|
||||
def lv_module_init(lv_solidified)
|
||||
var lv_new = module("lv") # create a dynamic module
|
||||
lv_new.member = lv_solidified.member
|
||||
# lv_new.lv_solidified = lv_solidified
|
||||
return lv_new
|
||||
end
|
||||
|
||||
lv.init = lv_module_init
|
||||
|
||||
def lv0_member_ntv() end
|
||||
|
||||
lv.member = lv0_member_ntv
|
||||
|
||||
return lv
|
|
@ -13,6 +13,9 @@ extern void be_load_lv_color_class(bvm *vm);
|
|||
extern void be_load_lv_font_class(bvm *vm);
|
||||
extern void be_load_LVGL_glob_class(bvm *vm);
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Load all LVGL classes, including widgets
|
||||
\*********************************************************************************************/
|
||||
void be_load_lvgl_classes(bvm *vm) {
|
||||
be_load_lv_color_class(vm);
|
||||
be_load_lv_font_class(vm);
|
||||
|
@ -20,7 +23,7 @@ void be_load_lvgl_classes(bvm *vm) {
|
|||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Support for lv
|
||||
* Retrieve the value of `self._p`
|
||||
\*********************************************************************************************/
|
||||
// Get the `_p` member of instance at `index`
|
||||
void * lv_get_arg(bvm *vm, int index) {
|
||||
|
@ -56,9 +59,12 @@ int lv_x_tostring(bvm *vm) {
|
|||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Support for lv_style
|
||||
* Support for lv_style `init()`
|
||||
*
|
||||
* Either encapsulate the pointer passed as `comptr` as arg1
|
||||
* Or allocate a new empty style structure in memory. In this case, it is never freed.
|
||||
\*********************************************************************************************/
|
||||
int lvs_init(bvm *vm) {
|
||||
int lv_be_style_init(bvm *vm) {
|
||||
int argc = be_top(vm);
|
||||
lv_style_t * style = NULL;
|
||||
|
||||
|
@ -66,6 +72,7 @@ int lvs_init(bvm *vm) {
|
|||
style = (lv_style_t*) be_convert_single_elt(vm, 2, NULL, NULL);
|
||||
}
|
||||
if (style == NULL) {
|
||||
// if no valid pointer passed, allocate a new empty style
|
||||
style = (lv_style_t*) be_malloc(vm, sizeof(lv_style_t));
|
||||
if (style == NULL) {
|
||||
be_throw(vm, BE_MALLOC_FAIL);
|
||||
|
|
|
@ -438,7 +438,7 @@ extern int lco_toint(bvm *vm); // generic function
|
|||
extern int lv_x_member(bvm *vm);
|
||||
extern int lv_x_tostring(bvm *vm); // generic function
|
||||
|
||||
extern int lvs_init(bvm *vm);
|
||||
extern int lv_be_style_init(bvm *vm);
|
||||
extern int lv_x_tostring(bvm *vm);
|
||||
|
||||
BE_EXPORT_VARIABLE extern const bclass be_class_lv_obj;
|
||||
|
@ -485,7 +485,7 @@ be_local_class(lv_style,
|
|||
NULL,
|
||||
be_nested_map(4,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_nested_key("init", 380752755, 4, -1), be_const_func(lvs_init) },
|
||||
{ be_nested_key("init", 380752755, 4, -1), be_const_func(lv_be_style_init) },
|
||||
{ be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lv_x_tostring) },
|
||||
{ be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) },
|
||||
{ be_nested_key("member", 719708611, 6, 0), be_const_func(lv_x_member) },
|
||||
|
@ -660,18 +660,8 @@ print("""/********************************************************************
|
|||
#include "lv_theme_openhasp.h"
|
||||
|
||||
extern int lv0_member(bvm *vm); // resolve virtual members
|
||||
|
||||
extern int lv0_start(bvm *vm);
|
||||
|
||||
extern int lv0_register_button_encoder(bvm *vm); // add buttons with encoder logic
|
||||
|
||||
extern int lv0_load_montserrat_font(bvm *vm);
|
||||
extern int lv0_load_seg7_font(bvm *vm);
|
||||
extern int lv0_load_robotocondensed_latin1_font(bvm *vm);
|
||||
extern int lv0_load_font(bvm *vm);
|
||||
extern int lv0_load_freetype_font(bvm *vm);
|
||||
|
||||
extern int lv0_screenshot(bvm *vm);
|
||||
|
||||
static int lv_get_hor_res(void) {
|
||||
return lv_disp_get_hor_res(lv_disp_get_default());
|
||||
|
@ -763,16 +753,53 @@ print("""
|
|||
|
||||
const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]);
|
||||
|
||||
/* generated */
|
||||
/********************************************************************
|
||||
** Solidified function: lv_module_init
|
||||
********************************************************************/
|
||||
be_local_closure(lv_lv_module_init, /* name */
|
||||
be_nested_proto(
|
||||
3, /* nstack */
|
||||
1, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 3]) { /* constants */
|
||||
/* K0 */ be_nested_str(lv),
|
||||
/* K1 */ be_nested_str(member),
|
||||
/* K2 */ be_nested_str(lv_solidified),
|
||||
}),
|
||||
&be_const_str_lv_module_init,
|
||||
&be_const_str_solidified,
|
||||
( &(const binstruction[ 7]) { /* code */
|
||||
0x6004000B, // 0000 GETGBL R1 G11
|
||||
0x58080000, // 0001 LDCONST R2 K0
|
||||
0x7C040200, // 0002 CALL R1 1
|
||||
0x88080101, // 0003 GETMBR R2 R0 K1
|
||||
0x90060202, // 0004 SETMBR R1 K1 R2
|
||||
0x90060400, // 0005 SETMBR R1 K2 R0
|
||||
0x80040200, // 0006 RET 1 R1
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified module: lv
|
||||
********************************************************************/
|
||||
be_local_module(lv,
|
||||
"lv",
|
||||
be_nested_map(2,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_nested_key("member", 719708611, 6, -1), be_const_func(lv0_member) },
|
||||
{ be_nested_key("start", 1697318111, 5, 0), be_const_func(lv0_start) },
|
||||
{ be_const_key(init, -1), be_const_closure(lv_lv_module_init_closure) },
|
||||
{ be_const_key(member, 0), be_const_func(lv0_member) },
|
||||
}))
|
||||
);
|
||||
BE_EXPORT_VARIABLE be_define_const_native_module(lv);
|
||||
/********************************************************************/
|
||||
""")
|
||||
|
||||
print("/********************************************************************/")
|
||||
|
|
|
@ -179,17 +179,7 @@ print("""// ====================================================================
|
|||
// Functions
|
||||
// ======================================================================
|
||||
|
||||
register_button_encoder=&lv0_register_button_encoder
|
||||
|
||||
montserrat_font=&lv0_load_montserrat_font
|
||||
seg7_font=&lv0_load_seg7_font
|
||||
font_montserrat=&lv0_load_montserrat_font
|
||||
font_seg7=&lv0_load_seg7_font
|
||||
font_robotocondensed_latin1=&lv0_load_robotocondensed_latin1_font
|
||||
load_font=&lv0_load_font
|
||||
load_freetype_font=&lv0_load_freetype_font
|
||||
|
||||
screenshot=&lv0_screenshot
|
||||
|
||||
// ======================================================================
|
||||
// Colors
|
||||
|
|
|
@ -26,8 +26,8 @@ stat_line.refr_size()
|
|||
stat_line.refr_pos() # new in LVGL8
|
||||
|
||||
#- display wifi strength indicator icon (for professionals ;) -#
|
||||
wifi_icon = lv_wifi_arcs_icon(stat_line) # the widget takes care of positioning and driver stuff
|
||||
clock_icon = lv_clock_icon(stat_line)
|
||||
wifi_icon = lv.wifi_arcs_icon(stat_line) # the widget takes care of positioning and driver stuff
|
||||
clock_icon = lv.clock_icon(stat_line)
|
||||
|
||||
#- create a style for the buttons -#
|
||||
btn_style = lv.style()
|
||||
|
|
Binary file not shown.
|
@ -324,14 +324,14 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
|||
LV_FONT_DECLARE(robotocondensed_regular_44_latin1) \
|
||||
LV_FONT_DECLARE(robotocondensed_regular_48_latin1) \
|
||||
|
||||
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1
|
||||
#define ROBOTOCONDENSED_REGULAR_14_LATIN1 1
|
||||
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
|
||||
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_14_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_20_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_22_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
|
||||
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_28_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
|
||||
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_36_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_38_LATIN1 0
|
||||
#define ROBOTOCONDENSED_REGULAR_40_LATIN1 0
|
||||
|
|
|
@ -50,6 +50,7 @@ const char berry_prog[] =
|
|||
|
||||
#ifdef USE_LVGL
|
||||
"import lv "
|
||||
"import lv_tasmota "
|
||||
// create the '_lvgl' global singleton
|
||||
"_lvgl = LVGL_glob() "
|
||||
|
||||
|
|
Loading…
Reference in New Issue