tasks: simulation: restructure sim data storage to better support the next step of resampling data to fit the configured partition

This commit is contained in:
2025-12-21 18:41:35 +01:00
parent 83ecdb61b2
commit ea851f4b5a
5 changed files with 222 additions and 90 deletions

View File

@@ -130,15 +130,9 @@ async fn main(spawner: Spawner) {
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();
let data_partition = partitions.find_partition(
esp_bootloader_esp_idf::partitions::PartitionType::Data(
esp_bootloader_esp_idf::partitions::DataPartitionSubType::Undefined
)).expect("Unable to read partition table").expect("Could not find data partition!");
let data_offset = data_partition.offset() as usize;
info!("Loading simulation data starting at {data_offset:#02x}");
for sim_data in SimDataTable::open(storage.clone(), data_offset) {
for sim_data in SimDataTable::open(storage, partitions).expect("Could not find partition for sim data!") {
info!("Found simulation data for {:?}", sim_data.srcid());
if spawner.spawn(renderbug_embassy::tasks::simulation::simulation_task(sim_data, garage.motion.dyn_sender())).is_err() {
if spawner.spawn(renderbug_embassy::tasks::simulation::simulation_task(sim_data, measurements.dyn_sender())).is_err() {
error!("Unable to spawn simulation task! Increase the task pool size.");
}
}