Merge branch 'arendst:development' into feature/can-bus

This commit is contained in:
Marius Bezuidenhout 2021-07-13 17:11:43 +02:00 committed by GitHub
commit ef6b79a450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 3075 additions and 2005 deletions

View File

@ -8,10 +8,12 @@ All notable changes to this project will be documented in this file.
- Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW (#11939)
- MQTT minimum password length restriction in GUI (#12553)
- Command ``SetOption127 1`` to force Wifi in no-sleep mode even if ``Sleep 0`` is not enabled
- IRremoteESP8266 library from v2.7.18 to v2.7.19
- Support for Technoline WS2300-15 Anemometer (#12573)
- Support for Telaire T6700 Series CO2 sensor by Alexander Savchenko (#12618)
### Changed
- ESP32 core library from v1.0.7 to v1.0.7.1
- IRremoteESP8266 library from v2.7.18 to v2.7.19
- ESP32 Ethernet Phy Type information to IDF v3+
- Allow buttons to work in AP normal mode (#12518)
- Enable Ping and rule features for any device compiled with more than 1M flash size (#12539)
@ -26,6 +28,7 @@ All notable changes to this project will be documented in this file.
- AM2320 value reporting (#12552)
- Exception 28 when unable to send MQTT message and a topic name without a slash '/' (#12555)
- Wi-Fi initial setup workaround for 11n only routers (#12566)
- ESP32 do not use chip temperature sensor as global temperature if external temperature sensor is used (#12630)
## [9.5.0.1] 20210701
### Added

View File

@ -93,4 +93,5 @@ Index | Define | Driver | Device | Address(es) | Description
57 | USE_TOF10120 | xsns_84 | TOF10120 | 0x52 | Time-of-flight (ToF) distance sensor
58 | USE_MPU_ACCEL | xsns_85 | MPU_ACCEL| 0x68 | MPU6886/MPU9250 6-axis MotionTracking sensor from M5Stack
59 | USE_BM8563 | xdrv_56 | BM8563 | 0x51 | BM8563 RTC from M5Stack
60 | USE_AM2320 | xsns_88 | AM2320 | 0x5C | Temperature and Humidity sensor
60 | USE_AM2320 | xsns_88 | AM2320 | 0x5C | Temperature and Humidity sensor
61 | USE_T67XX | xsns_89 | T67XX | 0x15 | CO2 sensor

View File

@ -19,6 +19,8 @@ See [RELEASENOTES.md](https://github.com/arendst/Tasmota/blob/master/RELEASENOTE
Firmware binaries can be downloaded from http://ota.tasmota.com/tasmota/release/ or http://ota.tasmota.com/tasmota32/release/ for ESP32 binaries.
Easy initial installation of Tasmota can be performed using the [Tasmota WebInstaller](https://arendst.github.io/Tasmota/).
## Development
[![Dev Version](https://img.shields.io/badge/development%20version-v9.5.x.x-blue.svg)](https://github.com/arendst/Tasmota)

View File

@ -38,6 +38,10 @@ In addition to TLS using fingerprints now also user supplied CA certs, AWS IoT a
For initial configuration this release supports Webserver based **WifiManager** or **Serial** based command interface only. Support for **WPS** and **SmartConfig** has been removed.
## Initial installation
Easy initial installation of Tasmota can be performed using the [Tasmota WebInstaller](https://arendst.github.io/Tasmota/).
## Provided Binary Downloads
### ESP8266 or ESP8285 based
@ -52,7 +56,6 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- **tasmota-display.bin** = The Display version without Energy Monitoring but adds display support for 1M+ flash.
- **tasmota-zbbridge.bin** = The dedicated Sonoff Zigbee Bridge version for 2M+ flash.
- **tasmota-zigbee.bin** = The dedicated cc25xx Zigbee Bridge version for 4M+ flash.
- **tasmota-minimal.bin** = The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter for 1M+ flash. This version **should NOT be used for initial installation**.
Above binaries are also available as gzipped version allowing faster uploads.
@ -97,15 +100,19 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
## Changelog v9.5.0.2
### Added
- Release of [Tasmota WebInstaller](https://arendst.github.io/Tasmota/)
- Command ``SetOption127 1`` to force Wifi in no-sleep mode even if ``Sleep 0`` is not enabled
- Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW [#11939](https://github.com/arendst/Tasmota/issues/11939)
- Berry ESP32 partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465)
- Support for AM2320 Temperature and Humidity Sensor by Lars Wessels [#12485](https://github.com/arendst/Tasmota/issues/12485)
- Rule event support as JSON payload [#12496](https://github.com/arendst/Tasmota/issues/12496)
- MQTT minimum password length restriction in GUI [#12553](https://github.com/arendst/Tasmota/issues/12553)
- Support for Technoline WS2300-15 Anemometer [#12573](https://github.com/arendst/Tasmota/issues/12573)
- Support for Telaire T6700 Series CO2 sensor by Alexander Savchenko [#12618](https://github.com/arendst/Tasmota/issues/12618)
### Changed
- ESP32 core library from v1.0.6 to v1.0.7.1
- IRremoteESP8266 library from v2.7.18 to v2.7.19
- ESP32 Ethernet Phy Type information to IDF v3+
- Speed up initial GUI console refresh
- Enable UFILESYS, GUI_TRASH_FILE and GUI_EDIT_FILE for any device compiled with more than 1M flash size
@ -128,6 +135,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Zigbee Hue angle encoding [#12545](https://github.com/arendst/Tasmota/issues/12545)
- Exception 28 when unable to send MQTT message and a topic name without a slash '/' [#12555](https://github.com/arendst/Tasmota/issues/12555)
- Wi-Fi initial setup workaround for 11n only routers [#12566](https://github.com/arendst/Tasmota/issues/12566)
- ESP32 do not use chip temperature sensor as global temperature if external temperature sensor is used [#12630](https://github.com/arendst/Tasmota/issues/12630)
### Noted
- ESP32 single core **tasmota32solo1.bin** binary can only be uploaded using the GUI as OTA upload will trigger the watchdog timer

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_M5STACK_Core2 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue",
"extra_flags": "-DARDUINO_M5STACK_Core2 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ODROID_ESP32 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue",
"extra_flags": "-DARDUINO_ODROID_ESP32 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",

View File

@ -27,24 +27,47 @@ extern int lv0_screenshot(bvm *vm);
static int lv_get_hor_res(void) {
return lv_disp_get_hor_res(lv_disp_get_default());
}
static int lv_get_ver_res(bvm *vm) {
static int lv_get_ver_res(void) {
return lv_disp_get_ver_res(lv_disp_get_default());
}
/* `lv` methods */
const lvbe_call_c_t lv_func[] = {
// resolution
{ "draw_arc", (void*) &lv_draw_arc, "", "iiiii(lv_area)(lv_draw_line_dsc)" },
{ "draw_img", (void*) &lv_draw_img, "", "(lv_area)(lv_area).(lv_draw_img_dsc)" },
{ "draw_img_dsc_init", (void*) &lv_draw_img_dsc_init, "", "(lv_draw_img_dsc)" },
{ "draw_label", (void*) &lv_draw_label, "", "(lv_area)(lv_area)(lv_draw_label_dsc)s(lv_draw_label_hint)" },
{ "draw_label_dsc_init", (void*) &lv_draw_label_dsc_init, "", "(lv_draw_label_dsc)" },
{ "draw_line", (void*) &lv_draw_line, "", "(lv_point)(lv_point)(lv_area)(lv_draw_line_dsc)" },
{ "draw_line_dsc_init", (void*) &lv_draw_line_dsc_init, "", "(lv_draw_line_dsc)" },
{ "draw_mask_add", (void*) &lv_draw_mask_add, "i", ".." },
{ "draw_mask_angle_init", (void*) &lv_draw_mask_angle_init, "", "(lv_draw_mask_angle_param)iiii" },
{ "draw_mask_fade_init", (void*) &lv_draw_mask_fade_init, "", "(lv_draw_mask_fade_param)(lv_area)iiii" },
{ "draw_mask_get_cnt", (void*) &lv_draw_mask_get_cnt, "i", "" },
{ "draw_mask_line_angle_init", (void*) &lv_draw_mask_line_angle_init, "", "(lv_draw_mask_line_param)iii(lv_draw_mask_line_side)" },
{ "draw_mask_line_points_init", (void*) &lv_draw_mask_line_points_init, "", "(lv_draw_mask_line_param)iiii(lv_draw_mask_line_side)" },
{ "draw_mask_map_init", (void*) &lv_draw_mask_map_init, "", "(lv_draw_mask_map_param)(lv_area)(lv_opa)" },
{ "draw_mask_radius_init", (void*) &lv_draw_mask_radius_init, "", "(lv_draw_mask_radius_param)(lv_area)ib" },
{ "draw_mask_remove_custom", (void*) &lv_draw_mask_remove_custom, ".", "." },
{ "draw_mask_remove_id", (void*) &lv_draw_mask_remove_id, ".", "i" },
{ "draw_polygon", (void*) &lv_draw_polygon, "", "ii(lv_area)(lv_draw_rect_dsc)" },
{ "draw_px", (void*) &lv_draw_px, "", "(lv_point)(lv_area)(lv_style)" },
{ "draw_rect", (void*) &lv_draw_rect, "", "(lv_area)(lv_area)(lv_draw_rect_dsc)" },
{ "draw_triangle", (void*) &lv_draw_triangle, "", "i(lv_area)(lv_draw_rect_dsc)" },
{ "event_get_data", (void*) &lv_event_get_data, ".", "" },
{ "event_send", (void*) &lv_event_send, "i", "(lv_obj)i." },
{ "event_send_refresh", (void*) &lv_event_send_refresh, "i", "(lv_obj)" },
{ "event_send_refresh_recursive", (void*) &lv_event_send_refresh_recursive, "", "(lv_obj)" },
{ "get_hor_res", (void*) &lv_get_hor_res, "i", "" },
{ "get_ver_res", (void*) &lv_get_ver_res, "i", "" },
// layers
{ "layer_sys", (void*) &lv_layer_sys, "lv_obj", "" },
{ "layer_top", (void*) &lv_layer_top, "lv_obj", "" },
// screens
{ "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
{ "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)(lv_scr_load_anim)iib" },
{ "signal_send", (void*) &lv_signal_send, "i", "(lv_obj)i." },
};
const size_t lv_func_size = sizeof(lv_func) / sizeof(lv_func[0]);
@ -160,6 +183,19 @@ const be_constint_t lv0_constants[] = {
{ "DRAG_DIR_HOR", LV_DRAG_DIR_HOR },
{ "DRAG_DIR_ONE", LV_DRAG_DIR_ONE },
{ "DRAG_DIR_VER", LV_DRAG_DIR_VER },
{ "DRAW_MASK_LINE_SIDE_BOTTOM", LV_DRAW_MASK_LINE_SIDE_BOTTOM },
{ "DRAW_MASK_LINE_SIDE_LEFT", LV_DRAW_MASK_LINE_SIDE_LEFT },
{ "DRAW_MASK_LINE_SIDE_RIGHT", LV_DRAW_MASK_LINE_SIDE_RIGHT },
{ "DRAW_MASK_LINE_SIDE_TOP", LV_DRAW_MASK_LINE_SIDE_TOP },
{ "DRAW_MASK_RES_CHANGED", LV_DRAW_MASK_RES_CHANGED },
{ "DRAW_MASK_RES_FULL_COVER", LV_DRAW_MASK_RES_FULL_COVER },
{ "DRAW_MASK_RES_TRANSP", LV_DRAW_MASK_RES_TRANSP },
{ "DRAW_MASK_RES_UNKNOWN", LV_DRAW_MASK_RES_UNKNOWN },
{ "DRAW_MASK_TYPE_ANGLE", LV_DRAW_MASK_TYPE_ANGLE },
{ "DRAW_MASK_TYPE_FADE", LV_DRAW_MASK_TYPE_FADE },
{ "DRAW_MASK_TYPE_LINE", LV_DRAW_MASK_TYPE_LINE },
{ "DRAW_MASK_TYPE_MAP", LV_DRAW_MASK_TYPE_MAP },
{ "DRAW_MASK_TYPE_RADIUS", LV_DRAW_MASK_TYPE_RADIUS },
{ "DROPDOWN_DIR_DOWN", LV_DROPDOWN_DIR_DOWN },
{ "DROPDOWN_DIR_LEFT", LV_DROPDOWN_DIR_LEFT },
{ "DROPDOWN_DIR_RIGHT", LV_DROPDOWN_DIR_RIGHT },
@ -496,11 +532,7 @@ const be_constint_t lv0_constants[] = {
};
const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]);
#if !BE_USE_PRECOMPILED_OBJECT
//#if 1 // TODO we will do pre-compiled later
be_native_module_attr_table(lvgl) {
// Symbols
@ -582,8 +614,6 @@ be_native_module_attr_table(lvgl) {
be_native_module_function("load_freetype_font", lv0_load_freetype_font),
be_native_module_function("screenshot", lv0_screenshot),
};
be_define_native_module(lvgl, NULL);
@ -729,9 +759,6 @@ module lvgl (scope: global) {
load_freetype_font, func(lv0_load_freetype_font)
screenshot, func(lv0_screenshot)
}
@const_object_info_end */
#include "../generate/be_fixed_lvgl.h"

View File

@ -0,0 +1,216 @@
/********************************************************************
* Tasmota LVGL callbacks
*
*******************************************************************/
#include "be_constobj.h"
extern int lv0_init(bvm *vm);
extern int lvx_tostring(bvm *vm);
extern int be_call_c_func(bvm *vm, void * func, const char * return_type, const char * arg_type);
int lv_cb_call_any(bvm *vm, const char * return_type, const char * arg_type) {
int argc = be_top(vm);
// get pointer to callback
be_getmember(vm, 1, ".p");
void * cb = be_tocomptr(vm, -1);
be_pop(vm, 1);
// remove first argument which is the instance `self`
for (int i=1; i<argc; i++) {
be_moveto(vm, i+1, i);
}
be_pop(vm, 1);
// call callback
return be_call_c_func(vm, cb, return_type, arg_type);
}
int lv_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "i", NULL);
}
// 'lv_group_focus_cb'
// typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
int lv_group_focus_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "", "(lv_group)");
}
// 'lv_event_cb'
// typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event);
int lv_event_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "", "(lv_obj)");
}
// 'lv_signal_cb'
// typedef lv_res_t (*lv_signal_cb_t)(struct _lv_obj_t * obj, lv_signal_t sign, void * param);
int lv_signal_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "i", "(lv_obj)i.");
}
// 'lv_design_cb'
// typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
int lv_design_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "i", "(lv_obj)(lv_area)i");
}
// 'lv_gauge_format_cb'
// typedef void (*lv_gauge_format_cb_t)(lv_obj_t * gauge, char * buf, int bufsize, int32_t value);
int lv_gauge_format_cb_call(bvm *vm) {
return lv_cb_call_any(vm, "", "(lv_obj).ii");
}
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_lvgl_cb.h"
#endif
void be_load_lvgl_cb_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ ".p", NULL },
{ "init", lv0_init },
{ "tostring", lvx_tostring },
{ "()", lv_cb_call },
// { NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
// { "get_tasmota", (bntvfunc) &get_tasmota_closure },
// { "add_cmd", (bntvfunc) &add_cmd_closure },
{ NULL, NULL }
};
be_regclass(vm, "lv_cb", members);
#else
be_pushntvclass(vm, &be_lvgl_cb);
be_setglobal(vm, "lv_cb");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin
class be_lvgl_cb (scope: global, name: lv_cb) {
.p, var
init, func(lv0_init)
tostring, func(lvx_tostring)
call, func(lv_cb_call)
}
@const_object_info_end */
// instanciate all callbacks as sub-classes
// 'lv_group_focus_cb'
// 'lv_event_cb'
// 'lv_signal_cb'
// 'lv_design_cb'
// 'lv_gauge_format_cb'
//
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_lv_group_focus_cb.h"
#include "../generate/be_fixed_be_lv_event_cb.h"
#include "../generate/be_fixed_be_lv_signal_cb.h"
#include "../generate/be_fixed_be_lv_design_cb.h"
#include "../generate/be_fixed_be_lv_gauge_format_cb.h"
#endif
void be_load_lvgl_cb_all_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_group_focus_cb[] = {
{ "()", lv_group_focus_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_group_focus_cb", members);
be_getglobal(vm, "lv_group_focus_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_group_focus_cb);
be_setglobal(vm, "lv_group_focus_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_event_cb[] = {
{ "()", lv_event_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_event_cb", members);
be_getglobal(vm, "lv_event_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_event_cb);
be_setglobal(vm, "lv_event_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_signal_cb[] = {
{ "()", lv_signal_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_signal_cb", members);
be_getglobal(vm, "lv_signal_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_signal_cb);
be_setglobal(vm, "lv_signal_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_design_cb[] = {
{ "()", lv_design_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_design_cb", members);
be_getglobal(vm, "lv_design_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_design_cb);
be_setglobal(vm, "lv_design_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_gauge_format_cb[] = {
{ "()", lv_gauge_format_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_gauge_format_cb", members);
be_getglobal(vm, "lv_gauge_format_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_gauge_format_cb);
be_setglobal(vm, "lv_gauge_format_cb");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin
class be_lv_group_focus_cb (scope: global, name: lv_group_focus_cb, super: be_lvgl_cb) {
call, func(lv_group_focus_cb_call)
}
class be_lv_event_cb (scope: global, name: lv_event_cb, super: be_lvgl_cb) {
call, func(lv_event_cb_call)
}
class be_lv_signal_cb (scope: global, name: lv_signal_cb, super: be_lvgl_cb) {
call, func(lv_signal_cb_call)
}
class be_lv_design_cb (scope: global, name: lv_design_cb, super: be_lvgl_cb) {
call, func(lv_design_cb_call)
}
class be_lv_gauge_format_cb (scope: global, name: lv_gauge_format_cb, super: be_lvgl_cb) {
call, func(lv_gauge_format_cb_call)
}
@const_object_info_end */

View File

@ -83,8 +83,19 @@ typedef struct be_ctypes_classes_t {
// const be_ctypes_class_t * g_ctypes_classes = NULL;
// extern void berry_log_C(const char * berry_buf, ...);
//
// Constructor for ctypes structure
//
// If no arg: allocate a bytes() structure of the right size, filled with zeroes
// Arg1 is instance self
// If arg 2 is int (and not null): copy the data to the bytes structure
int be_ctypes_init(bvm *vm) {
int argc = be_top(vm);
void * src_data = NULL;
if (argc > 1 && (be_isint(vm, 2) || be_iscomptr(vm,2))) {
src_data = (void*) be_toint(vm, 2);
}
// get global array of classes from global variable '.ctypes_classes'
be_getglobal(vm, ".ctypes_classes");
const be_ctypes_classes_t * be_ctypes_classes = (const be_ctypes_classes_t *) be_tocomptr(vm, -1);
@ -125,6 +136,18 @@ int be_ctypes_init(bvm *vm) {
be_pushint(vm, definitions->size_bytes);
be_call(vm, 2);
be_pop(vm, 3);
// if src_data then copy source data to the new structure
if (src_data) {
// call self._buffer()
be_getmember(vm, 1, "_buffer");
be_pushvalue(vm, 1);
be_call(vm, 1); // call with 1 parameter
void * dst_data = be_tocomptr(vm, -2);
be_pop(vm, 2);
// copy data
memmove(dst_data, src_data, definitions->size_bytes);
}
}
be_return(vm);

View File

@ -98,7 +98,7 @@ void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes
/********************************************************************
* Generated code, don't edit
*******************************************************************/
const be_ctypes_structure_t be_lv_point_t = {
const be_ctypes_structure_t be_lv_point = {
4, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -106,7 +106,7 @@ const be_ctypes_structure_t be_lv_point_t = {
{ "y", 2, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_area_t = {
const be_ctypes_structure_t be_lv_area = {
8, /* size in bytes */
4, /* number of elements */
(const be_ctypes_structure_item_t[4]) {
@ -116,7 +116,7 @@ const be_ctypes_structure_t be_lv_area_t = {
{ "y2", 6, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_rect_dsc_t = {
const be_ctypes_structure_t be_lv_draw_rect_dsc = {
77, /* size in bytes */
43, /* number of elements */
(const be_ctypes_structure_item_t[43]) {
@ -165,7 +165,7 @@ const be_ctypes_structure_t be_lv_draw_rect_dsc_t = {
{ "value_str", 56, 0, 0, 4 },
}};
const be_ctypes_structure_t be_lv_draw_line_dsc_t = {
const be_ctypes_structure_t be_lv_draw_line_dsc = {
10, /* size in bytes */
9, /* number of elements */
(const be_ctypes_structure_item_t[9]) {
@ -180,7 +180,7 @@ const be_ctypes_structure_t be_lv_draw_line_dsc_t = {
{ "width", 2, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_img_dsc_t = {
const be_ctypes_structure_t be_lv_draw_img_dsc = {
14, /* size in bytes */
9, /* number of elements */
(const be_ctypes_structure_item_t[9]) {
@ -195,7 +195,7 @@ const be_ctypes_structure_t be_lv_draw_img_dsc_t = {
{ "zoom", 7, 0, 0, 2 },
}};
const be_ctypes_structure_t be_lv_draw_label_dsc_t = {
const be_ctypes_structure_t be_lv_draw_label_dsc = {
31, /* size in bytes */
15, /* number of elements */
(const be_ctypes_structure_item_t[15]) {
@ -216,7 +216,7 @@ const be_ctypes_structure_t be_lv_draw_label_dsc_t = {
{ "sel_start", 15, 0, 0, 4 },
}};
const be_ctypes_structure_t be_lv_draw_mask_common_dsc_t = {
const be_ctypes_structure_t be_lv_draw_mask_common_dsc = {
5, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -224,7 +224,7 @@ const be_ctypes_structure_t be_lv_draw_mask_common_dsc_t = {
{ "type", 4, 0, 0, 1 },
}};
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg = {
9, /* size in bytes */
5, /* number of elements */
(const be_ctypes_structure_item_t[5]) {
@ -235,7 +235,7 @@ const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg_t = {
{ "side", 8, 0, 2, 0 },
}};
const be_ctypes_structure_t be_lv_draw_mask_line_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_line_param = {
35, /* size in bytes */
15, /* number of elements */
(const be_ctypes_structure_item_t[15]) {
@ -256,7 +256,7 @@ const be_ctypes_structure_t be_lv_draw_mask_line_param_t = {
{ "yx_steep", 22, 0, 0, 14 },
}};
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg = {
8, /* size in bytes */
4, /* number of elements */
(const be_ctypes_structure_item_t[4]) {
@ -266,7 +266,7 @@ const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg_t = {
{ "vertex_p_y", 2, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_mask_angle_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_angle_param = {
85, /* size in bytes */
37, /* number of elements */
(const be_ctypes_structure_item_t[37]) {
@ -309,7 +309,7 @@ const be_ctypes_structure_t be_lv_draw_mask_angle_param_t = {
{ "start_line_yx_steep", 35, 0, 0, 14 },
}};
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg = {
11, /* size in bytes */
6, /* number of elements */
(const be_ctypes_structure_item_t[6]) {
@ -321,7 +321,7 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg_t = {
{ "rect_y2", 6, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_sqrt_res_t = {
const be_ctypes_structure_t be_lv_sqrt_res = {
4, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -329,7 +329,7 @@ const be_ctypes_structure_t be_lv_sqrt_res_t = {
{ "i", 0, 0, 0, 2 },
}};
const be_ctypes_structure_t be_lv_draw_mask_radius_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_radius_param = {
24, /* size in bytes */
11, /* number of elements */
(const be_ctypes_structure_item_t[11]) {
@ -346,7 +346,7 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param_t = {
{ "y_prev_x_i", 20, 0, 0, 2 },
}};
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg = {
14, /* size in bytes */
8, /* number of elements */
(const be_ctypes_structure_item_t[8]) {
@ -360,7 +360,7 @@ const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg_t = {
{ "y_top", 8, 0, 0, 12 },
}};
const be_ctypes_structure_t be_lv_draw_mask_fade_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_fade_param = {
19, /* size in bytes */
10, /* number of elements */
(const be_ctypes_structure_item_t[10]) {
@ -376,7 +376,7 @@ const be_ctypes_structure_t be_lv_draw_mask_fade_param_t = {
{ "dsc_type", 4, 0, 0, 1 },
}};
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg_t = {
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg = {
12, /* size in bytes */
5, /* number of elements */
(const be_ctypes_structure_item_t[5]) {
@ -387,7 +387,7 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg_t = {
{ "map", 8, 0, 0, 4 },
}};
const be_ctypes_structure_t be_lv_draw_mask_map_param_t = {
const be_ctypes_structure_t be_lv_draw_mask_map_param = {
17, /* size in bytes */
7, /* number of elements */
(const be_ctypes_structure_item_t[7]) {
@ -400,7 +400,7 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param_t = {
{ "dsc_type", 4, 0, 0, 1 },
}};
const be_ctypes_structure_t be_lv_draw_mask_saved_t = {
const be_ctypes_structure_t be_lv_draw_mask_saved = {
8, /* size in bytes */
2, /* number of elements */
(const be_ctypes_structure_item_t[2]) {
@ -411,48 +411,48 @@ const be_ctypes_structure_t be_lv_draw_mask_saved_t = {
const be_ctypes_classes_t be_ctypes_classes[] = {
19,
(const be_ctypes_class_t[19]) {
{ "lv_area_t", &be_lv_area_t },
{ "lv_draw_img_dsc_t", &be_lv_draw_img_dsc_t },
{ "lv_draw_label_dsc_t", &be_lv_draw_label_dsc_t },
{ "lv_draw_line_dsc_t", &be_lv_draw_line_dsc_t },
{ "lv_draw_mask_angle_param_cfg_t", &be_lv_draw_mask_angle_param_cfg_t },
{ "lv_draw_mask_angle_param_t", &be_lv_draw_mask_angle_param_t },
{ "lv_draw_mask_common_dsc_t", &be_lv_draw_mask_common_dsc_t },
{ "lv_draw_mask_fade_param_cfg_t", &be_lv_draw_mask_fade_param_cfg_t },
{ "lv_draw_mask_fade_param_t", &be_lv_draw_mask_fade_param_t },
{ "lv_draw_mask_line_param_cfg_t", &be_lv_draw_mask_line_param_cfg_t },
{ "lv_draw_mask_line_param_t", &be_lv_draw_mask_line_param_t },
{ "lv_draw_mask_map_param_cfg_t", &be_lv_draw_mask_map_param_cfg_t },
{ "lv_draw_mask_map_param_t", &be_lv_draw_mask_map_param_t },
{ "lv_draw_mask_radius_param_cfg_t", &be_lv_draw_mask_radius_param_cfg_t },
{ "lv_draw_mask_radius_param_t", &be_lv_draw_mask_radius_param_t },
{ "lv_draw_mask_saved_t", &be_lv_draw_mask_saved_t },
{ "lv_draw_rect_dsc_t", &be_lv_draw_rect_dsc_t },
{ "lv_point_t", &be_lv_point_t },
{ "lv_sqrt_res_t", &be_lv_sqrt_res_t },
{ "lv_area", &be_lv_area },
{ "lv_draw_img_dsc", &be_lv_draw_img_dsc },
{ "lv_draw_label_dsc", &be_lv_draw_label_dsc },
{ "lv_draw_line_dsc", &be_lv_draw_line_dsc },
{ "lv_draw_mask_angle_param", &be_lv_draw_mask_angle_param },
{ "lv_draw_mask_angle_param_cfg", &be_lv_draw_mask_angle_param_cfg },
{ "lv_draw_mask_common_dsc", &be_lv_draw_mask_common_dsc },
{ "lv_draw_mask_fade_param", &be_lv_draw_mask_fade_param },
{ "lv_draw_mask_fade_param_cfg", &be_lv_draw_mask_fade_param_cfg },
{ "lv_draw_mask_line_param", &be_lv_draw_mask_line_param },
{ "lv_draw_mask_line_param_cfg", &be_lv_draw_mask_line_param_cfg },
{ "lv_draw_mask_map_param", &be_lv_draw_mask_map_param },
{ "lv_draw_mask_map_param_cfg", &be_lv_draw_mask_map_param_cfg },
{ "lv_draw_mask_radius_param", &be_lv_draw_mask_radius_param },
{ "lv_draw_mask_radius_param_cfg", &be_lv_draw_mask_radius_param_cfg },
{ "lv_draw_mask_saved", &be_lv_draw_mask_saved },
{ "lv_draw_rect_dsc", &be_lv_draw_rect_dsc },
{ "lv_point", &be_lv_point },
{ "lv_sqrt_res", &be_lv_sqrt_res },
}};
/* @const_object_info_begin
class be_class_ctypes_classes (scope: global) {
lv_area_t, int(0)
lv_draw_img_dsc_t, int(0)
lv_draw_label_dsc_t, int(0)
lv_draw_line_dsc_t, int(0)
lv_draw_mask_angle_param_cfg_t, int(0)
lv_draw_mask_angle_param_t, int(0)
lv_draw_mask_common_dsc_t, int(0)
lv_draw_mask_fade_param_cfg_t, int(0)
lv_draw_mask_fade_param_t, int(0)
lv_draw_mask_line_param_cfg_t, int(0)
lv_draw_mask_line_param_t, int(0)
lv_draw_mask_map_param_cfg_t, int(0)
lv_draw_mask_map_param_t, int(0)
lv_draw_mask_radius_param_cfg_t, int(0)
lv_draw_mask_radius_param_t, int(0)
lv_draw_mask_saved_t, int(0)
lv_draw_rect_dsc_t, int(0)
lv_point_t, int(0)
lv_sqrt_res_t, int(0)
lv_area, int(0)
lv_draw_img_dsc, int(0)
lv_draw_label_dsc, int(0)
lv_draw_line_dsc, int(0)
lv_draw_mask_angle_param, int(0)
lv_draw_mask_angle_param_cfg, int(0)
lv_draw_mask_common_dsc, int(0)
lv_draw_mask_fade_param, int(0)
lv_draw_mask_fade_param_cfg, int(0)
lv_draw_mask_line_param, int(0)
lv_draw_mask_line_param_cfg, int(0)
lv_draw_mask_map_param, int(0)
lv_draw_mask_map_param_cfg, int(0)
lv_draw_mask_radius_param, int(0)
lv_draw_mask_radius_param_cfg, int(0)
lv_draw_mask_saved, int(0)
lv_draw_rect_dsc, int(0)
lv_point, int(0)
lv_sqrt_res, int(0)
}
@const_object_info_end */
@ -461,44 +461,44 @@ void be_load_ctypes_definitions_lib(bvm *vm) {
be_setglobal(vm, ".ctypes_classes");
be_pop(vm, 1);
static be_define_const_empty_class(be_class_lv_area_t, &be_class_lv_ctypes, lv_area_t);
ctypes_register_class(vm, &be_class_lv_area_t, &be_lv_area_t);
static be_define_const_empty_class(be_class_lv_draw_img_dsc_t, &be_class_lv_ctypes, lv_draw_img_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_img_dsc_t, &be_lv_draw_img_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_label_dsc_t, &be_class_lv_ctypes, lv_draw_label_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_label_dsc_t, &be_lv_draw_label_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_line_dsc_t, &be_class_lv_ctypes, lv_draw_line_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_line_dsc_t, &be_lv_draw_line_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_angle_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg_t, &be_lv_draw_mask_angle_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_t, &be_class_lv_ctypes, lv_draw_mask_angle_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_t, &be_lv_draw_mask_angle_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_common_dsc_t, &be_class_lv_ctypes, lv_draw_mask_common_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc_t, &be_lv_draw_mask_common_dsc_t);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_fade_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg_t, &be_lv_draw_mask_fade_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_t, &be_class_lv_ctypes, lv_draw_mask_fade_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_t, &be_lv_draw_mask_fade_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_line_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg_t, &be_lv_draw_mask_line_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_t, &be_class_lv_ctypes, lv_draw_mask_line_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_t, &be_lv_draw_mask_line_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_map_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg_t, &be_lv_draw_mask_map_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_t, &be_class_lv_ctypes, lv_draw_mask_map_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_t, &be_lv_draw_mask_map_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_cfg_t, &be_class_lv_ctypes, lv_draw_mask_radius_param_cfg_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg_t, &be_lv_draw_mask_radius_param_cfg_t);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_t, &be_class_lv_ctypes, lv_draw_mask_radius_param_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_t, &be_lv_draw_mask_radius_param_t);
static be_define_const_empty_class(be_class_lv_draw_mask_saved_t, &be_class_lv_ctypes, lv_draw_mask_saved_t);
ctypes_register_class(vm, &be_class_lv_draw_mask_saved_t, &be_lv_draw_mask_saved_t);
static be_define_const_empty_class(be_class_lv_draw_rect_dsc_t, &be_class_lv_ctypes, lv_draw_rect_dsc_t);
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc_t, &be_lv_draw_rect_dsc_t);
static be_define_const_empty_class(be_class_lv_point_t, &be_class_lv_ctypes, lv_point_t);
ctypes_register_class(vm, &be_class_lv_point_t, &be_lv_point_t);
static be_define_const_empty_class(be_class_lv_sqrt_res_t, &be_class_lv_ctypes, lv_sqrt_res_t);
ctypes_register_class(vm, &be_class_lv_sqrt_res_t, &be_lv_sqrt_res_t);
static be_define_const_empty_class(be_class_lv_area, &be_class_lv_ctypes, lv_area);
ctypes_register_class(vm, &be_class_lv_area, &be_lv_area);
static be_define_const_empty_class(be_class_lv_draw_img_dsc, &be_class_lv_ctypes, lv_draw_img_dsc);
ctypes_register_class(vm, &be_class_lv_draw_img_dsc, &be_lv_draw_img_dsc);
static be_define_const_empty_class(be_class_lv_draw_label_dsc, &be_class_lv_ctypes, lv_draw_label_dsc);
ctypes_register_class(vm, &be_class_lv_draw_label_dsc, &be_lv_draw_label_dsc);
static be_define_const_empty_class(be_class_lv_draw_line_dsc, &be_class_lv_ctypes, lv_draw_line_dsc);
ctypes_register_class(vm, &be_class_lv_draw_line_dsc, &be_lv_draw_line_dsc);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param, &be_class_lv_ctypes, lv_draw_mask_angle_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_cfg, &be_class_lv_ctypes, lv_draw_mask_angle_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_common_dsc, &be_class_lv_ctypes, lv_draw_mask_common_dsc);
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param, &be_class_lv_ctypes, lv_draw_mask_fade_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_cfg, &be_class_lv_ctypes, lv_draw_mask_fade_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param, &be_class_lv_ctypes, lv_draw_mask_line_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param, &be_lv_draw_mask_line_param);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_cfg, &be_class_lv_ctypes, lv_draw_mask_line_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param, &be_class_lv_ctypes, lv_draw_mask_map_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param, &be_lv_draw_mask_map_param);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_cfg, &be_class_lv_ctypes, lv_draw_mask_map_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param, &be_class_lv_ctypes, lv_draw_mask_radius_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_cfg, &be_class_lv_ctypes, lv_draw_mask_radius_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_saved, &be_class_lv_ctypes, lv_draw_mask_saved);
ctypes_register_class(vm, &be_class_lv_draw_mask_saved, &be_lv_draw_mask_saved);
static be_define_const_empty_class(be_class_lv_draw_rect_dsc, &be_class_lv_ctypes, lv_draw_rect_dsc);
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc, &be_lv_draw_rect_dsc);
static be_define_const_empty_class(be_class_lv_point, &be_class_lv_ctypes, lv_point);
ctypes_register_class(vm, &be_class_lv_point, &be_lv_point);
static be_define_const_empty_class(be_class_lv_sqrt_res, &be_class_lv_ctypes, lv_sqrt_res);
ctypes_register_class(vm, &be_class_lv_sqrt_res, &be_lv_sqrt_res);
}
/*******************************************************************/

View File

@ -47,6 +47,16 @@ extern int lvbe_img_get_angle(bvm *vm);
extern int lvbe_img_get_pivot(bvm *vm);
extern int lvbe_img_get_zoom(bvm *vm);
extern int lvbe_img_get_antialias(bvm *vm);
extern int lvbe_img_cf_get_px_size(bvm *vm);
extern int lvbe_img_cf_is_chroma_keyed(bvm *vm);
extern int lvbe_img_cf_has_alpha(bvm *vm);
extern int lvbe_img_buf_get_px_color(bvm *vm);
extern int lvbe_img_buf_get_px_alpha(bvm *vm);
extern int lvbe_img_buf_set_px_color(bvm *vm);
extern int lvbe_img_buf_set_px_alpha(bvm *vm);
extern int lvbe_img_buf_set_palette(bvm *vm);
extern int lvbe_img_buf_free(bvm *vm);
extern int lvbe_img_buf_get_img_size(bvm *vm);
/* `lv_style` external functions definitions */
extern int lvbe_style_copy(bvm *vm);
@ -167,6 +177,7 @@ extern int lvbe_group_set_editing(bvm *vm);
extern int lvbe_group_set_click_focus(bvm *vm);
extern int lvbe_group_set_wrap(bvm *vm);
extern int lvbe_group_get_focused(bvm *vm);
extern int lvbe_group_get_focus_cb(bvm *vm);
extern int lvbe_group_get_editing(bvm *vm);
extern int lvbe_group_get_click_focus(bvm *vm);
extern int lvbe_group_get_wrap(bvm *vm);
@ -280,6 +291,9 @@ extern int lvbe_obj_get_base_dir(bvm *vm);
extern int lvbe_obj_get_protect(bvm *vm);
extern int lvbe_obj_is_protected(bvm *vm);
extern int lvbe_obj_get_state(bvm *vm);
extern int lvbe_obj_get_signal_cb(bvm *vm);
extern int lvbe_obj_get_design_cb(bvm *vm);
extern int lvbe_obj_get_event_cb(bvm *vm);
extern int lvbe_obj_is_point_on_coords(bvm *vm);
extern int lvbe_obj_hittest(bvm *vm);
extern int lvbe_obj_get_ext_attr(bvm *vm);
@ -479,6 +493,7 @@ extern int lvbe_obj_get_style_scale_grad_color(bvm *vm);
extern int lvbe_obj_set_style_local_scale_grad_color(bvm *vm);
extern int lvbe_obj_get_style_scale_end_color(bvm *vm);
extern int lvbe_obj_set_style_local_scale_end_color(bvm *vm);
extern int lvbe_obj_signal_send(bvm *vm);
/* `lv_arc` external functions definitions */
extern int lvbe_arc_create(bvm *vm);
@ -1159,11 +1174,6 @@ void be_load_lv_style_lib(bvm *vm) {
{ NULL, NULL }
};
be_regclass(vm, "lv_style", members);
be_getglobal(vm, "lv_style");
be_getglobal(vm, "lv_obj");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_class_lv_style);
be_setglobal(vm, "lv_style");
@ -1172,7 +1182,7 @@ void be_load_lv_style_lib(bvm *vm) {
};
/* @const_object_info_begin
class be_class_lv_style (scope: global, name: lv_style, super: be_class_lv_obj) {
class be_class_lv_style (scope: global, name: lv_style) {
.p, var
init, func(lvs_init)
tostring, func(lvs_tostring)
@ -1226,11 +1236,6 @@ void be_load_lv_indev_lib(bvm *vm) {
{ NULL, NULL }
};
be_regclass(vm, "lv_indev", members);
be_getglobal(vm, "lv_indev");
be_getglobal(vm, "lv_obj");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_class_lv_indev);
be_setglobal(vm, "lv_indev");
@ -1239,7 +1244,7 @@ void be_load_lv_indev_lib(bvm *vm) {
};
/* @const_object_info_begin
class be_class_lv_indev (scope: global, name: lv_indev, super: be_class_lv_obj) {
class be_class_lv_indev (scope: global, name: lv_indev) {
.p, var
init, func(lv0_init)
tostring, func(lvx_tostring)

View File

@ -102,6 +102,8 @@ extern void be_load_md5_lib(bvm *vm);
extern void be_load_lvgl_color_lib(bvm *vm);
extern void be_load_lvgl_font_lib(bvm *vm);
extern void be_load_lv_all_lib(bvm *vm);
extern void be_load_lvgl_cb_lib(bvm *vm);
extern void be_load_lvgl_cb_all_lib(bvm *vm);
extern void be_load_lvgl_ctypes_lib(bvm *vm);
extern void be_load_ctypes_definitions_lib(bvm *vm);
#endif// USE_LVGL
@ -128,6 +130,8 @@ BERRY_API void be_load_custom_libs(bvm *vm)
be_load_lvgl_font_lib(vm);
be_load_lv_all_lib(vm);
be_load_lvgl_cb_lib(vm);
be_load_lvgl_cb_all_lib(vm);
be_load_lvgl_ctypes_lib(vm);
be_load_ctypes_definitions_lib(vm);
#endif // USE_LVGL

View File

@ -1368,7 +1368,7 @@ be_local_closure(event, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[23]) { /* upvals */
( &(const bvalue[29]) { /* upvals */
{ { .s=be_nested_const_str("cmd", -158181397, 3) }, BE_STRING},
{ { .s=be_nested_const_str("exec_cmd", 493567399, 8) }, BE_STRING},
{ { .s=be_nested_const_str("rule", -64077613, 4) }, BE_STRING},
@ -1382,20 +1382,26 @@ be_local_closure(event, /* name */
{ { .s=be_nested_const_str("every_100ms", 1546407804, 11) }, BE_STRING},
{ { .s=be_nested_const_str("web_add_button", -757092238, 14) }, BE_STRING},
{ { .s=be_nested_const_str("web_add_main_button", -334599632, 19) }, BE_STRING},
{ { .s=be_nested_const_str("web_add_management_button", -1556090110, 25) }, BE_STRING},
{ { .s=be_nested_const_str("web_add_config_button", 639674325, 21) }, BE_STRING},
{ { .s=be_nested_const_str("web_add_console_button", -813531104, 22) }, BE_STRING},
{ { .s=be_nested_const_str("save_before_restart", 1253239338, 19) }, BE_STRING},
{ { .s=be_nested_const_str("web_add_handler", -304792334, 15) }, BE_STRING},
{ { .s=be_nested_const_str("web_sensor", -1394870324, 10) }, BE_STRING},
{ { .s=be_nested_const_str("json_append", -1292948012, 11) }, BE_STRING},
{ { .s=be_nested_const_str("button_pressed", 1694209616, 14) }, BE_STRING},
{ { .s=be_nested_const_str("button_preselif", 491115394, 15) }, BE_STRING},
{ { .s=be_nested_const_str("display", 1164572437, 7) }, BE_STRING},
{ { .s=be_nested_const_str("string", 398550328, 6) }, BE_STRING},
{ { .s=be_nested_const_str("log", 1062293841, 3) }, BE_STRING},
{ { .s=be_nested_const_str("format", -1180859054, 6) }, BE_STRING},
{ { .s=be_nested_const_str("BRY: Exception> '%s' - %s", -2047976332, 25) }, BE_STRING},
{ { .s=be_nested_const_str("BRY: exception %s - %m", -1290966132, 22) }, BE_STRING},
{ { .i=3 }, BE_INT},
{ { .s=be_nested_const_str("stop_iteration", -121173395, 14) }, BE_STRING},
}),
(be_nested_const_str("event", -30355297, 5)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[137]) { /* code */
( &(const binstruction[153]) { /* code */
0x1C140300, // 0000 EQ R5 R1 R256
0x78160006, // 0001 JMPF R5 #0009
0x8C140101, // 0002 GETMET R5 R0 R257
@ -1404,135 +1410,151 @@ be_local_closure(event, /* name */
0x5C240800, // 0005 MOVE R9 R4
0x7C140800, // 0006 CALL R5 4
0x80040A00, // 0007 RET 1 R5
0x7002007E, // 0008 JMP #0088
0x7002008E, // 0008 JMP #0098
0x1C140302, // 0009 EQ R5 R1 R258
0x78160004, // 000A JMPF R5 #0010
0x8C140103, // 000B GETMET R5 R0 R259
0x5C1C0800, // 000C MOVE R7 R4
0x7C140400, // 000D CALL R5 2
0x80040A00, // 000E RET 1 R5
0x70020077, // 000F JMP #0088
0x70020087, // 000F JMP #0098
0x1C140304, // 0010 EQ R5 R1 R260
0x78160002, // 0011 JMPF R5 #0015
0x4C140000, // 0012 LDNIL 5
0x80040A00, // 0013 RET 1 R5
0x70020072, // 0014 JMP #0088
0x70020082, // 0014 JMP #0098
0x1C140305, // 0015 EQ R5 R1 R261
0x78160003, // 0016 JMPF R5 #001B
0x8C140105, // 0017 GETMET R5 R0 R261
0x7C140200, // 0018 CALL R5 1
0x80040A00, // 0019 RET 1 R5
0x7002006C, // 001A JMP #0088
0x7002007C, // 001A JMP #0098
0x1C140306, // 001B EQ R5 R1 R262
0x78160003, // 001C JMPF R5 #0021
0x8C140107, // 001D GETMET R5 R0 R263
0x7C140200, // 001E CALL R5 1
0x80040A00, // 001F RET 1 R5
0x70020066, // 0020 JMP #0088
0x70020076, // 0020 JMP #0098
0x88140108, // 0021 GETMBR R5 R0 R264
0x78160064, // 0022 JMPF R5 #0088
0x78160074, // 0022 JMPF R5 #0098
0x60140000, // 0023 GETGBL R5 G0
0x88180108, // 0024 GETMBR R6 R0 R264
0x7C140200, // 0025 CALL R5 1
0xA802005D, // 0026 EXBLK 0 #0085
0xA802006D, // 0026 EXBLK 0 #0095
0x5C180A00, // 0027 MOVE R6 R5
0x7C180000, // 0028 CALL R6 0
0xA802004D, // 0029 EXBLK 0 #0078
0xA802005E, // 0029 EXBLK 0 #0089
0x1C1C0309, // 002A EQ R7 R1 R265
0x781E0004, // 002B JMPF R7 #0031
0x881C0D09, // 002C GETMBR R7 R6 R265
0x781E0002, // 002D JMPF R7 #0031
0x8C1C0D09, // 002E GETMET R7 R6 R265
0x7C1C0200, // 002F CALL R7 1
0x70020044, // 0030 JMP #0076
0x70020055, // 0030 JMP #0087
0x1C1C030A, // 0031 EQ R7 R1 R266
0x781E0004, // 0032 JMPF R7 #0038
0x881C0D0A, // 0033 GETMBR R7 R6 R266
0x781E0002, // 0034 JMPF R7 #0038
0x8C1C0D0A, // 0035 GETMET R7 R6 R266
0x7C1C0200, // 0036 CALL R7 1
0x7002003D, // 0037 JMP #0076
0x7002004E, // 0037 JMP #0087
0x1C1C030B, // 0038 EQ R7 R1 R267
0x781E0004, // 0039 JMPF R7 #003F
0x881C0D0B, // 003A GETMBR R7 R6 R267
0x781E0002, // 003B JMPF R7 #003F
0x8C1C0D0B, // 003C GETMET R7 R6 R267
0x7C1C0200, // 003D CALL R7 1
0x70020036, // 003E JMP #0076
0x70020047, // 003E JMP #0087
0x1C1C030C, // 003F EQ R7 R1 R268
0x781E0004, // 0040 JMPF R7 #0046
0x881C0D0C, // 0041 GETMBR R7 R6 R268
0x781E0002, // 0042 JMPF R7 #0046
0x8C1C0D0C, // 0043 GETMET R7 R6 R268
0x7C1C0200, // 0044 CALL R7 1
0x7002002F, // 0045 JMP #0076
0x70020040, // 0045 JMP #0087
0x1C1C030D, // 0046 EQ R7 R1 R269
0x781E0004, // 0047 JMPF R7 #004D
0x881C0D0D, // 0048 GETMBR R7 R6 R269
0x781E0002, // 0049 JMPF R7 #004D
0x8C1C0D0D, // 004A GETMET R7 R6 R269
0x7C1C0200, // 004B CALL R7 1
0x70020028, // 004C JMP #0076
0x70020039, // 004C JMP #0087
0x1C1C030E, // 004D EQ R7 R1 R270
0x781E0004, // 004E JMPF R7 #0054
0x881C0D0E, // 004F GETMBR R7 R6 R270
0x781E0002, // 0050 JMPF R7 #0054
0x8C1C0D0E, // 0051 GETMET R7 R6 R270
0x7C1C0200, // 0052 CALL R7 1
0x70020021, // 0053 JMP #0076
0x70020032, // 0053 JMP #0087
0x1C1C030F, // 0054 EQ R7 R1 R271
0x781E0004, // 0055 JMPF R7 #005B
0x881C0D0F, // 0056 GETMBR R7 R6 R271
0x781E0002, // 0057 JMPF R7 #005B
0x8C1C0D0F, // 0058 GETMET R7 R6 R271
0x7C1C0200, // 0059 CALL R7 1
0x7002001A, // 005A JMP #0076
0x7002002B, // 005A JMP #0087
0x1C1C0310, // 005B EQ R7 R1 R272
0x781E0004, // 005C JMPF R7 #0062
0x881C0D10, // 005D GETMBR R7 R6 R272
0x781E0002, // 005E JMPF R7 #0062
0x8C1C0D10, // 005F GETMET R7 R6 R272
0x7C1C0200, // 0060 CALL R7 1
0x70020013, // 0061 JMP #0076
0x70020024, // 0061 JMP #0087
0x1C1C0311, // 0062 EQ R7 R1 R273
0x781E0004, // 0063 JMPF R7 #0069
0x881C0D11, // 0064 GETMBR R7 R6 R273
0x781E0002, // 0065 JMPF R7 #0069
0x8C1C0D11, // 0066 GETMET R7 R6 R273
0x7C1C0200, // 0067 CALL R7 1
0x7002000C, // 0068 JMP #0076
0x1C1C030E, // 0069 EQ R7 R1 R270
0x7002001D, // 0068 JMP #0087
0x1C1C0312, // 0069 EQ R7 R1 R274
0x781E0004, // 006A JMPF R7 #0070
0x881C0D12, // 006B GETMBR R7 R6 R274
0x781E0002, // 006C JMPF R7 #0070
0x8C1C0D12, // 006D GETMET R7 R6 R274
0x7C1C0200, // 006E CALL R7 1
0x70020005, // 006F JMP #0076
0x1C1C0312, // 0070 EQ R7 R1 R274
0x781E0003, // 0071 JMPF R7 #0076
0x881C0D12, // 0072 GETMBR R7 R6 R274
0x781E0001, // 0073 JMPF R7 #0076
0x8C1C0D12, // 0074 GETMET R7 R6 R274
0x70020016, // 006F JMP #0087
0x1C1C0313, // 0070 EQ R7 R1 R275
0x781E0004, // 0071 JMPF R7 #0077
0x881C0D13, // 0072 GETMBR R7 R6 R275
0x781E0002, // 0073 JMPF R7 #0077
0x8C1C0D13, // 0074 GETMET R7 R6 R275
0x7C1C0200, // 0075 CALL R7 1
0xA8040001, // 0076 EXBLK 1 1
0x7002000B, // 0077 JMP #0084
0xAC1C0002, // 0078 CATCH R7 0 2
0x70020008, // 0079 JMP #0083
0xA4262600, // 007A IMPORT R9 R275
0x6028000F, // 007B GETGBL R10 G15
0x8C2C1314, // 007C GETMET R11 R9 R276
0x58340015, // 007D LDCONST R13 K21
0x5C380E00, // 007E MOVE R14 R7
0x5C3C1000, // 007F MOVE R15 R8
0x7C2C0800, // 0080 CALL R11 4
0x7C280200, // 0081 CALL R10 1
0x70020000, // 0082 JMP #0084
0xB0080000, // 0083 RAISE 2 R0 R0
0x7001FFA1, // 0084 JMP #0027
0x58140016, // 0085 LDCONST R5 K22
0xAC140200, // 0086 CATCH R5 1 0
0xB0080000, // 0087 RAISE 2 R0 R0
0x80000000, // 0088 RET 0 R0
0x7002000F, // 0076 JMP #0087
0x1C1C0314, // 0077 EQ R7 R1 R276
0x781E0007, // 0078 JMPF R7 #0081
0x881C0D14, // 0079 GETMBR R7 R6 R276
0x781E0005, // 007A JMPF R7 #0081
0x1C1C0311, // 007B EQ R7 R1 R273
0x781DFFFE, // 007C JMPF R7 #007C
0x881C0D16, // 007D GETMBR R7 R6 R278
0x8C1C0D16, // 007E GETMET R7 R6 R278
0x7C1C0200, // 007F CALL R7 1
0x70020005, // 0080 JMP #0087
0x1C1C0316, // 0081 EQ R7 R1 R278
0x781E0003, // 0082 JMPF R7 #0087
0x881C0D16, // 0083 GETMBR R7 R6 R278
0x781E0001, // 0084 JMPF R7 #0087
0x8C1C0D16, // 0085 GETMET R7 R6 R278
0x7C1C0200, // 0086 CALL R7 1
0xA8040001, // 0087 EXBLK 1 1
0x7002000A, // 0088 JMP #0094
0xAC1C0002, // 0089 CATCH R7 0 2
0x70020007, // 008A JMP #0093
0xA4262E00, // 008B IMPORT R9 R279
0x8C280118, // 008C GETMET R10 R0 R280
0x8C301319, // 008D GETMET R12 R9 R281
0x5838001A, // 008E LDCONST R14 K26
0x583C001B, // 008F LDCONST R15 K27
0x7C300600, // 0090 CALL R12 3
0x7C280400, // 0091 CALL R10 2
0x70020000, // 0092 JMP #0094
0xB0080000, // 0093 RAISE 2 R0 R0
0x7001FF91, // 0094 JMP #0027
0x5814001C, // 0095 LDCONST R5 K28
0xAC140200, // 0096 CATCH R5 1 0
0xB0080000, // 0097 RAISE 2 R0 R0
0x80000000, // 0098 RET 0 R0
})
)
);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,25 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_ctypes_classes_map) {
{ be_const_key(lv_draw_mask_line_param_cfg_t, 1), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param_t, 8), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param_cfg_t, 12), be_const_int(0) },
{ be_const_key(lv_draw_mask_saved_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param_t, 9), be_const_int(0) },
{ be_const_key(lv_area_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_cfg_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_line_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_label_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_common_dsc_t, 2), be_const_int(0) },
{ be_const_key(lv_draw_rect_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_cfg_t, -1), be_const_int(0) },
{ be_const_key(lv_sqrt_res_t, 7), be_const_int(0) },
{ be_const_key(lv_point_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_cfg_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_t, 15), be_const_int(0) },
{ be_const_key(lv_draw_img_dsc_t, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_img_dsc, 14), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param, -1), be_const_int(0) },
{ be_const_key(lv_point, 4), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_cfg, 5), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param, -1), be_const_int(0) },
{ be_const_key(lv_draw_label_dsc, -1), be_const_int(0) },
{ be_const_key(lv_area, 17), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_cfg, 3), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_saved, 12), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_rect_dsc, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param, -1), be_const_int(0) },
{ be_const_key(lv_draw_line_dsc, 15), be_const_int(0) },
{ be_const_key(lv_draw_mask_common_dsc, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param, -1), be_const_int(0) },
{ be_const_key(lv_sqrt_res, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param, 13), be_const_int(0) },
};
static be_define_const_map(

View File

@ -0,0 +1,20 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_lv_draw_line_map) {
{ be_const_key(init, 2), be_const_func(lvbe_draw_line_create) },
{ be_const_key(tostring, -1), be_const_func(lvx_tostring) },
{ be_const_key(dot_p, -1), be_const_int(0) },
{ be_const_key(member, 0), be_const_func(lvx_member) },
};
static be_define_const_map(
be_class_lv_draw_line_map,
4
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_draw_line,
1,
NULL,
lv_draw_line
);

View File

@ -15,6 +15,6 @@ static be_define_const_map(
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_indev,
1,
(bclass *)&be_class_lv_obj,
NULL,
lv_indev
);

View File

@ -15,6 +15,6 @@ static be_define_const_map(
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_style,
1,
(bclass *)&be_class_lv_obj,
NULL,
lv_style
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_design_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_design_cb_call) },
};
static be_define_const_map(
be_lv_design_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_design_cb,
0,
(bclass *)&be_lvgl_cb,
lv_design_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_event_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_event_cb_call) },
};
static be_define_const_map(
be_lv_event_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_event_cb,
0,
(bclass *)&be_lvgl_cb,
lv_event_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_gauge_format_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_gauge_format_cb_call) },
};
static be_define_const_map(
be_lv_gauge_format_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_gauge_format_cb,
0,
(bclass *)&be_lvgl_cb,
lv_gauge_format_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_group_focus_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_group_focus_cb_call) },
};
static be_define_const_map(
be_lv_group_focus_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_group_focus_cb,
0,
(bclass *)&be_lvgl_cb,
lv_group_focus_cb
);

View File

@ -0,0 +1,17 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lv_signal_cb_map) {
{ be_const_key(call, -1), be_const_func(lv_signal_cb_call) },
};
static be_define_const_map(
be_lv_signal_cb_map,
1
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lv_signal_cb,
0,
(bclass *)&be_lvgl_cb,
lv_signal_cb
);

View File

@ -0,0 +1,20 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_lvgl_cb_map) {
{ be_const_key(dot_p, -1), be_const_int(0) },
{ be_const_key(tostring, 2), be_const_func(lvx_tostring) },
{ be_const_key(call, -1), be_const_func(lv_cb_call) },
{ be_const_key(init, 0), be_const_func(lv0_init) },
};
static be_define_const_map(
be_lvgl_cb_map,
4
);
BE_EXPORT_VARIABLE be_define_const_class(
be_lvgl_cb,
1,
NULL,
lv_cb
);

View File

@ -55,19 +55,19 @@ build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_TASMOTA32
[env:tasmota32-webcam]
extends = env:tasmota32_base
board = esp32-cam
build_flags = ${env:tasmota32_base.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround -DFIRMWARE_WEBCAM
build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_WEBCAM
lib_extra_dirs = lib/libesp32, lib/lib_basic
[env:tasmota32-odroidgo]
extends = env:tasmota32_base
board = esp32-odroid
build_flags = ${env:tasmota32_base.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround -DFIRMWARE_ODROID_GO
build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_ODROID_GO
lib_extra_dirs = lib/libesp32, lib/lib_basic, lib/lib_i2c, lib/lib_rf, lib/lib_div, lib/lib_ssl, lib/lib_display
[env:tasmota32-core2]
extends = env:tasmota32_base
board = esp32-m5core2
build_flags = ${env:tasmota32_base.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround -DFIRMWARE_M5STACK_CORE2
build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_M5STACK_CORE2
lib_extra_dirs = lib/libesp32, lib/lib_basic, lib/lib_i2c, lib/lib_rf, lib/lib_div, lib/lib_ssl, lib/lib_display, lib/lib_audio
[env:tasmota32-bluetooth]

View File

@ -10,17 +10,17 @@ import ctypes
ctypes.print_types()
lv_style_int_t = ctypes.i16
lv_color_t = ctypes.u16 # depends on colors
lv_grad_dir_t = ctypes.u8
lv_opa_t = ctypes.u8
lv_blend_mode_t = ctypes.u8
lv_align_t = ctypes.u8
lv_coord_t = ctypes.i16
lv_bidi_dir_t = ctypes.u8
lv_txt_flag_t = ctypes.u8
lv_text_decor_t = ctypes.u8
lv_font_t = ctypes.u32
lv_style_int = ctypes.i16
lv_color = ctypes.u16 # depends on colors
lv_grad_dir = ctypes.u8
lv_opa = ctypes.u8
lv_blend_mode = ctypes.u8
lv_align = ctypes.u8
lv_coord = ctypes.i16
lv_bidi_dir = ctypes.u8
lv_txt_flag = ctypes.u8
lv_text_decor = ctypes.u8
lv_font = ctypes.u32
uint8_t_1 = ctypes.bf_1
uint8_t_2 = ctypes.bf_2
uint8_t = ctypes.u8
@ -29,158 +29,158 @@ uint32_t = ctypes.u32
int32_t = ctypes.i32
ptr = ctypes.u32
lv_point_t = [
[lv_coord_t, "x"],
[lv_coord_t, "y"],
lv_point = [
[lv_coord, "x"],
[lv_coord, "y"],
]
lv_point_t = ctypes.structure(lv_point_t, "lv_point_t")
lv_point = ctypes.structure(lv_point, "lv_point")
lv_area_t = [
[lv_coord_t, "x1"],
[lv_coord_t, "y1"],
[lv_coord_t, "x2"],
[lv_coord_t, "y2"],
lv_area = [
[lv_coord, "x1"],
[lv_coord, "y1"],
[lv_coord, "x2"],
[lv_coord, "y2"],
]
lv_area_t = ctypes.structure(lv_area_t, "lv_area_t")
lv_area = ctypes.structure(lv_area, "lv_area")
# test_t = [
# [lv_area_t, "a"],
# [lv_area_t, "b"]
# [lv_area, "a"],
# [lv_area, "b"]
# ]
# test_t = ctypes.structure(test_t, "test_t")
lv_draw_rect_dsc_t = [
[lv_style_int_t, "radius"],
lv_draw_rect_dsc = [
[lv_style_int, "radius"],
#/*Background*/
[lv_color_t, "bg_color"],
[lv_color_t, "bg_grad_color"],
[lv_grad_dir_t, "bg_grad_dir"],
[lv_style_int_t, "bg_main_color_stop"],
[lv_style_int_t, "bg_grad_color_stop"],
[lv_opa_t, "bg_opa"],
[lv_blend_mode_t, "bg_blend_mode"],
[lv_color, "bg_color"],
[lv_color, "bg_grad_color"],
[lv_grad_dir, "bg_grad_dir"],
[lv_style_int, "bg_main_color_stop"],
[lv_style_int, "bg_grad_color_stop"],
[lv_opa, "bg_opa"],
[lv_blend_mode, "bg_blend_mode"],
#/*Border*/
[lv_color_t, "border_color"],
[lv_style_int_t, "border_width"],
[lv_style_int_t, "border_side"],
[lv_opa_t, "border_opa"],
[lv_blend_mode_t, "border_blend_mode"],
[lv_color, "border_color"],
[lv_style_int, "border_width"],
[lv_style_int, "border_side"],
[lv_opa, "border_opa"],
[lv_blend_mode, "border_blend_mode"],
[uint8_t_1, "border_post"],
#/*Outline*/
[lv_color_t, "outline_color"],
[lv_style_int_t, "outline_width"],
[lv_style_int_t, "outline_pad"],
[lv_opa_t, "outline_opa"],
[lv_blend_mode_t, "outline_blend_mode"],
[lv_color, "outline_color"],
[lv_style_int, "outline_width"],
[lv_style_int, "outline_pad"],
[lv_opa, "outline_opa"],
[lv_blend_mode, "outline_blend_mode"],
#/*Shadow*/
[lv_color_t, "shadow_color"],
[lv_style_int_t, "shadow_width"],
[lv_style_int_t, "shadow_ofs_x"],
[lv_style_int_t, "shadow_ofs_y"],
[lv_style_int_t, "shadow_spread"],
[lv_opa_t, "shadow_opa"],
[lv_blend_mode_t, "shadow_blend_mode"],
[lv_color, "shadow_color"],
[lv_style_int, "shadow_width"],
[lv_style_int, "shadow_ofs_x"],
[lv_style_int, "shadow_ofs_y"],
[lv_style_int, "shadow_spread"],
[lv_opa, "shadow_opa"],
[lv_blend_mode, "shadow_blend_mode"],
#/*Pattern*/
[ptr, "pattern_image"],
[ptr, "pattern_font"],
[lv_color_t, "pattern_recolor"],
[lv_opa_t, "pattern_opa"],
[lv_opa_t, "pattern_recolor_opa"],
[lv_color, "pattern_recolor"],
[lv_opa, "pattern_opa"],
[lv_opa, "pattern_recolor_opa"],
[uint8_t_1, "pattern_repeat"],
[lv_blend_mode_t, "pattern_blend_mode"],
[lv_blend_mode, "pattern_blend_mode"],
#/*Value*/
[ptr, "value_str"],
[ptr, "value_font"],
[lv_opa_t, "value_opa"],
[lv_color_t, "value_color"],
[lv_style_int_t, "value_ofs_x"],
[lv_style_int_t, "value_ofs_y"],
[lv_style_int_t, "value_letter_space"],
[lv_style_int_t, "value_line_space"],
[lv_align_t, "value_align"],
[lv_blend_mode_t, "value_blend_mode"],
[lv_opa, "value_opa"],
[lv_color, "value_color"],
[lv_style_int, "value_ofs_x"],
[lv_style_int, "value_ofs_y"],
[lv_style_int, "value_letter_space"],
[lv_style_int, "value_line_space"],
[lv_align, "value_align"],
[lv_blend_mode, "value_blend_mode"],
]
lv_draw_rect_dsc_t = ctypes.structure(lv_draw_rect_dsc_t, "lv_draw_rect_dsc_t")
lv_draw_rect_dsc = ctypes.structure(lv_draw_rect_dsc, "lv_draw_rect_dsc")
lv_draw_line_dsc_t = [
[lv_color_t, "color"],
[lv_style_int_t, "width"],
[lv_style_int_t, "dash_width"],
[lv_style_int_t, "dash_gap"],
[lv_opa_t, "opa"],
lv_draw_line_dsc = [
[lv_color, "color"],
[lv_style_int, "width"],
[lv_style_int, "dash_width"],
[lv_style_int, "dash_gap"],
[lv_opa, "opa"],
[uint8_t_2, "blend_mode"],
[uint8_t_1, "round_start"],
[uint8_t_1, "round_end"],
[uint8_t_1, "raw_end"],
]
lv_draw_line_dsc_t = ctypes.structure(lv_draw_line_dsc_t, "lv_draw_line_dsc_t")
lv_draw_line_dsc = ctypes.structure(lv_draw_line_dsc, "lv_draw_line_dsc")
lv_draw_img_dsc_t = [
[lv_opa_t, "opa"],
lv_draw_img_dsc = [
[lv_opa, "opa"],
[uint16_t, "angle"],
[lv_point_t, "pivot"],
[lv_point, "pivot"],
[uint16_t, "zoom"],
[lv_opa_t, "recolor_opa"],
[lv_color_t, "recolor"],
[lv_blend_mode_t, "blend_mode"],
[lv_opa, "recolor_opa"],
[lv_color, "recolor"],
[lv_blend_mode, "blend_mode"],
[uint8_t_1, "antialias"],
]
lv_draw_img_dsc_t = ctypes.structure(lv_draw_img_dsc_t, "lv_draw_img_dsc_t")
lv_draw_img_dsc = ctypes.structure(lv_draw_img_dsc, "lv_draw_img_dsc")
lv_draw_label_dsc_t = [
[lv_color_t, "color"],
[lv_color_t, "sel_color"],
[lv_color_t, "sel_bg_color"],
[lv_font_t, "font"],
[lv_opa_t, "opa"],
[lv_style_int_t, "line_space"],
[lv_style_int_t, "letter_space"],
lv_draw_label_dsc = [
[lv_color, "color"],
[lv_color, "sel_color"],
[lv_color, "sel_bg_color"],
[lv_font, "font"],
[lv_opa, "opa"],
[lv_style_int, "line_space"],
[lv_style_int, "letter_space"],
[uint32_t, "sel_start"],
[uint32_t, "sel_end"],
[lv_coord_t, "ofs_x"],
[lv_coord_t, "ofs_y"],
[lv_bidi_dir_t, "bidi_dir"],
[lv_txt_flag_t, "flag"],
[lv_text_decor_t, "decor"],
[lv_blend_mode_t, "blend_mode"],
[lv_coord, "ofs_x"],
[lv_coord, "ofs_y"],
[lv_bidi_dir, "bidi_dir"],
[lv_txt_flag, "flag"],
[lv_text_decor, "decor"],
[lv_blend_mode, "blend_mode"],
]
lv_draw_label_dsc_t = ctypes.structure(lv_draw_label_dsc_t, "lv_draw_label_dsc_t")
lv_draw_label_dsc = ctypes.structure(lv_draw_label_dsc, "lv_draw_label_dsc")
#- --------- lv_mask --------- -#
lv_draw_mask_xcb_t = ptr # callback
lv_draw_mask_type_t = ctypes.u8
lv_draw_mask_line_side_t = ctypes.u8
lv_draw_mask_xcb = ptr # callback
lv_draw_mask_type = ctypes.u8
lv_draw_mask_line_side = ctypes.u8
lv_draw_mask_common_dsc_t = [
[lv_draw_mask_xcb_t, "cb"],
[lv_draw_mask_type_t, "type"],
lv_draw_mask_common_dsc = [
[lv_draw_mask_xcb, "cb"],
[lv_draw_mask_type, "type"],
]
lv_draw_mask_common_dsc_t = ctypes.structure(lv_draw_mask_common_dsc_t, "lv_draw_mask_common_dsc_t")
lv_draw_mask_common_dsc = ctypes.structure(lv_draw_mask_common_dsc, "lv_draw_mask_common_dsc")
lv_draw_mask_line_param_cfg_t = [
lv_draw_mask_line_param_cfg = [
#/*First point */
[lv_point_t, "p1"],
[lv_point, "p1"],
#/*Second point*/
[lv_point_t, "p2"],
[lv_point, "p2"],
#/*Which side to keep?*/
[uint8_t_2, "side"],
]
lv_draw_mask_line_param_cfg_t = ctypes.structure(lv_draw_mask_line_param_cfg_t, "lv_draw_mask_line_param_cfg_t")
lv_draw_mask_line_param_cfg = ctypes.structure(lv_draw_mask_line_param_cfg, "lv_draw_mask_line_param_cfg")
lv_draw_mask_line_param_t = [
lv_draw_mask_line_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_line_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_line_param_cfg, "cfg"],
#/*A point of the line*/
[lv_point_t, "origo"],
[lv_point, "origo"],
#/* X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
[int32_t, "xy_steep"],
#/* Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
@ -195,85 +195,85 @@ lv_draw_mask_line_param_t = [
# * It is used to select left/right/top/bottom*/
[uint8_t_1, "inv"],
]
lv_draw_mask_line_param_t = ctypes.structure(lv_draw_mask_line_param_t, "lv_draw_mask_line_param_t")
lv_draw_mask_line_param = ctypes.structure(lv_draw_mask_line_param, "lv_draw_mask_line_param")
lv_draw_mask_angle_param_cfg_t = [
[lv_point_t, "vertex_p"],
[lv_coord_t, "start_angle"],
[lv_coord_t, "end_angle"],
lv_draw_mask_angle_param_cfg = [
[lv_point, "vertex_p"],
[lv_coord, "start_angle"],
[lv_coord, "end_angle"],
]
lv_draw_mask_angle_param_cfg_t = ctypes.structure(lv_draw_mask_angle_param_cfg_t, "lv_draw_mask_angle_param_cfg_t")
lv_draw_mask_angle_param_cfg = ctypes.structure(lv_draw_mask_angle_param_cfg, "lv_draw_mask_angle_param_cfg")
lv_draw_mask_angle_param_t = [
lv_draw_mask_angle_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_angle_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_angle_param_cfg, "cfg"],
[lv_draw_mask_line_param_t, "start_line"],
[lv_draw_mask_line_param_t, "end_line"],
[lv_draw_mask_line_param, "start_line"],
[lv_draw_mask_line_param, "end_line"],
[uint16_t, "delta_deg"],
]
lv_draw_mask_angle_param_t = ctypes.structure(lv_draw_mask_angle_param_t, "lv_draw_mask_angle_param_t")
lv_draw_mask_angle_param = ctypes.structure(lv_draw_mask_angle_param, "lv_draw_mask_angle_param")
lv_draw_mask_radius_param_cfg_t = [
[lv_area_t, "rect"],
[lv_coord_t, "radius"],
lv_draw_mask_radius_param_cfg = [
[lv_area, "rect"],
[lv_coord, "radius"],
[uint8_t_1, "outer"],
]
lv_draw_mask_radius_param_cfg_t = ctypes.structure(lv_draw_mask_radius_param_cfg_t, "lv_draw_mask_radius_param_cfg_t")
lv_draw_mask_radius_param_cfg = ctypes.structure(lv_draw_mask_radius_param_cfg, "lv_draw_mask_radius_param_cfg")
lv_sqrt_res_t = [
lv_sqrt_res = [
[uint16_t, "i"],
[uint16_t, "f"],
]
lv_sqrt_res_t = ctypes.structure(lv_sqrt_res_t, "lv_sqrt_res_t")
lv_sqrt_res = ctypes.structure(lv_sqrt_res, "lv_sqrt_res")
lv_draw_mask_radius_param_t = [
lv_draw_mask_radius_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_radius_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_radius_param_cfg, "cfg"],
[int32_t, "y_prev"],
[lv_sqrt_res_t, "y_prev_x"],
[lv_sqrt_res, "y_prev_x"],
]
lv_draw_mask_radius_param_t = ctypes.structure(lv_draw_mask_radius_param_t, "lv_draw_mask_radius_param_t")
lv_draw_mask_radius_param = ctypes.structure(lv_draw_mask_radius_param, "lv_draw_mask_radius_param")
lv_draw_mask_fade_param_cfg_t = [
[lv_area_t, "coords"],
[lv_coord_t, "y_top"],
[lv_coord_t, "y_bottom"],
[lv_opa_t, "opa_top"],
[lv_opa_t, "opa_bottom"],
lv_draw_mask_fade_param_cfg = [
[lv_area, "coords"],
[lv_coord, "y_top"],
[lv_coord, "y_bottom"],
[lv_opa, "opa_top"],
[lv_opa, "opa_bottom"],
]
lv_draw_mask_fade_param_cfg_t = ctypes.structure(lv_draw_mask_fade_param_cfg_t, "lv_draw_mask_fade_param_cfg_t")
lv_draw_mask_fade_param_cfg = ctypes.structure(lv_draw_mask_fade_param_cfg, "lv_draw_mask_fade_param_cfg")
lv_draw_mask_fade_param_t = [
lv_draw_mask_fade_param = [
# /*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_fade_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_fade_param_cfg, "cfg"],
]
lv_draw_mask_fade_param_t = ctypes.structure(lv_draw_mask_fade_param_t, "lv_draw_mask_fade_param_t")
lv_draw_mask_fade_param = ctypes.structure(lv_draw_mask_fade_param, "lv_draw_mask_fade_param")
lv_draw_mask_map_param_cfg_t = [
[lv_area_t, "coords"],
lv_draw_mask_map_param_cfg = [
[lv_area, "coords"],
[ptr, "map"],
]
lv_draw_mask_map_param_cfg_t = ctypes.structure(lv_draw_mask_map_param_cfg_t, "lv_draw_mask_map_param_cfg_t")
lv_draw_mask_map_param_cfg = ctypes.structure(lv_draw_mask_map_param_cfg, "lv_draw_mask_map_param_cfg")
lv_draw_mask_map_param_t = [
lv_draw_mask_map_param = [
#/*The first element must be the common descriptor*/
[lv_draw_mask_common_dsc_t, "dsc"],
[lv_draw_mask_map_param_cfg_t, "cfg"],
[lv_draw_mask_common_dsc, "dsc"],
[lv_draw_mask_map_param_cfg, "cfg"],
]
lv_draw_mask_map_param_t = ctypes.structure(lv_draw_mask_map_param_t, "lv_draw_mask_map_param_t")
lv_draw_mask_map_param = ctypes.structure(lv_draw_mask_map_param, "lv_draw_mask_map_param")
lv_draw_mask_saved_t = [
lv_draw_mask_saved = [
[ptr, "param"],
[ptr, "custom_id"],
]
lv_draw_mask_saved_t = ctypes.structure(lv_draw_mask_saved_t, "lv_draw_mask_saved_t")
lv_draw_mask_saved = ctypes.structure(lv_draw_mask_saved, "lv_draw_mask_saved")
#
ctypes.print_classes()
@ -286,7 +286,7 @@ ctypes.print_classes()
#- Ex
bb=ctypes.buffer(lv_draw_line_dsc_t)
bb=ctypes.buffer(lv_draw_line_dsc)
bb.color
bb.blend_mode
@ -302,12 +302,12 @@ bb.raw_end = 1
bb.blend_mode=0
- bytes('FFFF0000000000000010')
lv_draw_line_dsc_t = [
[lv_color_t, "color"],
[lv_style_int_t, "width"],
[lv_style_int_t, "dash_width"],
[lv_style_int_t, "dash_gap"],
[lv_opa_t, "opa"],
lv_draw_line_dsc = [
[lv_color, "color"],
[lv_style_int, "width"],
[lv_style_int, "dash_width"],
[lv_style_int, "dash_gap"],
[lv_opa, "opa"],
[uint8_t_2, "blend_mode"],
[uint8_t_1, "round_start"],
[uint8_t_1, "round_end"],

View File

@ -12,6 +12,16 @@ extern "C" {
/* `lv_img` methods */
#if BE_LV_WIDGET_IMG
const lvbe_call_c_t lv_img_func[] = {
{ "buf_free", (void*) &lv_img_buf_free, "", "(lv_img_dsc)" },
{ "buf_get_img_size", (void*) &lv_img_buf_get_img_size, "i", "ii(lv_img_cf)" },
{ "buf_get_px_alpha", (void*) &lv_img_buf_get_px_alpha, "i", "(lv_img_dsc)ii" },
{ "buf_get_px_color", (void*) &lv_img_buf_get_px_color, "lv_color", "(lv_img_dsc)ii(lv_color)" },
{ "buf_set_palette", (void*) &lv_img_buf_set_palette, "", "(lv_img_dsc)i(lv_color)" },
{ "buf_set_px_alpha", (void*) &lv_img_buf_set_px_alpha, "", "(lv_img_dsc)iii" },
{ "buf_set_px_color", (void*) &lv_img_buf_set_px_color, "", "(lv_img_dsc)ii(lv_color)" },
{ "cf_get_px_size", (void*) &lv_img_cf_get_px_size, "i", "(lv_img_cf)" },
{ "cf_has_alpha", (void*) &lv_img_cf_has_alpha, "b", "(lv_img_cf)" },
{ "cf_is_chroma_keyed", (void*) &lv_img_cf_is_chroma_keyed, "b", "(lv_img_cf)" },
{ "create", (void*) &lv_img_create, "+lv_img", "(lv_obj)(lv_obj)" },
{ "get_angle", (void*) &lv_img_get_angle, "i", "(lv_obj)" },
{ "get_antialias", (void*) &lv_img_get_antialias, "b", "(lv_obj)" },
@ -149,6 +159,7 @@ const lvbe_call_c_t lv_group_func[] = {
{ "focus_prev", (void*) &lv_group_focus_prev, "", "(lv_group)" },
{ "get_click_focus", (void*) &lv_group_get_click_focus, "b", "(lv_group)" },
{ "get_editing", (void*) &lv_group_get_editing, "b", "(lv_group)" },
{ "get_focus_cb", (void*) &lv_group_get_focus_cb, "lv_group_focus_cb", "(lv_group)" },
{ "get_focused", (void*) &lv_group_get_focused, "lv_obj", "(lv_group)" },
{ "get_wrap", (void*) &lv_group_get_wrap, "b", "(lv_group)" },
{ "remove_all_objs", (void*) &lv_group_remove_all_objs, "", "(lv_group)" },
@ -203,11 +214,13 @@ const lvbe_call_c_t lv_obj_func[] = {
{ "get_child_back", (void*) &lv_obj_get_child_back, "lv_obj", "(lv_obj)(lv_obj)" },
{ "get_click", (void*) &lv_obj_get_click, "b", "(lv_obj)" },
{ "get_coords", (void*) &lv_obj_get_coords, "", "(lv_obj)(lv_area)" },
{ "get_design_cb", (void*) &lv_obj_get_design_cb, "lv_design_cb", "(lv_obj)" },
{ "get_drag", (void*) &lv_obj_get_drag, "b", "(lv_obj)" },
{ "get_drag_dir", (void*) &lv_obj_get_drag_dir, "i", "(lv_obj)" },
{ "get_drag_parent", (void*) &lv_obj_get_drag_parent, "b", "(lv_obj)" },
{ "get_drag_throw", (void*) &lv_obj_get_drag_throw, "b", "(lv_obj)" },
{ "get_draw_rect_ext_pad_size", (void*) &lv_obj_get_draw_rect_ext_pad_size, "i", "(lv_obj)i" },
{ "get_event_cb", (void*) &lv_obj_get_event_cb, "lv_event_cb", "(lv_obj)" },
{ "get_ext_attr", (void*) &lv_obj_get_ext_attr, ".", "(lv_obj)" },
{ "get_ext_click_pad_bottom", (void*) &lv_obj_get_ext_click_pad_bottom, "i", "(lv_obj)" },
{ "get_ext_click_pad_left", (void*) &lv_obj_get_ext_click_pad_left, "i", "(lv_obj)" },
@ -229,6 +242,7 @@ const lvbe_call_c_t lv_obj_func[] = {
{ "get_parent_event", (void*) &lv_obj_get_parent_event, "b", "(lv_obj)" },
{ "get_protect", (void*) &lv_obj_get_protect, "i", "(lv_obj)" },
{ "get_screen", (void*) &lv_obj_get_screen, "lv_obj", "(lv_obj)" },
{ "get_signal_cb", (void*) &lv_obj_get_signal_cb, "lv_signal_cb", "(lv_obj)" },
{ "get_state", (void*) &lv_obj_get_state, "i", "(lv_obj)i" },
{ "get_style_bg_blend_mode", (void*) &lv_obj_get_style_bg_blend_mode, "i", "(lv_obj)i" },
{ "get_style_bg_color", (void*) &lv_obj_get_style_bg_color, "lv_color", "(lv_obj)i" },
@ -472,6 +486,7 @@ const lvbe_call_c_t lv_obj_func[] = {
{ "set_width_margin", (void*) &lv_obj_set_width_margin, "", "(lv_obj)i" },
{ "set_x", (void*) &lv_obj_set_x, "", "(lv_obj)i" },
{ "set_y", (void*) &lv_obj_set_y, "", "(lv_obj)i" },
{ "signal_send", (void*) &lv_obj_signal_send, "i", "(lv_obj)i." },
};
/* `lv_arc` methods */
@ -772,7 +787,7 @@ const lvbe_call_c_t lv_imgbtn_func[] = {
#if BE_LV_WIDGET_KEYBOARD
const lvbe_call_c_t lv_keyboard_func[] = {
{ "create", (void*) &lv_keyboard_create, "+lv_keyboard", "(lv_obj)(lv_obj)" },
{ "def_event_cb", (void*) &lv_keyboard_def_event_cb, "", "(lv_obj)(lv_event)" },
{ "def_event_cb", (void*) &lv_keyboard_def_event_cb, "", "(lv_obj)i" },
{ "get_cursor_manage", (void*) &lv_keyboard_get_cursor_manage, "b", "(lv_obj)" },
{ "get_mode", (void*) &lv_keyboard_get_mode, "i", "(lv_obj)" },
{ "get_textarea", (void*) &lv_keyboard_get_textarea, "lv_obj", "(lv_obj)" },
@ -1159,7 +1174,7 @@ const lvbe_call_c_t lv_win_func[] = {
{ "add_btn_left", (void*) &lv_win_add_btn_left, "lv_obj", "(lv_obj)." },
{ "add_btn_right", (void*) &lv_win_add_btn_right, "lv_obj", "(lv_obj)." },
{ "clean", (void*) &lv_win_clean, "", "(lv_obj)" },
{ "close_event_cb", (void*) &lv_win_close_event_cb, "", "(lv_obj)(lv_event)" },
{ "close_event_cb", (void*) &lv_win_close_event_cb, "", "(lv_obj)i" },
{ "create", (void*) &lv_win_create, "+lv_win", "(lv_obj)(lv_obj)" },
{ "focus", (void*) &lv_win_focus, "", "(lv_obj)(lv_obj)(lv_anim_enable)" },
{ "get_anim_time", (void*) &lv_win_get_anim_time, "i", "(lv_obj)" },

View File

@ -501,7 +501,7 @@ typedef void * lv_font_user_data_t;
* texts and borders will be black and the background will be
* white. Else the colors are inverted.
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_MONO 0
#define LV_USE_THEME_MONO 1
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
#define LV_THEME_DEFAULT_INIT lv_theme_material_init

View File

@ -634,8 +634,9 @@
// #define USE_EZOPMP // [I2cDriver55] Enable support for EZO's PMP sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
// #define USE_SEESAW_SOIL // [I2cDriver56] Enable Capacitice Soil Moisture & Temperature Sensor (I2C addresses 0x36 - 0x39) (+1k3 code)
// #define USE_MPU_ACCEL // [I2cDriver58] Enable MPU6886/MPU9250 - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x68) (+2k code)
// #define USE_BM8563 // [I2cDriver59] Enable BM8563 RTC - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x51) (+2.5k code)
// #define USE_BM8563 // [I2cDriver59] Enable BM8563 RTC - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x51) (+2k5 code)
// #define USE_AM2320 // [I2cDriver60] Enable AM2320 temperature and humidity Sensor (I2C address 0x5C) (+1k code)
// #define USE_T67XX // [I2cDriver61] Enable Telaire T67XX CO2 sensor (I2C address 0x15) (+1k3 code)
// #define USE_DISPLAY // Add I2C Display Support (+2k code)
#define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0
#define USE_DISPLAY_LCD // [DisplayModel 1] [I2cDriver3] Enable Lcd display (I2C addresses 0x27 and 0x3F) (+6k code)

View File

@ -720,31 +720,37 @@ char* GetPowerDevice(char* dest, uint32_t idx, size_t size)
return GetPowerDevice(dest, idx, size, 0);
}
float ConvertTemp(float c)
{
float ConvertTempToFahrenheit(float c) {
float result = c;
TasmotaGlobal.global_update = TasmotaGlobal.uptime;
TasmotaGlobal.temperature_celsius = c;
if (!isnan(c) && Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit
result = c * 1.8 + 32; // Fahrenheit
result = c * 1.8 + 32; // Fahrenheit
}
result = result + (0.1 * Settings->temp_comp);
return result;
}
float ConvertTempToCelsius(float c)
{
float ConvertTempToCelsius(float c) {
float result = c;
if (!isnan(c) && Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit
result = (c - 32) / 1.8; // Celsius
if (!isnan(c) && !Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit
result = (c - 32) / 1.8; // Celsius
}
result = result + (0.1 * Settings->temp_comp);
return result;
}
void UpdateGlobalTemperature(float c) {
TasmotaGlobal.global_update = TasmotaGlobal.uptime;
TasmotaGlobal.temperature_celsius = c;
}
float ConvertTemp(float c) {
UpdateGlobalTemperature(c);
return ConvertTempToFahrenheit(c);
}
char TempUnit(void)
{
// SetOption8 - Switch between Celsius or Fahrenheit
@ -1328,6 +1334,23 @@ bool ResponseContains_P(const char* needle) {
#endif
}
/*
uint32_t ResponseContains_P(const char* needle) {
const char *tmp;
#ifdef MQTT_DATA_STRING
tmp = TasmotaGlobal.mqtt_data.c_str();
#else
tmp = TasmotaGlobal.mqtt_data;
#endif
uint32_t count = 0;
while (tmp = strstr_P(tmp, needle)) {
count++;
tmp++;
}
return count;
}
*/
/*********************************************************************************************\
* GPIO Module and Template management
\*********************************************************************************************/

View File

@ -487,7 +487,7 @@ void *special_calloc(size_t num, size_t size) {
}
float CpuTemperature(void) {
return ConvertTemp(temperatureRead());
return (float)temperatureRead(); // In Celsius
}
/*

View File

@ -364,7 +364,7 @@ void ResponseAppendFeatures(void)
#if defined(USE_ENERGY_SENSOR) && defined(USE_PZEM_DC)
feature4 |= 0x00001000; // xnrg_06_pzem_dc.ino
#endif
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR)
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR) || defined(USE_WS2300_WIND_SENSOR)
feature4 |= 0x00002000; // xsns_35_tx20.ino
#endif
#if defined(USE_I2C) && defined(USE_MGC3130)
@ -746,7 +746,9 @@ void ResponseAppendFeatures(void)
#if defined(USE_I2C) && defined(USE_AM2320)
feature8 |= 0x00000040;
#endif
// feature8 |= 0x00000080;
#if defined(USE_I2C) && defined(USE_T67XX)
feature8 |= 0x00000080;
#endif
// feature8 |= 0x00000100;
// feature8 |= 0x00000200;

View File

@ -837,6 +837,36 @@ bool MqttShowSensor(void)
XsnsCall(FUNC_JSON_APPEND);
XdrvCall(FUNC_JSON_APPEND);
if (TasmotaGlobal.global_update) {
if ((TasmotaGlobal.humidity > 0) || !isnan(TasmotaGlobal.temperature_celsius) || (TasmotaGlobal.pressure_hpa != 0)) {
uint32_t add_comma = 0;
ResponseAppend_P(PSTR(",\"Global\":{"));
if (!isnan(TasmotaGlobal.temperature_celsius)) {
float t = ConvertTempToFahrenheit(TasmotaGlobal.temperature_celsius);
ResponseAppend_P(PSTR("\"" D_JSON_TEMPERATURE "\":%*_f"),
Settings->flag2.temperature_resolution, &t);
add_comma++;
}
if (TasmotaGlobal.humidity > 0) {
ResponseAppend_P(PSTR("%s\"" D_JSON_HUMIDITY "\":%*_f"),
(add_comma)?",":"", Settings->flag2.humidity_resolution, &TasmotaGlobal.humidity);
add_comma++;
}
if (2 == add_comma) {
float dewpoint = CalcTempHumToDew(TasmotaGlobal.temperature_celsius, TasmotaGlobal.humidity);
ResponseAppend_P(PSTR("%s\"" D_JSON_DEWPOINT "\":%*_f"),
(add_comma)?",":"", Settings->flag2.temperature_resolution, &dewpoint);
}
if (TasmotaGlobal.pressure_hpa != 0) {
float p = ConvertPressure(TasmotaGlobal.pressure_hpa);
float s = ConvertPressureForSeaLevel(TasmotaGlobal.pressure_hpa);
ResponseAppend_P(PSTR("%s\"" D_JSON_PRESSURE "\":%*_f,\"" D_JSON_PRESSUREATSEALEVEL "\":%*_f"),
(add_comma)?",":"", Settings->flag2.pressure_resolution, &p, Settings->flag2.pressure_resolution, &s);
}
ResponseJsonEnd();
}
}
bool json_data_available = (ResponseLength() - json_data_start);
if (ResponseContains_P(PSTR(D_JSON_PRESSURE))) {
ResponseAppend_P(PSTR(",\"" D_JSON_PRESSURE_UNIT "\":\"%s\""), PressureUnit().c_str());

View File

@ -193,15 +193,11 @@ struct {
char mqtt_client[99]; // Composed MQTT Clientname
char mqtt_topic[TOPSZ]; // Composed MQTT topic
#ifdef ESP8266
#ifdef PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
char* log_buffer = nullptr; // Log buffer in IRAM
#else
char log_buffer[LOG_BUFFER_SIZE]; // Log buffer in DRAM
#endif // PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
#else // Not ESP8266
char log_buffer[LOG_BUFFER_SIZE]; // Log buffer in DRAM
#endif // ESP8266
} TasmotaGlobal;
TSettings* Settings = nullptr;
@ -262,7 +258,6 @@ void setup(void) {
// Serial.setRxBufferSize(INPUT_BUFFER_SIZE); // Default is 256 chars
TasmotaGlobal.seriallog_level = LOG_LEVEL_INFO; // Allow specific serial messages until config loaded
#ifdef ESP8266
#ifdef PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
ESP.setIramHeap();
Settings = (TSettings*)malloc(sizeof(TSettings)); // Allocate in "new" 16k heap space
@ -275,7 +270,6 @@ void setup(void) {
TasmotaGlobal.log_buffer[0] = '\0';
}
#endif // PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
#endif // ESP8266
if (Settings == nullptr) {
Settings = (TSettings*)malloc(sizeof(TSettings));
}

View File

@ -143,6 +143,10 @@
//#define USE_EZORGB // [I2cDriver55] Enable support for EZO's RGB sensor (+0k5 code) - Shared EZO code required for any EZO device (+1k2 code)
//#define USE_EZOPMP // [I2cDriver55] Enable support for EZO's PMP sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
//#define USE_SEESAW_SOIL // [I2cDriver56] Enable Capacitice Soil Moisture & Temperature Sensor (I2C addresses 0x36 - 0x39) (+1k3 code)
//#define USE_MPU_ACCEL // [I2cDriver58] Enable MPU6886/MPU9250 - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x68) (+2k code)
//#define USE_BM8563 // [I2cDriver59] Enable BM8563 RTC - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x51) (+2k5 code)
//#define USE_AM2320 // [I2cDriver60] Enable AM2320 temperature and humidity Sensor (I2C address 0x5C) (+1k code)
//#define USE_T67XX // [I2cDriver61] Enable Telaire T67XX CO2 sensor (I2C address 0x15) (+1k3 code)
//#define USE_SPI // Hardware SPI using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK) in addition to two user selectable GPIOs(CS and DC)
//#define USE_RC522 // Add support for MFRC522 13.56Mhz Rfid reader (+6k code)

View File

@ -302,6 +302,10 @@
//#define USE_EZORGB // [I2cDriver55] Enable support for EZO's RGB sensor (+0k5 code) - Shared EZO code required for any EZO device (+1k2 code)
//#define USE_EZOPMP // [I2cDriver55] Enable support for EZO's PMP sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
//#define USE_SEESAW_SOIL // [I2cDriver56] Enable Capacitice Soil Moisture & Temperature Sensor (I2C addresses 0x36 - 0x39) (+1k3 code)
//#define USE_MPU_ACCEL // [I2cDriver58] Enable MPU6886/MPU9250 - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x68) (+2k code)
//#define USE_BM8563 // [I2cDriver59] Enable BM8563 RTC - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x51) (+2k5 code)
//#define USE_AM2320 // [I2cDriver60] Enable AM2320 temperature and humidity Sensor (I2C address 0x5C) (+1k code)
//#define USE_T67XX // [I2cDriver61] Enable Telaire T67XX CO2 sensor (I2C address 0x15) (+1k3 code)
//#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
//#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)

View File

@ -745,7 +745,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
AGPIO(GPIO_PMS5003_TX), // Plantower PMS5003 Serial interface
AGPIO(GPIO_PMS5003_RX), // Plantower PMS5003 Serial interface
#endif
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR)
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR) || defined(USE_WS2300_WIND_SENSOR)
AGPIO(GPIO_TX2X_TXD_BLACK), // TX20/TX23 Transmission Pin
#endif
#ifdef USE_WINDMETER

View File

@ -314,11 +314,10 @@ extern "C" {
* Optional argument:
* - return_type: the C function return value is int32_t and is converted to the
* relevant Berry object depending on this char:
* '0' (default): nil, no value
* '' (default): nil, no value
* 'i' be_int
* 'b' be_boot
* 's' be_str
* 'o' instance of `lv_obj` (needs to be improved)
*
* - arg_type: optionally check the types of input arguments, or throw an error
* string of argument types, '+' marks optional arguments
@ -326,6 +325,7 @@ extern "C" {
* 'i' be_int
* 'b' be_bool
* 's' be_string
* 'c' C callback
* 'lv_obj' be_instance of type or subtype
* '0'..'5' callback
*
@ -394,6 +394,8 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
int32_t ret = 0;
char provided_type = 0;
idx = be_absindex(vm, idx); // make sure we have an absolute index
// berry_log_C(">> 0 idx=%i arg_type=%s", idx, arg_type ? arg_type : "NULL");
if (arg_type == nullptr) { arg_type = "."; } // if no type provided, replace with wildchar
size_t arg_type_len = strlen(arg_type);
@ -453,7 +455,7 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
if (be_isint(vm, idx)) { ret = be_toint(vm, idx); provided_type = 'i'; }
else if (be_isbool(vm, idx)) { ret = be_tobool(vm, idx); provided_type = 'b'; }
else if (be_isstring(vm, idx)) { ret = (int32_t) be_tostring(vm, idx); provided_type = 's'; }
else if (be_iscomptr(vm, idx)) { ret = (int32_t) be_tocomptr(vm, idx); provided_type = 'i'; }
else if (be_iscomptr(vm, idx)) { ret = (int32_t) be_tocomptr(vm, idx); provided_type = 'c'; }
// check if simple type was a match
if (provided_type) {
@ -470,34 +472,45 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
// non-simple type
if (be_isinstance(vm, idx)) {
be_getmember(vm, idx, ".p");
int32_t ret = be_convert_single_elt(vm, -1, nullptr); // recurse
be_pop(vm, 1);
if (arg_type_len > 1) {
// Check type
be_classof(vm, idx);
bool class_found = be_getglobal(vm, arg_type);
// Stack: class_of_idx, class_of_target (or nil)
if (class_found) {
if (!be_isderived(vm, -2)) {
berry_log_P("Unexpected class type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
} else {
berry_log_P("Unable to find class '%s' (%d)", arg_type, arg_type_len);
}
// check if the instance is a subclass of `bytes()``
be_getbuiltin(vm, "bytes"); // add "list" class
if (be_isderived(vm, idx)) {
be_pop(vm, 1);
be_getmember(vm, idx, "_buffer");
be_pushvalue(vm, idx);
be_call(vm, 1);
int32_t ret = (int32_t) be_tocomptr(vm, -2);
be_pop(vm, 2);
} else if (arg_type[0] != '.') {
berry_log_P("Unexpected instance type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
return ret;
} else {
be_pop(vm, 1);
be_getmember(vm, idx, ".p");
int32_t ret = be_convert_single_elt(vm, -1, nullptr); // recurse
be_pop(vm, 1);
return ret;
if (arg_type_len > 1) {
// Check type
be_classof(vm, idx);
bool class_found = be_getglobal(vm, arg_type);
// Stack: class_of_idx, class_of_target (or nil)
if (class_found) {
if (!be_isderived(vm, -2)) {
berry_log_P("Unexpected class type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
} else {
berry_log_P("Unable to find class '%s' (%d)", arg_type, arg_type_len);
}
be_pop(vm, 2);
} else if (arg_type[0] != '.') {
berry_log_P("Unexpected instance type '%s', expected '%s'", be_classname(vm, idx), arg_type);
}
return ret;
}
} else {
be_raise(vm, kTypeError, nullptr);
}
//
return ret;
}

View File

@ -230,7 +230,7 @@ void be_check_arg_type(bvm *vm, int32_t argc, const char * arg_type, int32_t p[5
void be_check_arg_type(bvm *vm, int32_t argc, const char * arg_type, int32_t p[5]) {
bool arg_type_check = (arg_type != nullptr); // is type checking activated
int32_t arg_idx = 0; // position in arg_type string
char type_short_name[16];
char type_short_name[32];
for (uint32_t i = 0; i < argc; i++) {
type_short_name[0] = 0; // clear string
@ -293,15 +293,15 @@ extern "C" {
if (argc > 1) {
obj1 = (lv_obj_t*) be_convert_single_elt(vm, 2);
}
if (argc > 2) {
if (argc > 2 && !be_isnil(vm, 3)) {
obj2 = (lv_obj_t*) be_convert_single_elt(vm, 3);
}
// AddLog(LOG_LEVEL_INFO, "argc %d obj1 %p obj2 %p", argc, obj1, obj2);
fn_any_callable f = (fn_any_callable) func;
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func(%p) - %p,%p,%p,%p,%p", f, p[0], p[1], p[2], p[3], p[4]);
lv_obj_t * obj;
if ((int32_t)obj1 == -1) { // special semantics of first ptr is -1, then just encapsulate
obj = obj2;
if ((int32_t)obj2 == -1) { // special semantics if second ptr is -1, then just encapsulate
obj = obj1;
} else { // otherwise call the LVGL creator
obj = (lv_obj_t*) (*f)((int32_t)obj1, (int32_t)obj2, 0, 0, 0);
}
@ -338,36 +338,33 @@ extern "C" {
// look for class descriptor
int32_t class_idx = bin_search(class_name, &lv_classes[0].name, sizeof(lv_classes[0]), lv_classes_size);
if (class_idx < 0) {
// class not found, abort
// berry_log_C("lvx_member class not found");
be_return_nil(vm);
}
const lvbe_call_c_t * methods_calls = lv_classes[class_idx].func_table;
size_t methods_size = lv_classes[class_idx].size;
if (class_idx >= 0) {
const lvbe_call_c_t * methods_calls = lv_classes[class_idx].func_table;
size_t methods_size = lv_classes[class_idx].size;
int32_t method_idx = bin_search(method_name, methods_calls, sizeof(lvbe_call_c_t), methods_size);
if (method_idx >= 0) {
// method found
const lvbe_call_c_t * method = &methods_calls[method_idx];
// berry_log_C("lvx_member method found func=%p return_type=%s arg_type=%s", method->func, method->return_type, method->arg_type);
// push native closure
be_pushntvclosure(vm, &lvx_call_c, 3); // 3 upvals
int32_t method_idx = bin_search(method_name, methods_calls, sizeof(lvbe_call_c_t), methods_size);
if (method_idx >= 0) {
// method found
const lvbe_call_c_t * method = &methods_calls[method_idx];
// berry_log_C("lvx_member method found func=%p return_type=%s arg_type=%s", method->func, method->return_type, method->arg_type);
// push native closure
be_pushntvclosure(vm, &lvx_call_c, 3); // 3 upvals
be_pushcomptr(vm, method->func);
be_setupval(vm, -2, 0);
be_pop(vm, 1);
be_pushcomptr(vm, method->func);
be_setupval(vm, -2, 0);
be_pop(vm, 1);
be_pushstring(vm, method->return_type);
be_setupval(vm, -2, 1);
be_pop(vm, 1);
be_pushstring(vm, method->return_type);
be_setupval(vm, -2, 1);
be_pop(vm, 1);
be_pushstring(vm, method->arg_type);
be_setupval(vm, -2, 2);
be_pop(vm, 1);
be_pushstring(vm, method->arg_type);
be_setupval(vm, -2, 2);
be_pop(vm, 1);
// all good
be_return(vm);
// all good
be_return(vm);
}
}
// get super if any, or nil if none
@ -393,7 +390,7 @@ extern "C" {
fn_any_callable f = (fn_any_callable) func;
be_check_arg_type(vm, argc, arg_type, p);
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func(%p) - %p,%p,%p,%p,%p - %s", f, p[0], p[1], p[2], p[3], p[4], return_type);
// berry_log_C(">> be_call_c_func(%p) - %p,%p,%p,%p,%p - %s", f, p[0], p[1], p[2], p[3], p[4], return_type ? return_type : "NULL");
int32_t ret = (*f)(p[0], p[1], p[2], p[3], p[4]);
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func, ret = %p", ret);
if ((return_type == nullptr) || (strlen(return_type) == 0)) { be_return_nil(vm); } // does not return
@ -403,14 +400,15 @@ extern "C" {
case 'i': be_pushint(vm, ret); break;
case 'b': be_pushbool(vm, ret); break;
case 's': be_pushstring(vm, (const char*) ret); break;
case 'c': be_pushint(vm, ret); break; // TODO missing 'c' general callback type
default: be_raise(vm, "internal_error", "Unsupported return type"); break;
}
be_return(vm);
} else { // class name
// AddLog(LOG_LEVEL_INFO, ">> be_call_c_func, create_obj", ret);
be_getglobal(vm, return_type); // stack = class
be_pushcomptr(vm, (void*) -1); // stack = class, -1
be_pushcomptr(vm, (void*) ret); // stack = class, -1, ptr
be_pushcomptr(vm, (void*) ret); // stack = class, ptr
be_pushcomptr(vm, (void*) -1); // stack = class, ptr, -1
be_call(vm, 2); // instanciate with 2 arguments, stack = instance, -1, ptr
be_pop(vm, 2); // stack = instance
be_return(vm);
@ -949,7 +947,7 @@ extern "C" {
int lvx_tostring(bvm *vm) {
lv_obj_t * obj = (lv_obj_t*) lv_get_arg(vm, 1);
const char * classname = be_classname(vm, 1);
char s[32];
char s[48];
snprintf(s, sizeof(s), "<instance: %s(0x%08X)>", classname, obj);
be_pushnstring(vm, s, strlen(s)); /* make escape string from buffer */
be_return(vm);
@ -1007,6 +1005,19 @@ extern "C" {
}
}
// ======================================================================
// Patch for ill-named functions
// ======================================================================
extern "C" {
// lv_signal_send should be renamed lv_obj_signal_send
// lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
lv_res_t lv_obj_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param) {
return lv_signal_send(obj, signal, param);
}
}
#include "lvgl_berry/be_lv_c_mapping.h"
#else // USE_LVGL

View File

@ -96,12 +96,26 @@ const char berry_prog[] =
// "end "
// "lv = lvgl() "
"import lvgl as lv "
// 'lv_group_focus_cb', 'lv_event_cb', 'lv_signal_cb', 'lv_design_cb', 'lv_gauge_format_cb'
"_lvgl_cb = [ {}, {}, {}, {}, {}, {} ] "
"_lvgl_cb_obj = [ {}, {}, {}, {}, {}, {} ] "
"def _lvgl_cb_dispatch(idx, obj, v1, v2, v3, v4) "
// "import string print(string.format('>>> idx=%i obj=0x%08X v1=%i', idx, obj, v1)) "
"var func = _lvgl_cb[idx].find(obj) "
"var inst = _lvgl_cb_obj[idx].find(obj) "
// convert arguments to ctypes if needed
// typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
// typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event);
// typedef lv_res_t (*lv_signal_cb_t)(struct _lv_obj_t * obj, lv_signal_t sign, void * param);
// typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
// typedef void (*lv_gauge_format_cb_t)(lv_obj_t * gauge, char * buf, int bufsize, int32_t value);
"if idx == 3 "
// lv_signal_cb - arg2 is lv_area
"v1 = lv_area(v1) "
"end "
"if func != nil "
"return func(inst, v1, v2, v3, v4) "
"end "

View File

@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR)
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR) || defined(USE_WS2300_WIND_SENSOR)
/*********************************************************************************************\
* La Crosse TX20/TX23 Anemometer
@ -55,6 +55,16 @@
#warning **** use USE_TX20_WIND_SENSOR or USE_TX23_WIND_SENSOR but not both together, TX20 disabled ****
#endif // USE_TX20_WIND_SENSOR && USE_TX23_WIND_SENSOR
#if defined(USE_WS2300_WIND_SENSOR) && defined(USE_TX23_WIND_SENSOR)
#undef USE_WS2300_WIND_SENSOR
#warning **** use USE_WS2300_WIND_SENSOR or USE_TX23_WIND_SENSOR but not both together, WS2300 disabled ****
#endif // USE_TX20_WIND_SENSOR && USE_TX23_WIND_SENSOR
#if defined(USE_WS2300_WIND_SENSOR) && defined(USE_TX20_WIND_SENSOR)
#undef USE_WS2300_WIND_SENSOR
#warning **** use USE_WS2300_WIND_SENSOR or USE_TX20_WIND_SENSOR but not both together, WS2300 disabled ****
#endif // USE_TX20_WIND_SENSOR && USE_TX23_WIND_SENSOR
// #define USE_TX2X_WIND_SENSOR_NOSTATISTICS // suppress statistics (speed/dir avg/min/max/range)
#define TX2X_BIT_TIME 1220 // microseconds
#define TX2X_WEIGHT_AVG_SAMPLE 150 // seconds
@ -70,9 +80,14 @@ extern "C" {
#ifdef USE_TX20_WIND_SENSOR
#undef D_TX2x_NAME
#define D_TX2x_NAME "TX20"
#else // USE_TX20_WIND_SENSOR
#endif
#ifdef USE_TX23_WIND_SENSOR // USE_TX23_WIND_SENSOR
#undef D_TX2x_NAME
#define D_TX2x_NAME "TX23"
#endif
#ifdef USE_WS2300_WIND_SENSOR // USE_WS2300_WIND_SENSOR
#undef D_TX2x_NAME
#define D_TX2x_NAME "WS2300-15"
#endif // USE_TX20_WIND_SENSOR
#ifdef USE_WEBSERVER
@ -236,7 +251,14 @@ void IRAM_ATTR TX2xStartRead(void)
#ifdef USE_TX23_WIND_SENSOR
if ((chk == tx2x_sd) && (0x1b==tx2x_sa) && (tx2x_sb==tx2x_se) && (tx2x_sc==tx2x_sf) && (tx2x_sc < 511)) {
#else
if ((chk == tx2x_sd) && (tx2x_sb==tx2x_se) && (tx2x_sc==tx2x_sf) && (tx2x_sc < 511)) {
if
#ifdef USE_TX20_WIND_SENSOR
((chk == tx2x_sd) && (tx2x_sb==tx2x_se) && (tx2x_sc==tx2x_sf) && (tx2x_sc < 511))
#endif
#ifdef USE_WS2300_WIND_SENSOR
((chk == tx2x_sd) && (tx2x_sc < 511))
#endif
{
#endif
tx2x_last_available = TasmotaGlobal.uptime;
// Wind speed spec: 0 to 180 km/h (0 to 50 m/s)
@ -590,4 +612,4 @@ bool Xsns35(uint8_t function)
return result;
}
#endif // USE_TX20_WIND_SENSOR || USE_TX23_WIND_SENSOR
#endif // USE_TX20_WIND_SENSOR || USE_TX23_WIND_SENSOR

View File

@ -20,11 +20,19 @@
#ifdef USE_PROMETHEUS
/*********************************************************************************************\
* Prometheus support
*
* The text format for metrics, labels and values is documented at [1]. Only
* the UTF-8 text encoding is supported.
*
* [1]
* https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md
*
\*********************************************************************************************/
#define XSNS_75 75
const char *UnitfromType(const char *type) // find unit for measurment type
// Find appropriate unit for measurement type.
const char *UnitfromType(const char *type)
{
if (strcmp(type, "time") == 0) {
return "seconds";
@ -56,7 +64,9 @@ const char *UnitfromType(const char *type) // find unit for measurment type
return "";
}
String FormatMetricName(const char *metric) { // cleanup spaces and uppercases for Prmetheus metrics conventions
// Replace spaces and periods in metric name to match Prometheus metrics
// convention.
String FormatMetricName(const char *metric) {
String formatted = metric;
formatted.toLowerCase();
formatted.replace(" ", "_");
@ -64,6 +74,16 @@ String FormatMetricName(const char *metric) { // cleanup spaces and uppercases
return formatted;
}
// Labels can be any sequence of UTF-8 characters, but backslash, double-quote
// and line feed must be escaped.
String FormatLabelValue(const char *value) {
String formatted = value;
formatted.replace("\\", "\\\\");
formatted.replace("\"", "\\\"");
formatted.replace("\n", "\\n");
return formatted;
}
void HandleMetrics(void) {
if (!HttpCheckPriviledgedAccess()) { return; }
@ -74,8 +94,8 @@ void HandleMetrics(void) {
char parameter[FLOATSZ];
// Pseudo-metric providing metadata about the running firmware version.
WSContentSend_P(PSTR("# TYPE tasmota_info gauge\ntasmota_info{version=\"%s\",image=\"%s\",build_timestamp=\"%s\"} 1\n"),
TasmotaGlobal.version, TasmotaGlobal.image_name, GetBuildDateAndTime().c_str());
WSContentSend_P(PSTR("# TYPE tasmota_info gauge\ntasmota_info{version=\"%s\",image=\"%s\",build_timestamp=\"%s\",devicename=\"%s\"} 1\n"),
TasmotaGlobal.version, TasmotaGlobal.image_name, GetBuildDateAndTime().c_str(), FormatLabelValue(SettingsText(SET_DEVICENAME)).c_str());
WSContentSend_P(PSTR("# TYPE tasmota_uptime_seconds gauge\ntasmota_uptime_seconds %d\n"), TasmotaGlobal.uptime);
WSContentSend_P(PSTR("# TYPE tasmota_boot_count counter\ntasmota_boot_count %d\n"), Settings->bootcount);
WSContentSend_P(PSTR("# TYPE tasmota_flash_writes_total counter\ntasmota_flash_writes_total %d\n"), Settings->save_flag);
@ -135,7 +155,7 @@ void HandleMetrics(void) {
String jsonStr = TasmotaGlobal.mqtt_data;
JsonParser parser((char *)jsonStr.c_str());
JsonParserObject root = parser.getRootObject();
if (root) { // did JSON parsing went ok?
if (root) { // did JSON parsing succeed?
for (auto key1 : root) {
JsonParserToken value1 = key1.getValue();
if (value1.isObject()) {
@ -160,7 +180,7 @@ void HandleMetrics(void) {
String sensor = FormatMetricName(key1.getStr());
String type = FormatMetricName(key2.getStr());
const char *unit = UnitfromType(type.c_str());
if (strcmp(type.c_str(), "totalstarttime") != 0) { // this metric causes prometheus of fail
if (strcmp(type.c_str(), "totalstarttime") != 0) { // this metric causes Prometheus of fail
if (strcmp(type.c_str(), "id") == 0) { // this metric is NaN, so convert it to a label, see Wi-Fi metrics above
WSContentSend_P(PSTR("# TYPE tasmota_sensors_%s_%s gauge\ntasmota_sensors_%s_%s{sensor=\"%s\",id=\"%s\"} 1\n"),
type.c_str(), unit, type.c_str(), unit, sensor.c_str(), value);

View File

@ -52,7 +52,16 @@ void Esp32SensorInit(void) {
#endif // CONFIG_IDF_TARGET_ESP32
void Esp32SensorShow(bool json) {
float t = CpuTemperature();
static bool add_global_temp = false;
if (json) {
add_global_temp = !ResponseContains_P(PSTR(D_JSON_TEMPERATURE));
}
float c = CpuTemperature(); // in Celsius
if (add_global_temp) {
UpdateGlobalTemperature(c);
}
float t = ConvertTempToFahrenheit(c);
#if CONFIG_IDF_TARGET_ESP32
int value = 0;

350
tasmota/xsns_89_t67xx.ino Normal file
View File

@ -0,0 +1,350 @@
/*
xsns_89_t67xx.ino - Telaire T6700 Series CO2 sensor support for Tasmota
Copyright (c) 2021 Alexander Savchenko (alexander@savchenko.by)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef USE_I2C
#ifdef USE_T67XX
/*********************************************************************************************\
* Telaire T6703/T6713 - CO2
*
* Based on https://github.com/drug123/T67XX/ by Yaroslav Osadchyy
* (drug123@gmail.com)
*
* I2C Address: 0x15
\*********************************************************************************************/
#define XSNS_89 89
#define XI2C_61 61 // See I2CDEVICES.md
#define T67XX_I2C_ADDR 0x15
#define T67XX_REG_VAL_ENABLE 0xFF00
#define T67XX_REG_VAL_DISABLE 0x0000
#define T67XX_READ_DELAY 10 // Recommended value
#define T67XX_MEASURE_INTERVAL 15 // Seconds
#define T67XX_MEASURE_DELAY 115 // Seconds
// Registers
enum
{
T67XX_REG_FIRMWARE = 0x1389,
T67XX_REG_STATUS = 0x138A,
T67XX_REG_PPM = 0x138B,
T67XX_REG_RESET = 0x03E8,
T67XX_REG_SPCAL = 0x03EC,
T67XX_REG_FLASH_UPDATE = 0x03ED,
T67XX_REG_ADDRESS = 0x0FA5,
T67XX_REG_ABC_LOGIC = 0x03EE,
T67XX_REG_MOD_MODE = 0x100B
};
class T67XX
{
public:
T67XX();
void Read(void);
uint16_t readPPM(void);
uint16_t PPM(void);
uint16_t getStatus(void);
uint16_t getFirmwareVersion(void);
void detect(void);
void reset(void);
void setABCMode(bool Enabled);
void setSlaveAddress(uint8_t Address);
void flashUpdate(void);
void beginCalibration(void);
void endCalibration(void);
const char *getLastStatusMsg(void);
bool found(void);
// 0: no error; 1: error has occurred
struct status
{
uint16_t ERROR : 1;
uint16_t FLASH_ERROR : 1;
uint16_t CALIBRATION_ERROR : 1;
uint16_t REBOOT : 1;
uint16_t WARMUP : 1;
uint16_t SINGLE_POINT_CAL : 1;
void set(uint16_t data)
{
ERROR = data & 0x01;
FLASH_ERROR = (data >> 0x01) & 0x01;
CALIBRATION_ERROR = (data >> 0x02) & 0x01;
REBOOT = (data >> 0x0A) & 0x01;
WARMUP = (data >> 0x0B) & 0x01;
SINGLE_POINT_CAL = (data >> 0x0F) & 0x01;
}
};
private:
uint8_t _data[6];
uint16_t _ppm = 0;
const char *getStatusMsg(uint16_t sensorStatus);
uint16_t read16(uint16_t reg);
void write16(uint16_t reg, uint16_t data);
uint8_t _init = 0;
uint8_t _sta = 0;
status _status;
bool _found = 0;
};
T67XX::T67XX()
{
}
uint16_t T67XX::readPPM(void)
{
_ppm = read16(T67XX_REG_PPM);
return _ppm;
}
uint16_t T67XX::PPM(void)
{
return _ppm;
}
uint16_t T67XX::getStatus(void)
{
_sta = read16(T67XX_REG_STATUS);
_status.set(_sta);
return _sta;
};
uint16_t T67XX::getFirmwareVersion(void)
{
return read16(T67XX_REG_FIRMWARE);
};
void T67XX::detect(void)
{
if (I2cActive(T67XX_I2C_ADDR))
{
return;
}
reset();
delay(100);
uint16_t fw = getFirmwareVersion();
if ((fw > 0) && (fw < 0xFFFF))
{
AddLog(LOG_LEVEL_INFO, PSTR("T67XX firmware version: %d"), fw);
I2cSetActiveFound(T67XX_I2C_ADDR, "T67XX");
_found = true;
}
}
bool T67XX::found(void)
{
return _found;
}
void T67XX::reset(void)
{
write16(T67XX_REG_RESET, T67XX_REG_VAL_ENABLE);
_init = 1;
};
void T67XX::setABCMode(bool Enabled)
{
write16(T67XX_REG_ABC_LOGIC,
Enabled ? T67XX_REG_VAL_ENABLE : T67XX_REG_VAL_DISABLE);
};
void T67XX::setSlaveAddress(uint8_t Address){
// TODO:
};
void T67XX::flashUpdate(void)
{
write16(T67XX_REG_FLASH_UPDATE, T67XX_REG_VAL_ENABLE);
}
void T67XX::beginCalibration(void)
{
write16(T67XX_REG_SPCAL, T67XX_REG_VAL_ENABLE);
};
void T67XX::endCalibration(void)
{
write16(T67XX_REG_SPCAL, T67XX_REG_VAL_DISABLE);
};
/*** Private Section ***/
uint16_t T67XX::read16(uint16_t reg)
{
Wire.beginTransmission(T67XX_I2C_ADDR);
Wire.write(0x04);
Wire.write(byte(reg >> 8));
Wire.write(byte(reg & 0xFF));
Wire.write(0x00);
Wire.write(0x01);
Wire.endTransmission();
delay(T67XX_READ_DELAY);
Wire.requestFrom(int(T67XX_I2C_ADDR), 4);
_data[0] = Wire.read();
_data[1] = Wire.read();
_data[2] = Wire.read();
_data[3] = Wire.read();
return ((_data[2] << 8) | _data[3]);
}
void T67XX::write16(uint16_t reg, uint16_t data)
{
Wire.beginTransmission(T67XX_I2C_ADDR);
Wire.write(0x05);
Wire.write(byte(reg >> 8));
Wire.write(byte(reg & 0xFF));
Wire.write(byte(data >> 8));
Wire.write(byte(data & 0xFF));
Wire.endTransmission();
delay(T67XX_READ_DELAY);
Wire.requestFrom(int(T67XX_I2C_ADDR), 5);
_data[0] = Wire.read();
_data[1] = Wire.read();
_data[2] = Wire.read();
_data[3] = Wire.read();
_data[4] = Wire.read();
}
const char *T67XX::getLastStatusMsg()
{
return getStatusMsg(_sta);
}
const char *T67XX::getStatusMsg(uint16_t sensorStatus)
{
T67XX::status statusStruct;
statusStruct.set(sensorStatus);
if (sensorStatus)
{
if (statusStruct.ERROR)
return PSTR("GENERAL ERROR");
if (statusStruct.CALIBRATION_ERROR)
return PSTR("CALIBRATION ERROR");
if (statusStruct.FLASH_ERROR)
return PSTR("FLASH ERROR");
if (statusStruct.REBOOT)
return PSTR("REBOOT");
if (statusStruct.WARMUP)
return PSTR("WARMUP");
if (statusStruct.SINGLE_POINT_CAL)
return PSTR("CALIBRATING");
}
if (TasmotaGlobal.uptime < T67XX_MEASURE_DELAY)
{
return PSTR("WARMUP");
}
return PSTR("OK");
}
void T67XX::Read(void)
{
if ((TasmotaGlobal.uptime < T67XX_MEASURE_DELAY) || (TasmotaGlobal.uptime % T67XX_MEASURE_INTERVAL > 0))
{
return;
}
uint16_t sensorStatus = getStatus();
if (!sensorStatus)
{
if (_init)
{
setABCMode(true);
_init = 0;
}
_ppm = readPPM();
//AddLog_P(LOG_LEVEL_INFO, PSTR("T67XX %d PPM"), _ppm);
}
else
{
//AddLog_P(LOG_LEVEL_INFO, PSTR("T67XX status: %s"), getLastStatusMsg());
}
}
T67XX t67xx;
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xsns89(uint8_t function)
{
uint16_t ppm = 0;
if (!I2cEnabled(XI2C_61))
{
return false;
}
bool result = false;
if (FUNC_INIT == function)
{
t67xx.detect();
}
else if (t67xx.found())
{
switch (function)
{
case FUNC_INIT:
break;
case FUNC_EVERY_SECOND:
t67xx.Read();
break;
case FUNC_JSON_APPEND:
ppm = t67xx.PPM();
if ((ppm > 100) && (ppm < 5000))
{
ResponseAppend_P(PSTR(",\"T67XX\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_STATUS "\":\"%s\"}"), t67xx.PPM(), t67xx.getLastStatusMsg());
}
else
{
ResponseAppend_P(PSTR(",\"T67XX\":{\"" D_JSON_CO2 "\":null,\"" D_JSON_STATUS "\":\"%s\"}"), t67xx.getLastStatusMsg());
}
break;
#ifdef USE_WEBSERVER
case FUNC_WEB_SENSOR:
ppm = t67xx.PPM();
if (ppm > 0)
{
WSContentSend_PD(PSTR("{s}T67XX " D_CO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"), ppm);
}
break;
#endif // USE_WEBSERVER
}
}
return result;
}
#endif // USE_T67xx
#endif // USE_I2C

View File

@ -254,7 +254,7 @@ a_features = [[
"USE_TOF10120","USE_SDM72","USE_DISPLAY_TM1637","USE_PROJECTOR_CTRL"
],[
"USE_MPU_ACCEL","USE_TFMINIPLUS","USE_CSE7761","USE_BERRY",
"USE_BM8563","USE_ENERGY_DUMMY","USE_AM2320","",
"USE_BM8563","USE_ENERGY_DUMMY","USE_AM2320","USE_T67XX",
"","","","",
"","","","",
"","","","",
@ -288,7 +288,7 @@ else:
obj = json.load(fp)
def StartDecode():
print ("\n*** decode-status.py v20210627 by Theo Arends and Jacek Ziolkowski ***")
print ("\n*** decode-status.py v20210713 by Theo Arends and Jacek Ziolkowski ***")
# print("Decoding\n{}".format(obj))

View File

@ -75,9 +75,14 @@ return_types = {
"lv_border_side_t": "i",
"lv_align_t": "i",
"lv_keyboard_mode_t": "i",
# "lv_group_focus_cb_t": "i",
"lv_indev_type_t": "i",
"lv_event_t": "i",
"lv_signal_t": "i",
# "lv_signal_cb_t": "c",
# "lv_design_cb_t": "c",
# "lv_event_cb_t": "c",
# "lv_group_focus_cb_t": "c",
"lv_obj_t *": "lv_obj",
"lv_color_t": "lv_color",
@ -85,19 +90,27 @@ return_types = {
"lv_group_t *": "lv_group",
#"lv_disp_t*": "lv_disp",
#"lv_style_list_t*": "",
# callbacks
"lv_group_focus_cb_t": "lv_group_focus_cb",
"lv_event_cb_t": "lv_event_cb",
"lv_signal_cb_t": "lv_signal_cb",
"lv_design_cb_t": "lv_design_cb",
"lv_gauge_format_cb_t": "lv_gauge_format_cb",
}
lv = {}
lvs = [] # special case for case for lv_style
lv0 = [] # function in lvlg module
lv_module = []
lv_cb_types = [] # list of callback types that will need each a separate C callback, later sorted by first argument
lv_cb_types = ['lv_group_focus_cb', 'lv_event_cb', 'lv_signal_cb', 'lv_design_cb', 'lv_gauge_format_cb']
# list of callback types that will need each a separate C callback
lv_widgets = ['arc', 'bar', 'btn', 'btnmatrix', 'calendar', 'canvas', 'chart', 'checkbox',
'cont', 'cpicker', 'dropdown', 'gauge', 'img', 'imgbtn', 'keyboard', 'label', 'led', 'line',
'linemeter', 'list', 'msgbox', 'objmask', 'templ', 'page', 'roller', 'slider', 'spinbox',
'spinner', 'switch', 'table', 'tabview', 'textarea', 'tileview', 'win']
lv_prefix = ['obj', 'group', 'style', 'indev'] + lv_widgets
lv_prefix = ['obj', 'group', 'style', 'indev', ] + lv_widgets
def try_int(s):
try:
@ -115,6 +128,7 @@ def c_convert_ret_type(c_ret):
with open(lv_widgets_file) as f:
for l_raw in f:
l_raw = re.sub('//.*$', '', l_raw) # remove trailing comments
l_raw = re.sub('LV_ATTRIBUTE_FAST_MEM ', '', l_raw) # remove LV_ATTRIBUTE_FAST_MEM marker
l_raw = re.sub('\s+', ' ', l_raw) # replace any multi-space with a single space
l_raw = l_raw.strip(" \t\n\r") # remove leading or trailing spaces
l_raw = re.sub('static ', '', l_raw)
@ -128,12 +142,16 @@ with open(lv_widgets_file) as f:
ret_type = g.group(1) # return type of the function
# Ex: ret_type -> 'void'
if ret_type not in return_types:
ret_type_without_t = re.sub(r"_t$", "", ret_type)
if ret_type in return_types:
# convert return type
c_ret = c_convert_ret_type(ret_type)
elif ret_type_without_t in lv_cb_types:
c_ret = "c" # general callback, if not already captured by explicit type
else:
print(f" // Skipping unsupported return type: {ret_type}")
continue
# convert return type
c_ret = c_convert_ret_type(ret_type)
# convert arguments
c_args = ""
@ -155,7 +173,7 @@ with open(lv_widgets_file) as f:
ga_type = re.sub(r"_t$", "", ga_type)
# if the type is a single letter, we just add it
if len(ga_type) == 1:
if len(ga_type) == 1 and ga_type != 'c': # callbacks are different
c_args += ga_type
else:
if ga_type.endswith("_cb"):
@ -175,22 +193,25 @@ with open(lv_widgets_file) as f:
c_func_name = ""
if func_name == "lv_style_init":
continue # no need for init as it would collied with native init (and called behind the scene anyways)
found = False
for subtype in lv_prefix:
if func_name == "lv_style_init": continue # no need for init as it would collied with native init (and called behind the scene anyways)
if func_name.startswith("lv_" + subtype + "_"):
be_name = re.sub("^lv_" + subtype + "_", '', func_name)
c_func_name = "lvbe_" + subtype + "_" + be_name
if subtype not in lv: lv[subtype] = [] # add entry
# special case if the function is create, we change the return type to macth the class
# if be_name == 'create':
# c_ret = "lv_" + subtype
# lv0.append( [ c_func_name, c_ret, c_args, func_name, subtype ] ) # also add to lvgl
lv[subtype].append( [ c_func_name, c_ret, c_args, func_name, be_name ] )
found = True
break
if found: continue
# not found, we treat it as lv top level function
be_name = re.sub("^lv_", '', func_name)
lv0.append( [ func_name, c_ret, c_args, func_name, be_name ] )
# print(lv0[-1])
print("| callback types"+str(lv_cb_types))
@ -444,7 +465,7 @@ for subtype, flv in lv.items():
print(f" {{ NULL, NULL }}")
print(f" }};")
print(f" be_regclass(vm, \"lv_{subtype}\", members);")
if subtype != "obj" and subtype != "group": # lv_obj and lv_group do not inherit from lv_obj
if subtype in lv_widgets: # only for subclasses of lv_obj
print()
print(f" be_getglobal(vm, \"lv_{subtype}\");")
print(f" be_getglobal(vm, \"lv_obj\");")
@ -460,7 +481,7 @@ for subtype, flv in lv.items():
print(f"}};")
print()
print(f"/* @const_object_info_begin")
if subtype != "obj" and subtype != "group": # lv_obj and lv_group do not inherit from lv_obj
if subtype in lv_widgets: # only for subclasses of lv_obj
print(f"class be_class_lv_{subtype} (scope: global, name: lv_{subtype}, super: be_class_lv_obj) {{")
else:
print(f"class be_class_lv_{subtype} (scope: global, name: lv_{subtype}) {{")
@ -524,24 +545,43 @@ extern int lv0_screenshot(bvm *vm);
static int lv_get_hor_res(void) {
return lv_disp_get_hor_res(lv_disp_get_default());
}
static int lv_get_ver_res(bvm *vm) {
static int lv_get_ver_res(void) {
return lv_disp_get_ver_res(lv_disp_get_default());
}
/* `lv` methods */
const lvbe_call_c_t lv_func[] = {
// resolution
{ "get_hor_res", (void*) &lv_get_hor_res, "i", "" },
{ "get_ver_res", (void*) &lv_get_ver_res, "i", "" },
""")
// layers
{ "layer_sys", (void*) &lv_layer_sys, "lv_obj", "" },
{ "layer_top", (void*) &lv_layer_top, "lv_obj", "" },
func_out = {} # used to sort output
for f in lv0:
c_func_name = f[0]
c_ret_type = f[1]
c_argc = f[2]
if c_argc is not None: c_argc = "\"" + c_argc + "\""
orig_func_name = f[3]
be_name = f[4]
func_out[be_name] = f" {{ \"{be_name}\", (void*) &{orig_func_name}, \"{c_ret_type}\", { c_argc if c_argc else 'nullptr'} }},"
// screens
{ "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
{ "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
for be_name in sorted(func_out):
print(func_out[be_name])
# // resolution
# { "get_hor_res", (void*) &lv_get_hor_res, "i", "" },
# { "get_ver_res", (void*) &lv_get_ver_res, "i", "" },
# // layers
# { "layer_sys", (void*) &lv_layer_sys, "lv_obj", "" },
# { "layer_top", (void*) &lv_layer_top, "lv_obj", "" },
# // screens
# { "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
# { "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
# { "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
print("""
};
const size_t lv_func_size = sizeof(lv_func) / sizeof(lv_func[0]);
@ -574,17 +614,7 @@ print("""
};
const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]);
""")
for f in lv0:
c_func_name = f[0]
print(f"extern int {c_func_name}(bvm *vm);")
print("""
#if !BE_USE_PRECOMPILED_OBJECT
//#if 1 // TODO we will do pre-compiled later
be_native_module_attr_table(lvgl) {
// Symbols
@ -686,15 +716,6 @@ print("""
be_native_module_function("load_freetype_font", lv0_load_freetype_font),
be_native_module_function("screenshot", lv0_screenshot),
""")
for f in lv0:
c_func_name = f[0]
be_name = f[4]
print(f" be_native_module_function(\"{be_name}\", {c_func_name}),")
print("""
};
be_define_native_module(lvgl, NULL);
@ -849,16 +870,6 @@ print("""
load_freetype_font, func(lv0_load_freetype_font)
screenshot, func(lv0_screenshot)
""")
for f in lv0:
c_func_name = f[0]
be_name = f[4]
print(f" {be_name}, func({c_func_name})")
print("""
}
@const_object_info_end */
#include "../generate/be_fixed_lvgl.h"

View File

@ -618,3 +618,18 @@ TEXTAREA_CURSOR_LAST
// };
LV_DRAW_MASK_RES_TRANSP
LV_DRAW_MASK_RES_FULL_COVER
LV_DRAW_MASK_RES_CHANGED
LV_DRAW_MASK_RES_UNKNOWN
LV_DRAW_MASK_TYPE_LINE
LV_DRAW_MASK_TYPE_ANGLE
LV_DRAW_MASK_TYPE_RADIUS
LV_DRAW_MASK_TYPE_FADE
LV_DRAW_MASK_TYPE_MAP
LV_DRAW_MASK_LINE_SIDE_LEFT
LV_DRAW_MASK_LINE_SIDE_RIGHT
LV_DRAW_MASK_LINE_SIDE_TOP
LV_DRAW_MASK_LINE_SIDE_BOTTOM

View File

@ -158,7 +158,6 @@ void lv_event_send_refresh_recursive(lv_obj_t * obj);
// lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t event, const void * data);
const void * lv_event_get_data(void);
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb);
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb);
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
@ -1163,3 +1162,82 @@ void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, lv_anim_enable_t anim_en);
static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
static inline void lv_win_scroll_ver(lv_obj_t * win, lv_coord_t dist)
// ======================================================================
// Patch
// ======================================================================
// lv_signal_send should be renamed lv_obj_signal_send
// lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
lv_res_t lv_obj_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
// ======================================================================
// LV top level functions
// ======================================================================
// resolution
lv_coord_t lv_get_hor_res(void);
lv_coord_t lv_get_ver_res(void);
// layers
static inline lv_obj_t * lv_layer_sys(void);
static inline lv_obj_t * lv_layer_top(void);
// screens
static inline lv_obj_t * lv_scr_act(void);
static inline void lv_scr_load(lv_obj_t * scr);
void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del);
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
// ======================================================================
// LV DRAW
// ======================================================================
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc);
lv_img_src_t lv_img_src_get_type(const void * src);
uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf);
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_label_dsc_t * dsc, const char * txt, lv_draw_label_hint_t * hint);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip, const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
int16_t lv_draw_mask_add(void * param, void * custom_id);
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len);
void * lv_draw_mask_remove_id(int16_t id);
void * lv_draw_mask_remove_custom(void * custom_id);
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void);
void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x, lv_coord_t p2y, lv_draw_mask_line_side_t side);
void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle, lv_draw_mask_line_side_t side);
void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vertex_x, lv_coord_t vertex_y, lv_coord_t start_angle, lv_coord_t end_angle);
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top, lv_coord_t y_top, lv_opa_t opa_bottom, lv_coord_t y_bottom);
void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map);
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_rect_dsc_t * dsc);
void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style);
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc);
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask, const lv_draw_rect_dsc_t * draw_dsc);
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color);
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
void lv_img_buf_free(lv_img_dsc_t * dsc);
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
// void lv_img_cache_set_size(uint16_t new_slot_num);
// void lv_img_cache_invalidate_src(const void * src);