Triggering the dfu bootloader works
This commit is contained in:
parent
8cf75ac70d
commit
1c4714381b
9 changed files with 235 additions and 33 deletions
|
|
@ -11,8 +11,11 @@ humantime = "2.1.0"
|
|||
log = "0.4.21"
|
||||
nom = "7.1.3"
|
||||
serde_json = "1.0.118"
|
||||
serialport = "4.5.1"
|
||||
tokio = {version = "1.37.0", features = ["full"]}
|
||||
tokio-macros = { version = "0.2.0-alpha.6" }
|
||||
tower-http = { version = "0.5.2", features = ["fs", "trace"] }
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = "0.3.18"
|
||||
radomctl-protocol = { path = "../protocol" }
|
||||
postcard = {version = "1.0.10", features = ["use-std"]}
|
||||
|
|
|
|||
16
daemon/src/bin/trigger-dfu.rs
Normal file
16
daemon/src/bin/trigger-dfu.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use postcard::{from_bytes_cobs, to_stdvec_cobs};
|
||||
use radomctl_protocol::*;
|
||||
use radomctld::logger::setup_logger;
|
||||
|
||||
pub fn main() -> () {
|
||||
let mut port = serialport::new("/dev/ttyACM0", 115_200)
|
||||
.timeout(Duration::from_millis(10))
|
||||
.open()
|
||||
.expect("Failed to open port");
|
||||
|
||||
let host_msg = HostMessage::TriggerDFUBootloader;
|
||||
let msg_bytes = to_stdvec_cobs(&host_msg).unwrap();
|
||||
port.write_all(&msg_bytes).unwrap();
|
||||
}
|
||||
3
daemon/src/lib.rs
Normal file
3
daemon/src/lib.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
pub mod logger;
|
||||
pub mod rotctlprotocol;
|
||||
pub mod rotor;
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
mod logger;
|
||||
mod rotctlprotocol;
|
||||
mod rotor;
|
||||
|
||||
use anyhow::Result;
|
||||
use fern::colors::{Color, ColoredLevelConfig};
|
||||
use log::{debug, error, info, warn, Level};
|
||||
|
|
@ -26,10 +22,11 @@ use tower_http::{
|
|||
trace::TraceLayer,
|
||||
};
|
||||
|
||||
use logger::setup_logger;
|
||||
use rotor::control_rotor;
|
||||
|
||||
use rotctlprotocol::{parse_command, Command};
|
||||
use radomctld::{
|
||||
logger::setup_logger,
|
||||
rotctlprotocol::{parse_command, Command},
|
||||
rotor::control_rotor,
|
||||
};
|
||||
|
||||
async fn process_socket(
|
||||
socket: TcpStream,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue