More consistent error handling in loops

This commit is contained in:
2024-08-24 10:56:05 -04:00
parent 70947d5fa7
commit ee334db157
7 changed files with 23 additions and 40 deletions

View File

@ -31,6 +31,7 @@ fn main() {
esp_idf_svc::sys::link_patches();
esp_idf_svc::log::EspLogger::initialize_default();
log::set_max_level(log::LevelFilter::Trace);
//TODO DEBUG: remove trace logging
//log::set_max_level(log::LevelFilter::Info);
// Set panic to use error! instead of write! (as we will potentially log errors)
@ -61,7 +62,7 @@ async fn main_loop() -> Result<()> {
// Create dispatch early so it can outlive most other things
let mut dp = dispatch::Dispatch::new();
// Debug Drivers (TODO: remove debug)
// Debug Drivers (TODO DEBUG: remove debug)
let motor_driver = motor_driver::MotorDriverDebug::new(dp.get_cmd_channel());
// Setup of various drivers that need to out-live the executor
@ -85,12 +86,9 @@ async fn main_loop() -> Result<()> {
let executor = Executor::new();
let mut tasks:Vec<_> = Vec::new();
//Queue Up debug tasks (TODO: remove debug)
//Queue Up debug tasks (TODO DEBUG: remove debug)
let cli_endpoint = dp.get_cmd_channel();
tasks.push(executor.spawn(test_console::start_cli(cli_endpoint)));
//tasks.push(executor.spawn(test_loop()));
//let t_chan = test_driver_tattle::prepare_tattle(&mut dp).expect("Failed to set up debugging copycat driver");
//tasks.push(executor.spawn(test_driver_tattle::start_tattle(t_chan)));
// Queueu up our async tasks
tasks.push(executor.spawn(motor_control.run()));