eculocate

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c512eadc650e67e495a6e34f1fabfc2a5a29677a
parent d81e4eb0b41bebc3efa338709161c2f89eb8ef69
Author: filipton <filipton12@gmail.com>
Date:   Tue, 15 Jul 2025 18:41:00 +0200

feat: progress details struct

Diffstat:
MCargo.lock | 2+-
MCargo.toml | 2+-
Msrc/lib.rs | 12++++++++++--
3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -48,7 +48,7 @@ checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" [[package]] name = "esp-hal-ota" -version = "0.4.2" +version = "0.4.3" dependencies = [ "defmt", "embedded-storage", diff --git a/Cargo.toml b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp-hal-ota" -version = "0.4.2" +version = "0.4.3" edition = "2024" license = "MIT" description = "OTA library for esp-hal" diff --git a/src/lib.rs b/src/lib.rs @@ -30,6 +30,11 @@ where pinfo: PartitionInfo, } +pub struct ProgressDetails { + pub remaining: u32, + pub last_crc: u32, +} + impl<S> Ota<S> where S: ReadStorage + Storage, @@ -85,7 +90,7 @@ where } /// Returns progress details to save for resumption later - pub fn get_progress_details(&self) -> Option<(u32, u32)> { + pub fn get_progress_details(&self) -> Option<ProgressDetails> { if self.progress.is_none() { warn!("[OTA] Cannot get progress details!"); @@ -93,7 +98,10 @@ where } let progress = self.progress.as_ref().unwrap(); - Some((progress.remaining, progress.last_crc)) + Some(ProgressDetails { + remaining: progress.remaining, + last_crc: progress.last_crc, + }) } /// Returns ota progress in f32 (0..1)