events: move the displaycontrols out of the bus garage and back into main
This commit is contained in:
@@ -19,7 +19,7 @@ use esp_hal::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use log::*;
|
use log::*;
|
||||||
use renderbug_embassy::{logging::RenderbugLogger, tasks::{oled::{OledUI, OledUiSurfacePool, oled_ui}, safetyui::{SafetyUi, safety_ui_main}, ui::UiSurfacePool}};
|
use renderbug_embassy::{graphics::display::DisplayControls, logging::RenderbugLogger, tasks::{oled::{OledUI, OledUiSurfacePool, oled_ui}, safetyui::{SafetyUi, safety_ui_main}, ui::UiSurfacePool}};
|
||||||
use renderbug_embassy::events::BusGarage;
|
use renderbug_embassy::events::BusGarage;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
@@ -74,12 +74,15 @@ async fn main(spawner: Spawner) {
|
|||||||
let mut surfaces = UiSurfacePool::default();
|
let mut surfaces = UiSurfacePool::default();
|
||||||
let ui = Ui::new(&mut surfaces);
|
let ui = Ui::new(&mut surfaces);
|
||||||
|
|
||||||
|
let display_controls = DisplayControls::default();
|
||||||
|
let oled_controls = DisplayControls::default();
|
||||||
|
|
||||||
let mut oled_surfaces = OledUiSurfacePool::default();
|
let mut oled_surfaces = OledUiSurfacePool::default();
|
||||||
let oled_uniforms = Default::default();
|
let oled_uniforms = Default::default();
|
||||||
let oledui = OledUI::new(&mut oled_surfaces, garage.oled_display.clone(), Arc::clone(&oled_uniforms));
|
let oledui = OledUI::new(&mut oled_surfaces, oled_controls.clone(), Arc::clone(&oled_uniforms));
|
||||||
|
|
||||||
let mut safety_surfaces = UiSurfacePool::default();
|
let mut safety_surfaces = UiSurfacePool::default();
|
||||||
let safety_ui = SafetyUi::new(&mut safety_surfaces, garage.display.clone());
|
let safety_ui = SafetyUi::new(&mut safety_surfaces, display_controls.clone());
|
||||||
|
|
||||||
let mut wdt = timer0.wdt;
|
let mut wdt = timer0.wdt;
|
||||||
wdt.set_timeout(esp_hal::timer::timg::MwdtStage::Stage0, esp_hal::time::Duration::from_secs(5));
|
wdt.set_timeout(esp_hal::timer::timg::MwdtStage::Stage0, esp_hal::time::Duration::from_secs(5));
|
||||||
@@ -88,7 +91,7 @@ async fn main(spawner: Spawner) {
|
|||||||
let hi_spawn = hi_exec.start(esp_hal::interrupt::Priority::max());
|
let hi_spawn = hi_exec.start(esp_hal::interrupt::Priority::max());
|
||||||
|
|
||||||
//wdt.enable();
|
//wdt.enable();
|
||||||
hi_spawn.must_spawn(renderbug_embassy::tasks::render::render(peripherals.RMT, peripherals.GPIO5.degrade(), surfaces, safety_surfaces, garage.display.clone(), wdt));
|
hi_spawn.must_spawn(renderbug_embassy::tasks::render::render(peripherals.RMT, peripherals.GPIO5.degrade(), surfaces, safety_surfaces, display_controls, wdt));
|
||||||
|
|
||||||
#[cfg(feature="motion")]
|
#[cfg(feature="motion")]
|
||||||
{
|
{
|
||||||
@@ -119,7 +122,7 @@ async fn main(spawner: Spawner) {
|
|||||||
peripherals.I2C0,
|
peripherals.I2C0,
|
||||||
Config::default().with_frequency(Rate::from_khz(400))
|
Config::default().with_frequency(Rate::from_khz(400))
|
||||||
).unwrap().with_scl(peripherals.GPIO18).with_sda(peripherals.GPIO17).into_async();
|
).unwrap().with_scl(peripherals.GPIO18).with_sda(peripherals.GPIO17).into_async();
|
||||||
let output = SsdOutput::new(i2c, rst, garage.oled_display.clone()).await;
|
let output = SsdOutput::new(i2c, rst, oled_controls).await;
|
||||||
spawner.must_spawn(renderbug_embassy::tasks::oled_render::oled_render(output, oled_surfaces, oled_uniforms));
|
spawner.must_spawn(renderbug_embassy::tasks::oled_render::oled_render(output, oled_surfaces, oled_uniforms));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +135,7 @@ async fn main(spawner: Spawner) {
|
|||||||
let partitions = esp_bootloader_esp_idf::partitions::read_partition_table(&mut storage, &mut buf).unwrap();
|
let partitions = esp_bootloader_esp_idf::partitions::read_partition_table(&mut storage, &mut buf).unwrap();
|
||||||
for sim_data in SimDataTable::open(storage, partitions).expect("Could not find partition for sim data!") {
|
for sim_data in SimDataTable::open(storage, partitions).expect("Could not find partition for sim data!") {
|
||||||
info!("Found simulation data for {:?}", sim_data.srcid());
|
info!("Found simulation data for {:?}", sim_data.srcid());
|
||||||
if spawner.spawn(renderbug_embassy::tasks::simulation::simulation_task(sim_data, measurements.dyn_sender())).is_err() {
|
if spawner.spawn(renderbug_embassy::tasks::simulation::simulation_task(sim_data, garage.motion.dyn_sender())).is_err() {
|
||||||
error!("Unable to spawn simulation task! Increase the task pool size.");
|
error!("Unable to spawn simulation task! Increase the task pool size.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,9 +117,7 @@ pub struct BusGarage {
|
|||||||
pub motion: Channel<NoopRawMutex, Measurement, 5>,
|
pub motion: Channel<NoopRawMutex, Measurement, 5>,
|
||||||
pub notify: PubSubChannel<CriticalSectionRawMutex, Notification, 5, 2, 4>,
|
pub notify: PubSubChannel<CriticalSectionRawMutex, Notification, 5, 2, 4>,
|
||||||
pub predict: Channel<CriticalSectionRawMutex, Prediction, 15>,
|
pub predict: Channel<CriticalSectionRawMutex, Prediction, 15>,
|
||||||
pub telemetry: PubSubChannel<CriticalSectionRawMutex, Telemetry, 15, 2, 4>,
|
pub telemetry: PubSubChannel<CriticalSectionRawMutex, Telemetry, 15, 2, 4>
|
||||||
pub display: DisplayControls,
|
|
||||||
pub oled_display: DisplayControls
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BusGarage {
|
impl Default for BusGarage {
|
||||||
@@ -128,9 +126,7 @@ impl Default for BusGarage {
|
|||||||
motion: Channel::new(),
|
motion: Channel::new(),
|
||||||
notify: PubSubChannel::new(),
|
notify: PubSubChannel::new(),
|
||||||
predict: Channel::new(),
|
predict: Channel::new(),
|
||||||
telemetry: PubSubChannel::new(),
|
telemetry: PubSubChannel::new()
|
||||||
display: Default::default(),
|
|
||||||
oled_display: Default::default()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user