reboot device (with panic!)

closes #4
closes #12
This commit is contained in:
Vladan Popovic 2023-03-05 03:54:32 +01:00
parent 059263d7ea
commit dc1615d21f

View file

@ -36,8 +36,6 @@ fn main() -> anyhow::Result<()> {
//let accel_sender = gps_sender.clone(); //let accel_sender = gps_sender.clone();
//let _ = gps::main(gps_tx, gps_rx, gps_uart, gps_sender)?; //let _ = gps::main(gps_tx, gps_rx, gps_uart, gps_sender)?;
threads.push(thread::spawn(move || gps::main(gps_tx, gps_rx, gps_uart, gps_sender.clone())));
thread::sleep(Duration::from_millis(1000));
//threads.push(thread::spawn(move || accel::main(accel_sender))); //threads.push(thread::spawn(move || accel::main(accel_sender)));
// ================================== // ==================================
@ -77,7 +75,8 @@ fn main() -> anyhow::Result<()> {
let mqtt_username = include_str!("../secret/username").trim(); let mqtt_username = include_str!("../secret/username").trim();
let mqtt_password = include_str!("../secret/password").trim(); let mqtt_password = include_str!("../secret/password").trim();
loop { threads.push(thread::spawn(move || gps::main(gps_tx, gps_rx, gps_uart, gps_sender.clone())));
println!("======================= MAIN ======================="); println!("======================= MAIN =======================");
mdm.init().unwrap_or(()); mdm.init().unwrap_or(());
let _ = mdm.echo(false).unwrap_or(()); let _ = mdm.echo(false).unwrap_or(());
@ -86,5 +85,5 @@ fn main() -> anyhow::Result<()> {
let _ = mdm.mqtt_send_position_loop("51.158.66.64", 7887, mqtt_username, mqtt_password).unwrap_or(()); let _ = mdm.mqtt_send_position_loop("51.158.66.64", 7887, mqtt_username, mqtt_password).unwrap_or(());
let _ = mdm.tcp_close_connection().unwrap_or(()); let _ = mdm.tcp_close_connection().unwrap_or(());
thread::sleep(Duration::from_millis(1500)); thread::sleep(Duration::from_millis(1500));
} panic!("rebooting");
} }