diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e7544189..5c45ef257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - LVGL experimental mirroring of display on Web UI (#23041) - Allow acl in mqtt when client certificate is in use with `#define USE_MQTT_CLIENT_CERT` (#22998) - Berry `tasmota.when_network_up()` and simplified Matter using it +- Berry `introspect.solidified()` to know if a Berry object is solidified or in RAM ### Breaking Changed diff --git a/lib/libesp32/berry/src/be_introspectlib.c b/lib/libesp32/berry/src/be_introspectlib.c index 78e7eb0e5..3d91e1ad9 100644 --- a/lib/libesp32/berry/src/be_introspectlib.c +++ b/lib/libesp32/berry/src/be_introspectlib.c @@ -137,6 +137,20 @@ static int m_toptr(bvm *vm) be_return_nil(vm); } +static int m_solidified(bvm *vm) +{ + int top = be_top(vm); + if (top >= 1) { + bvalue *v = be_indexof(vm, 1); + if (var_basetype(v) >= BE_FUNCTION || var_type(v) == BE_COMPTR) { + bbool isconst = gc_isconst((bgcobject*)var_toobj(v)); + be_pushbool(vm, isconst); + be_return(vm); + } + } + be_return_nil(vm); +} + static int m_fromptr(bvm *vm) { int top = be_top(vm); @@ -245,6 +259,7 @@ be_native_module_attr_table(introspect) { be_native_module_function("toptr", m_toptr), be_native_module_function("fromptr", m_fromptr), + be_native_module_function("solidified", m_solidified), be_native_module_function("name", m_name), @@ -266,6 +281,7 @@ module introspect (scope: global, depend: BE_USE_INTROSPECT_MODULE) { toptr, func(m_toptr) fromptr, func(m_fromptr) + solidified, func(m_solidified) name, func(m_name) diff --git a/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c index b0bbc6bed..71623a526 100644 --- a/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c @@ -107,7 +107,7 @@ class be_class_tasmota (scope: global, name: Tasmota) { init, closure(class_Tasmota_init_closure) get_free_heap, func(l_getFreeHeap) - arch, func(l_arch) + arch, static_func(l_arch) publish, func(be_mqtt_publish) publish_result, func(l_publish_result) publish_rule, func(l_publish_rule) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino index 9a642cea9..08d160b99 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino @@ -982,7 +982,7 @@ extern "C" { be_return(vm); } - // Berry: `arvh() -> string` + // Berry: `arch() -> string` // ESP object int32_t l_arch(bvm *vm); int32_t l_arch(bvm *vm) {