implement reset command

This commit is contained in:
Astro 2020-09-25 00:14:29 +02:00
parent a2caac0fe5
commit 83589610b5
3 changed files with 7 additions and 1 deletions

View File

@ -73,3 +73,4 @@ The scope of this setting is per TCP session.
| `postfilter <0/1> rate <rate>` | Set postfilter output data rate |
| `load` | Restore configuration from EEPROM |
| `save` | Save configuration to EEPROM |
| `reset` | Reset the device |

View File

@ -134,6 +134,7 @@ pub enum Command {
Quit,
Load,
Save,
Reset,
Show(ShowCommand),
Reporting(bool),
/// PWM parameter setting
@ -410,6 +411,7 @@ fn command(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
alt((value(Ok(Command::Quit), tag("quit")),
value(Ok(Command::Load), tag("load")),
value(Ok(Command::Save), tag("save")),
value(Ok(Command::Reset), tag("reset")),
map(report, Ok),
pwm,
center_point,

View File

@ -19,7 +19,7 @@ use stm32f4xx_hal::{
rcc::RccExt,
watchdog::IndependentWatchdog,
time::{U32Ext, MegaHertz},
stm32::{CorePeripherals, Peripherals},
stm32::{CorePeripherals, Peripherals, SCB},
};
use smoltcp::{
time::Instant,
@ -458,6 +458,9 @@ fn main() -> ! {
}
}
}
Command::Reset => {
SCB::sys_reset();
}
}
Ok(SessionOutput::Error(e)) => {
let _ = writeln!(socket, "Command error: {:?}", e);