This commit is contained in:
2025-01-11 05:14:37 +01:00
parent 85a4e4e7c5
commit 30eda090b1
4 changed files with 10 additions and 720 deletions

View File

@@ -13,24 +13,6 @@ use picoserve::{
routing::{get, put_service, PathRouter},
Router,
};
use serde::Serialize;
mod error;
pub use crate::error::Error;
#[derive(Serialize)]
#[serde(rename_all = "snake_case", tag = "status")]
pub enum Status<'a> {
Connected { version: &'a str },
Disconnected,
PreparingUpdate,
Erasing,
Writing { progress: u32 },
Verifying,
UpdateFailed { error: &'a str },
UpdateComplete,
}
#[derive(Clone, Copy)]
struct UpdaterService<DFU, STATE>
@@ -114,10 +96,7 @@ where
}
debug!("Writing chunk: {}", read);
if let Err(err) = writer
.write(size, &buffer.0[..read])
.map_err(Error::FlashError)
{
if let Err(err) = writer.write(size, &buffer.0[..read]) {
return response::Response::new(
StatusCode::INTERNAL_SERVER_ERROR,
format_args!("{err:?}"),