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 | | `postfilter <0/1> rate <rate>` | Set postfilter output data rate |
| `load` | Restore configuration from EEPROM | | `load` | Restore configuration from EEPROM |
| `save` | Save configuration to EEPROM | | `save` | Save configuration to EEPROM |
| `reset` | Reset the device |

View File

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

View File

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