From 8b2539a35a26af2744a0225ff7ad3fac27d8d0a1 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sat, 6 May 2023 12:18:12 +0200 Subject: [PATCH] Partition_Manager.tapp fixed (#18588) --- CHANGELOG.md | 1 + tasmota/berry/modules/Partition_Manager.tapp | Bin 17087 -> 17089 bytes .../modules/Partition_Manager/partition.bec | Bin 16636 -> 16638 bytes tasmota/berry/modules/partition.be | 58 +++++++++--------- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6532b2f1c..0184f9c4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file. ### Changed ### Fixed +- Partition_Manager.tapp fixed ### Removed diff --git a/tasmota/berry/modules/Partition_Manager.tapp b/tasmota/berry/modules/Partition_Manager.tapp index 282490659078c0c4c69a6d99bed5c0a4ecc6c005..71f0a0e3fbe93f89953faa3acfca4081179cb476 100644 GIT binary patch delta 723 zcmY*XL1+^}6n#58yF0s?jZ2(Lj7zK_wA7?tA|m8agSUFF*=EUvCCuPwLlPA}cQIUl(& z-%T#u(((4N$~nWmhrOybf5YZb8Wp@LAzFZp!9-$M;=F{{Nr!I4Ao_F;Z8|eUbR`11 zr|4dgm~OzqMFOxD9Y2Q#t$c%H@YyOGS)ak7ogVE{all5oKe_A16~Q5?wQdgP?J`Sr z$1?B?xC<0x6XghYkfg&gTB#Awz#sUpt#x`nnLS6d0Nx^)Bp?kb@{!5%Gg`+PupMyH z1ep*_96+^flp>pzsIC&J>t2!S#e}(Gg`?b|wQimWE64{icY_)uUB`0=q|t(EP7%N> zK)kU{)rAOSaFu+^ih}frtOmw69P~b(Y^}Q-;~8DiOou*ErWMsL3R+ zsS#x$NF1DsET-yaPE{aEyD3e@VVdrEU*yA@shRfEUlU&O+OBo;Dbq5F9z zlQr0y&fulGQyBe+(-ZGUZWw&MFqIqST{Ev*Hev)6>Yuyog57Q i*Px+m|IE!AtZa@9`kx(p?ZyPxw(C7>oVA^X9>71XE19nV delta 705 zcmY*X&ubG=5dPlV*|#sr+wx4-5Nc=m*x3|i&bK&XY!)Pyj@?q}L&t)JJA62a1xVzce?A*D%xVm<8CCtGo@rO)a ze?LcxaIbTJEm?3^LKi4;S_5hWI)bDa4xKho-E{1R0yN-vRqKho2vm9q)=@|lX zJmh*NU&ewpZ8@Wl?wt5rWb{L&|L(u^p`6;k6|RaU4=8YTK5U8 znRS`{Ha3}G2kZ}G;Z^E{*)Hp*^ec536FHt~NTznwcE~gd_B#I`p5er=Tw(iAl?Y_x zPZKAxlZKfu>xW9-m)boI%rnGvoC~F-hJ|h)ZKmL6I+$TpI-bc;FZ2$lO diff --git a/tasmota/berry/modules/Partition_Manager/partition.bec b/tasmota/berry/modules/Partition_Manager/partition.bec index 30064881a02ce6af29da439b9829443844b18f01..c7278f0759377ea2a343cc0c379aa2f803e3e600 100644 GIT binary patch delta 574 zcmYjPv1;5v5Pcerq?No@mh(D@i#S}E5RNN_A=rgKAf*BqP@yWM2?WxZuwc7Oah(sh z0aqy!FkIutfqXzJe?n?QY)BV$8LeD+VVT`|yKml`-G8S+cN$zymL@C6c{Js7j z9n19>{yOF(a4R&CPqF%X|5IQubbk5k5u zm#gO8dQ&8FWuV)~?IdX@(@3Ogm-o^{GGJVSr*%a3Al$GssPR=NT}h~yyR%ezSw)-0 z=R_CFII|TpZvKdh7+O?lucEJ)g`_LQy`0s>*1OU04(9pw@EcY))9J>L3-`{WVfAJI L=fhuldwBjIrm|~L delta 576 zcmYjPzfaph7=3sC?tDqE=m<_^1q2H%63S@7P=@>g9X)jL;H6SJwGvB&P69TDY>D^> zx-bAj%EH3Hz|PLdRtX73jL7ciw5~E(-`)4VAMd?$aVp+V#my#Z!r}L$Z5Iu@Aj$&tQfTXoa+M=*lGXGd_DUUd z=MML^ft-VP%)dZ0m1qts4eO8>kgNyBgKXyDa*Zy_?K1AXt#A`D9(fVQeL`=<@j!lv z`>-|(LYqj|w49r>K7#wo{g)qk@Qo5~3>{}6=bslKF-VscRvDou5AFQe09#D4C>yDi zlsK4t*+s!F23TQM#;;VYm@U7D57ACZx&zs8edz9O!Cq(?_XBK9LmMa5iq3R1nkwTG z7|LFmfP!HHWwBN>>i=N&w7c7?^Nqc8RiA%-zOQR0!@>C< D7+rBl diff --git a/tasmota/berry/modules/partition.be b/tasmota/berry/modules/partition.be index e039f3723..8652f238c 100644 --- a/tasmota/berry/modules/partition.be +++ b/tasmota/berry/modules/partition.be @@ -26,7 +26,7 @@ class Partition_info var type var subtype var start - var size + var sz var label var flags @@ -46,7 +46,7 @@ class Partition_info self.type = 0 self.subtype = 0 self.start = 0 - self.size = 0 + self.sz = 0 self.label = '' self.flags = 0 return @@ -59,7 +59,7 @@ class Partition_info self.type = raw.get(2,1) self.subtype = raw.get(3,1) self.start = raw.get(4,4) - self.size = raw.get(8,4) + self.sz = raw.get(8,4) self.label = self.remove_trailing_zeroes(raw[12..27]).asstring() self.flags = raw.get(28,4) @@ -149,7 +149,7 @@ class Partition_info return string.format("", self.type, type_s, self.subtype, subtype_s, - self.start, self.size, + self.start, self.sz, self.label, self.flags) end @@ -160,7 +160,7 @@ class Partition_info b.add(self.type, 1) b.add(self.subtype, 1) b.add(self.start, 4) - b.add(self.size, 4) + b.add(self.sz, 4) var label = bytes().fromstring(self.label) label.resize(16) b = b + label @@ -525,12 +525,12 @@ class Partition_manager_UI webserver.content_send(string.format(" %s%s ", slot.start / 0x1000, slot.label, active ? " (active)" : "")) - webserver.content_send(string.format("

Partition size: %i KB

", slot.size / 1024)) + webserver.content_send(string.format("

Partition size: %i KB

", slot.sz / 1024)) var used = slot.get_image_size() - if used > slot.size slot.used = -1 end # we may have a leftover of a previous firmware but the slot shrank - in this case the slot is inknown + if used > slot.sz slot.used = -1 end # we may have a leftover of a previous firmware but the slot shrank - in this case the slot is inknown if used >= 0 webserver.content_send(string.format("

Used: %i KB

", used / 1024)) - webserver.content_send(string.format("

Free: %i KB

", (slot.size - used) / 1024)) + webserver.content_send(string.format("

Free: %i KB

", (slot.sz - used) / 1024)) else webserver.content_send("

Used: unknown

") webserver.content_send("

Free: unknown

") @@ -567,10 +567,10 @@ class Partition_manager_UI webserver.content_send(string.format("
 filesystem ", slot.start / 0x1000)) - webserver.content_send(string.format("

Partition size: %i KB

", slot.size / 1024)) + webserver.content_send(string.format("

Partition size: %i KB

", slot.sz / 1024)) if free_mem != nil - webserver.content_send(string.format("

Max size: %i KB

", (slot.size + free_mem) / 1024)) + webserver.content_send(string.format("

Max size: %i KB

", (slot.sz + free_mem) / 1024)) webserver.content_send(string.format("

Unallocated: %i KB

", free_mem / 1024)) end @@ -578,7 +578,7 @@ class Partition_manager_UI webserver.content_send("

New size: (multiple of 16 KB)

") webserver.content_send("
") - webserver.content_send(string.format("", (slot.size + free_mem) / 1024, ((slot.size + free_mem) / 1024 / 16)*16)) + webserver.content_send(string.format("", (slot.sz + free_mem) / 1024, ((slot.sz + free_mem) / 1024 / 16)*16)) webserver.content_send("

") webserver.content_send("

") end @@ -598,7 +598,7 @@ class Partition_manager_UI self.page_show_partition(slot, false, nil, nil) elif slot.is_spiffs() var flash_size = tasmota.memory()['flash'] * 1024 - var used_size = (slot.start + slot.size) + var used_size = (slot.start + slot.sz) self.page_show_spiffs(slot, slot == p.slots[-1] ? flash_size - used_size : nil) end end @@ -615,11 +615,11 @@ class Partition_manager_UI else # we can proceed var app0 = p.get_ota_slot(0) - var app0_size_kb = ((app0.size / 1024 + 63) / 64) * 64 # rounded to upper 64kb + var app0_size_kb = ((app0.sz / 1024 + 63) / 64) * 64 # rounded to upper 64kb var app0_used_kb = (((app0.get_image_size()) / 1024 / 64) + 1) * 64 var app1 = p.get_ota_slot(1) - var app1_size_kb = ((app1.size / 1024 + 63) / 64) * 64 # rounded to upper 64kb + var app1_size_kb = ((app1.sz / 1024 + 63) / 64) * 64 # rounded to upper 64kb # var app1_used_kb = (((app1.get_image_size()) / 1024 / 64) + 1) * 64 # we don't actually need it var flash_size_kb = tasmota.memory()['flash'] @@ -723,10 +723,10 @@ class Partition_manager_UI if spiffs_size_kb < 0 || spiffs_size_kb > spiffs_max_size raise "value_error", string.format("Invalid fs_size %i, should be between 0 and %i", spiffs_size_kb, spiffs_max_size) end - if spiffs_size_kb == spiffs_slot.size/1024 raise "value_error", "FS size unchanged, abort" end + if spiffs_size_kb == spiffs_slot.sz/1024 raise "value_error", "FS size unchanged, abort" end #- write the new SPIFFS partition size -# - spiffs_slot.size = spiffs_size_kb * 1024 + spiffs_slot.sz = spiffs_size_kb * 1024 p.save() p.invalidate_spiffs() # erase SPIFFS or data is corrupt @@ -750,7 +750,7 @@ class Partition_manager_UI if p.ota_max() != 1 raise "internal_error", "There are more than 2 OTA partition, abort" end - var app0_size_kb = ((app0.size / 1024 + 63) / 64) * 64 # rounded to upper 64kb + var app0_size_kb = ((app0.sz / 1024 + 63) / 64) * 64 # rounded to upper 64kb var app0_used_kb = (((app0.get_image_size()) / 1024 / 64) + 1) * 64 var flash_size_kb = tasmota.memory()['flash'] @@ -762,13 +762,13 @@ class Partition_manager_UI #- all good, proceed -# # resize app0 - app0.size = part_size_kb * 1024 + app0.sz = part_size_kb * 1024 # change app1 - app1.start = app0.start + app0.size - app1.size = part_size_kb * 1024 + app1.start = app0.start + app0.sz + app1.sz = part_size_kb * 1024 # change spiffs - spiffs.start = app1.start + app1.size - spiffs.size = flash_size_kb * 1024 - spiffs.start + spiffs.start = app1.start + app1.sz + spiffs.sz = flash_size_kb * 1024 - spiffs.start p.save() p.invalidate_spiffs() # erase SPIFFS or data is corrupt @@ -792,9 +792,9 @@ class Partition_manager_UI if p.ota_max() != 1 raise "internal_error", "There are more than 2 OTA partition, abort" end - var app0_size_kb = ((app0.size / 1024 + 63) / 64) * 64 # rounded to upper 64kb + var app0_size_kb = ((app0.sz / 1024 + 63) / 64) * 64 # rounded to upper 64kb var app0_used_kb = (((app0.get_image_size()) / 1024 / 64) + 1) * 64 - var app1_size_kb = ((app1.size / 1024 + 63) / 64) * 64 # rounded to upper 64kb + var app1_size_kb = ((app1.sz / 1024 + 63) / 64) * 64 # rounded to upper 64kb var flash_size_kb = tasmota.memory()['flash'] var part0_size_kb = int(webserver.arg("app0")) @@ -809,13 +809,13 @@ class Partition_manager_UI #- all good, proceed -# # resize app0 - app0.size = part0_size_kb * 1024 + app0.sz = part0_size_kb * 1024 # change app1 - app1.start = app0.start + app0.size - app1.size = part1_size_kb * 1024 + app1.start = app0.start + app0.sz + app1.sz = part1_size_kb * 1024 # change spiffs - spiffs.start = app1.start + app1.size - spiffs.size = flash_size_kb * 1024 - spiffs.start + spiffs.start = app1.start + app1.sz + spiffs.sz = flash_size_kb * 1024 - spiffs.start p.save() p.invalidate_spiffs() # erase SPIFFS or data is corrupt