diff --git a/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c index 31c7ffe3de2a..e4962d731cc2 100644 --- a/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c @@ -5,6 +5,7 @@ *******************************************************************/ #include "be_constobj.h" #include "be_ctypes.h" +#include "be_mapping.h" extern struct TasmotaGlobal_t TasmotaGlobal; extern struct TSettings * Settings; @@ -62,6 +63,10 @@ extern int l_i2cenabled(bvm *vm); extern int tasm_find_op(bvm *vm); extern int tasm_apply_str_op(bvm *vm); +// tasmota.version() -> int +extern int32_t be_Tasmota_version(void); +BE_FUNC_CTYPE_DECLARE(be_Tasmota_version, "i", "-"); + #include "solidify/solidified_tasmota_class.h" #include "solidify/solidified_rule_matcher.h" #include "solidify/solidified_trigger_class.h" @@ -137,6 +142,7 @@ class be_class_tasmota (scope: global, name: Tasmota) { get_switches, func(l_getswitch) i2c_enabled, func(l_i2cenabled) + version, ctype_func(be_Tasmota_version) fast_loop, closure(Tasmota_fast_loop_closure) add_fast_loop, closure(Tasmota_add_fast_loop_closure) diff --git a/tasmota/berry/modules/Partition_Wizard.tapp b/tasmota/berry/modules/Partition_Wizard.tapp index 98bfc21b98ba..1f4e94e0a28b 100644 Binary files a/tasmota/berry/modules/Partition_Wizard.tapp and b/tasmota/berry/modules/Partition_Wizard.tapp differ diff --git a/tasmota/berry/modules/partition_wizard.be b/tasmota/berry/modules/Partition_Wizard/partition_wizard.be similarity index 97% rename from tasmota/berry/modules/partition_wizard.be rename to tasmota/berry/modules/Partition_Wizard/partition_wizard.be index 9db98990145b..022e12295661 100644 --- a/tasmota/berry/modules/partition_wizard.be +++ b/tasmota/berry/modules/Partition_Wizard/partition_wizard.be @@ -249,8 +249,10 @@ class Partition_wizard_UI webserver.content_send(string.format("

You can expand the file system by %i KB.
Its content will be lost.

", unallocated)) webserver.content_send("
") - webserver.content_send("

") + if !self.support_grow_on_mount() + webserver.content_send("onsubmit='return confirm(\"This will DELETE the content of the file system and cause a restart.\");'") + end + webserver.content_send(">

") webserver.content_send("

") elif self.has_factory_layout(p) @@ -679,6 +681,21 @@ class Partition_wizard_UI webserver.content_stop() #- end of web page -# end + ####################################################################### + # returns true is LittleFS supports grow on mount + # + # True if version is above 13.1.0.3 + ####################################################################### + def support_grow_on_mount() + import introspect + if introspect.get(tasmota, "version") != nil + if tasmota.version() >= 0x0D010003 + return true + end + end + return false + end + ####################################################################### # Web Controller, called by POST to `/part_wiz` ####################################################################### @@ -710,7 +727,9 @@ class Partition_wizard_UI var fs_slot = p.slots[-1] fs_slot.sz += unallocated * 1024 p.save() - p.invalidate_spiffs() # erase SPIFFS or data is corrupt + if !self.support_grow_on_mount() + p.invalidate_spiffs() # erase SPIFFS or data is corrupt + end #- and force restart -# webserver.redirect("/?rst=") diff --git a/tasmota/berry/modules/Partition_Wizard/partition_wizard.bec b/tasmota/berry/modules/Partition_Wizard/partition_wizard.bec deleted file mode 100644 index 786b64901bbf..000000000000 Binary files a/tasmota/berry/modules/Partition_Wizard/partition_wizard.bec and /dev/null differ 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 56323a6641e0..afb1bc49610e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino @@ -535,6 +535,11 @@ extern "C" { be_pushint(vm, ret); be_return(vm); } + + int32_t be_Tasmota_version(void) { + return VERSION; + } + /* # test patterns for all-in-one version