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 |
|
| `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 |
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue