forked from M-Labs/thermostat
implement reset command
This commit is contained in:
parent
a2caac0fe5
commit
83589610b5
@ -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 |
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user