Basic bluetooth functionality
This commit is contained in:
@ -22,6 +22,7 @@ mod dispatch;
|
||||
mod motor_controller;
|
||||
mod motor_driver;
|
||||
mod message_timer;
|
||||
mod ble_server;
|
||||
|
||||
use crate::message_timer::MessageTimer;
|
||||
use crate::commands::Commands;
|
||||
@ -33,7 +34,8 @@ fn main() {
|
||||
// Do basic initialization
|
||||
esp_idf_svc::sys::link_patches();
|
||||
esp_idf_svc::log::EspLogger::initialize_default();
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
log::set_max_level(log::LevelFilter::Trace);
|
||||
//log::set_max_level(log::LevelFilter::Info);
|
||||
|
||||
match future::block_on(main_loop()) {
|
||||
Ok(_) => {error!("Exited main loop normally, but this should be impossible.")}
|
||||
@ -78,6 +80,7 @@ async fn main_loop() -> Result<()> {
|
||||
Commands::StopTimerExpired,
|
||||
STOP_SAFETY_TIME_MS,
|
||||
&mut dp);
|
||||
let mut ble_server = ble_server::BleServer::new(&mut dp);
|
||||
|
||||
let executor = Executor::new();
|
||||
let mut tasks:Vec<_> = Vec::new();
|
||||
@ -93,6 +96,7 @@ async fn main_loop() -> Result<()> {
|
||||
tasks.push(executor.spawn(motor_control.run()));
|
||||
tasks.push(executor.spawn(button_timer.run()));
|
||||
tasks.push(executor.spawn(stopping_timer.run()));
|
||||
tasks.push(executor.spawn(ble_server.run()));
|
||||
tasks.push(executor.spawn(dp.cmd_loop()));
|
||||
|
||||
//Once we have all our tasks, await on them all to run them in parallel.
|
||||
|
||||
Reference in New Issue
Block a user