QUERY · ISSUE
ESP32: feature request Partition
enhancementport-esp32
related to: #8380
it would be nice if Partition.get_next_update() would also accept the block_size argument.
This way you won't be locked in to a certain block_size after initial deployment when doing OTA updates.
CANDIDATE · PULL REQUEST
esp32: Add esp32.Partition class to interface to OTA functions.
port-esp32
Following on from the comment https://github.com/micropython/micropython/pull/3576#issuecomment-486954865 here is a proposal for a wrapper class for the ESP32 OTA/partition functions.
The API is based around a single Partition class. The constructor is used to create new Partition objects, and methods manipulate such objects.
from esp32 import Partition
# Constructors
Partition(Partition.FIRST, type=Partition.TYPE_APP)
Partition(Partition.FIRST, type=Partition.TYPE_DATA)
Partition(Partition.FIRST, type=Partition.TYPE_DATA, subtype=2, label='nvs')
Partition(Partition.BOOT) # get boot partition
Partition(Partition.RUNNING) # get currently running partition
# Methods
part.info() # returns a 6-tuple of (type, subtype, addr, size, label, encr)
part.readblocks(block_num, buf)
part.writeblocks(block_num, buf)
part.eraseblocks(block_num, size)
part.set_boot() # sets current as bootable, for next reset
part.get_next_update() # returns new Partition
I didn't yet test the OTA functionality
Edit: updated signatures for partition methods.