Skip to content
This repository was archived by the owner on Dec 3, 2020. It is now read-only.

Commit 39fdc4c

Browse files
committed
add reboot to dfu command
1 parent 1385a0e commit 39fdc4c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ config Get all configs
5454
5555
reboot Reboot the device
5656
57+
dfu Reboot into dfu mode
58+
5759
OPTIONS:
5860
--flavor <flavor> [possible values: inav, baseflight, betafligth]
5961
-p, --port <port> device serial port

src/main.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ async fn main() {
225225
App::new("reboot")
226226
.about("Reboot the device")
227227
)
228+
.subcommand(
229+
App::new("dfu")
230+
.about("Reboot into dfu mode")
231+
)
228232
.arg(
229233
Arg::with_name("port")
230234
.short('p')
@@ -307,7 +311,20 @@ async fn main() {
307311
.clone()
308312
};
309313

310-
// TODO: what stop and start bits are inav using, is every one just using the canonical defalts?
314+
match matches.subcommand() {
315+
("dfu", _) => {
316+
let msg = "R\n";
317+
let mut s = open_with_settings(&port, &s)
318+
.expect("Failed to open serial port");
319+
320+
s.write_all(msg.as_bytes())
321+
.expect("Unable to write bytes.");
322+
return;
323+
},
324+
_ => ()
325+
}
326+
327+
311328
let serialport = open_with_settings(&port, &s)
312329
.expect("Failed to open serial port");
313330

0 commit comments

Comments
 (0)