From 6c5abf43a72cbe656935b058c630d4bdddd0c1dc Mon Sep 17 00:00:00 2001 From: Vitalii Popov Date: Thu, 12 Feb 2026 23:59:21 +0200 Subject: [PATCH] fix saving --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 25b15b6..60a0f94 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,7 +157,7 @@ bind_interrupts!(struct AdcIrqs { SAADC => saadc::InterruptHandler; }); -const DATA_POINT: u32 = 0x000F9800 - 4096; +const DATA_POINT: u32 = 0xf8000; #[embassy_executor::main] async fn main(spawner: Spawner) { @@ -293,6 +293,9 @@ async fn storage_task(flash: Flash, initial_text_type: TextLightType, initial_te let h_color: [u8; 2] = heart_color.to_le_bytes(); let data = [0b01010101u8, 0b10101010u8, text_type.into(), heart_type.into(), t_color[0], t_color[1], h_color[0], h_color[1], 0xFF, 0xFF, 0xFF, 0xFF]; info!("Saving data: {:?}", data); + if let Err(e) = flash.as_mut().erase(DATA_POINT, DATA_POINT + 4096).await { + error!("Error erasing flash page: {}", e); + } if let Err(e) = flash.as_mut().write(DATA_POINT, &data).await { error!("Error writing to flash: {}", e); }