mirror of https://github.com/arendst/Tasmota.git
Partition_Wizard compatible with grow on mount (#19645)
This commit is contained in:
parent
2ad6353a2d
commit
77cba731b9
|
@ -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)
|
||||
|
|
Binary file not shown.
|
@ -249,8 +249,10 @@ class Partition_wizard_UI
|
|||
webserver.content_send(string.format("<p>You can expand the file system by %i KB.<br>Its content will be lost.</p>", unallocated))
|
||||
|
||||
webserver.content_send("<form action='/part_wiz' method='post' ")
|
||||
webserver.content_send("onsubmit='return confirm(\"This will DELETE the content of the file system and cause a restart.\");'>")
|
||||
webserver.content_send("<p></p><button name='max_fs' class='button bred'>Resize FS to max</button></form></p>")
|
||||
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("><p></p><button name='max_fs' class='button bred'>Resize FS to max</button></form></p>")
|
||||
|
||||
webserver.content_send("<p></p></fieldset><p></p>")
|
||||
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()
|
||||
if !self.support_grow_on_mount()
|
||||
p.invalidate_spiffs() # erase SPIFFS or data is corrupt
|
||||
end
|
||||
|
||||
#- and force restart -#
|
||||
webserver.redirect("/?rst=")
|
Binary file not shown.
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue