storage: implement storage writing
This commit is contained in:
@@ -118,22 +118,32 @@ async fn main(spawner: Spawner) {
|
||||
spawner.must_spawn(renderbug_embassy::tasks::oled_render::oled_render(output, oled_surfaces, oled_uniforms));
|
||||
}
|
||||
|
||||
let mut storage = renderbug_bike::storage::SharedFlash::new(esp_storage::FlashStorage::new());
|
||||
let mut partition_buf = [8; 1024];
|
||||
let partitions = esp_bootloader_esp_idf::partitions::read_partition_table(&mut storage, &mut partition_buf).unwrap();
|
||||
|
||||
#[cfg(feature="simulation")]
|
||||
{
|
||||
use esp_storage::FlashStorage;
|
||||
use renderbug_embassy::tasks::simulation::{SharedFlash, SimDataTable};
|
||||
let mut storage = SharedFlash::new(FlashStorage::new());
|
||||
let mut buf = [8; 1024];
|
||||
let partitions = esp_bootloader_esp_idf::partitions::read_partition_table(&mut storage, &mut buf).unwrap();
|
||||
use renderbug_bike::tasks::simulation::SimDataTable;
|
||||
for sim_data in SimDataTable::open(storage, partitions).expect("Could not find sim data!") {
|
||||
let srcid = sim_data.srcid();
|
||||
info!("Found simulation data for {srcid:?}");
|
||||
if spawner.spawn(renderbug_embassy::tasks::simulation::simulation_task(sim_data, motion_bus.dyn_sender())).is_err() {
|
||||
if spawner.spawn(renderbug_bike::tasks::simulation::simulation_task(sim_data, motion_bus.dyn_sender())).is_err() {
|
||||
error!("Unable to spawn simulation task for {srcid:?}! Increase the task pool size.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature="simulation"))]
|
||||
{
|
||||
use renderbug_bike::storage::SimDataRecorder;
|
||||
|
||||
let recorder = SimDataRecorder::open(storage, partitions).expect("Unable to open sim data partition for writing");
|
||||
//spawner.spawn(record_telemetry(recording_bus.dyn_receiver(), recorder)).unwrap();
|
||||
}
|
||||
|
||||
spawner.spawn(print_sensor_readings(recording_bus.dyn_subscriber().unwrap())).unwrap();
|
||||
|
||||
#[cfg(feature="radio")]
|
||||
let (wifi, network_device, ble) = {
|
||||
info!("Configuring wifi");
|
||||
|
||||
Reference in New Issue
Block a user