commit 836612e8d79805c7432d08737d394d074fd61969
parent a86e103118cda115b86c3bcdc67e78014a97f874
Author: filipton <filipton12@gmail.com>
Date: Wed, 15 Jan 2025 19:37:45 +0100
fix: get next partition if booted from factory/test partition (Closes #1)
Diffstat:
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
@@ -55,9 +55,7 @@ where
/// To begin ota update (need to provide flash size)
pub fn ota_begin(&mut self, size: u32, target_crc: u32) -> Result<()> {
- let next_part = self
- .get_next_ota_partition()
- .ok_or(OtaError::NoNextOtaPartition)?;
+ let next_part = self.get_next_ota_partition().unwrap_or(0);
let ota_offset = self.get_partitions()[next_part].0;
self.progress = Some(FlashProgress {
diff --git a/src/structs.rs b/src/structs.rs
@@ -8,7 +8,6 @@ pub enum OtaError {
WrongCRC,
WrongOTAPArtitionOrder,
OtaVerifyError,
- NoNextOtaPartition,
CannotFindCurrentBootPartition,
}