Skip to content

Commit

Permalink
Add log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 27, 2023
1 parent 187ff2e commit 3261218
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/board/ota/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,20 @@ where

pub async fn erase(&mut self) -> Result<(), OtaError> {
self.update_offset = 0;
match self.update_slot {
Slot::Ota0 => {
for block in 0..InternalDriver::<P0>::BLOCK_COUNT {
self.ota0.erase(block).await?;
}
}
Slot::Ota1 => {
for block in 0..InternalDriver::<P1>::BLOCK_COUNT {
self.ota1.erase(block).await?;
}

let count = match self.update_slot {
Slot::Ota0 => InternalDriver::<P0>::BLOCK_COUNT,
Slot::Ota1 => InternalDriver::<P1>::BLOCK_COUNT,
};

for block in 0..count {
debug!("Erasing block {}/{}", block, count);
match self.update_slot {
Slot::Ota0 => self.ota0.erase(block).await?,
Slot::Ota1 => self.ota1.erase(block).await?,
}
}

Ok(())
}

Expand All @@ -271,6 +273,8 @@ where
residue: 0,
};

debug!("Activating {}", self.update_slot);

self.ota_data.erase(self.update_slot).await?;

let ota_seq = self.ota_data.next_sequence_count();
Expand Down

0 comments on commit 3261218

Please sign in to comment.