Skip to content

Commit

Permalink
Support for grow on mount when resizing FS to max (#19659)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Oct 3, 2023
1 parent 58d4333 commit 94842bc
Show file tree
Hide file tree
Showing 3 changed files with 652 additions and 738 deletions.
14 changes: 0 additions & 14 deletions lib/libesp32/berry_tasmota/src/embedded/partition_core.be
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ class Partition
var fs_slot = self.slots[-1]
fs_slot.sz += unallocated * 1024
self.save()
self.invalidate_spiffs() # erase SPIFFS or data is corrupt

# restart
tasmota.global.restart_flag = 2
Expand All @@ -601,19 +600,6 @@ class Partition
end
end

#- invalidate SPIFFS partition to force format at next boot -#
#- we simply erase the first byte of the first 2 blocks in the SPIFFS partition -#
def invalidate_spiffs()
import flash
#- we expect the SPIFFS partition to be the last one -#
var spiffs = self.slots[-1]
if !spiffs.is_spiffs() raise 'value_error', 'No SPIFFS partition found' end

var b = bytes("00") #- flash memory: we can turn bits from '1' to '0' -#
flash.write(spiffs.start , b) #- block #0 -#
flash.write(spiffs.start + 0x1000, b) #- block #1 -#
end

# switch to safeboot `factory` partition
def switch_factory(force_ota)
import flash
Expand Down
14 changes: 0 additions & 14 deletions lib/libesp32/berry_tasmota/src/embedded/partition_core_shelly.be
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ class Partition
var fs_slot = self.slots[-1]
fs_slot.sz += unallocated * 1024
self.save()
self.invalidate_spiffs() # erase SPIFFS or data is corrupt

# restart
tasmota.global.restart_flag = 2
Expand All @@ -603,19 +602,6 @@ class Partition
end
end

#- invalidate SPIFFS partition to force format at next boot -#
#- we simply erase the first byte of the first 2 blocks in the SPIFFS partition -#
def invalidate_spiffs()
import flash
#- we expect the SPIFFS partition to be the last one -#
var spiffs = self.slots[-1]
if !spiffs.is_spiffs() raise 'value_error', 'No SPIFFS partition found' end

var b = bytes("00") #- flash memory: we can turn bits from '1' to '0' -#
flash.write(spiffs.start , b) #- block #0 -#
flash.write(spiffs.start + 0x1000, b) #- block #1 -#
end

# switch to safeboot `factory` partition
def switch_factory(force_ota)
import flash
Expand Down
Loading

0 comments on commit 94842bc

Please sign in to comment.