fix saving
This commit is contained in:
parent
4c8dbfe92f
commit
6c5abf43a7
|
|
@ -157,7 +157,7 @@ bind_interrupts!(struct AdcIrqs {
|
||||||
SAADC => saadc::InterruptHandler;
|
SAADC => saadc::InterruptHandler;
|
||||||
});
|
});
|
||||||
|
|
||||||
const DATA_POINT: u32 = 0x000F9800 - 4096;
|
const DATA_POINT: u32 = 0xf8000;
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(spawner: Spawner) {
|
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 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];
|
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);
|
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 {
|
if let Err(e) = flash.as_mut().write(DATA_POINT, &data).await {
|
||||||
error!("Error writing to flash: {}", e);
|
error!("Error writing to flash: {}", e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue