This commit is contained in:
Astro 2019-09-19 02:18:37 +02:00
parent e126bc0fe1
commit 87de8b7859
2 changed files with 10 additions and 13 deletions

View File

@ -154,8 +154,7 @@ fn report(input: &[u8]) -> IResult<&[u8], Command> {
preceded( preceded(
whitespace, whitespace,
// `report mode <on | off>` - Switch repoting mode // `report mode <on | off>` - Switch repoting mode
map(off_on, map(off_on, Command::Reporting)
|reporting| Command::Reporting(reporting))
), ),
// `report mode` - Show current reporting state // `report mode` - Show current reporting state
value(Command::Show(ShowCommand::Reporting), end) value(Command::Show(ShowCommand::Reporting), end)
@ -235,16 +234,14 @@ fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
/// `pid` | pid_parameter /// `pid` | pid_parameter
fn pid(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> { fn pid(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
preceded( let (input, _) = tag("pid")(input)?;
tag("pid"), alt((
alt(( preceded(
preceded( whitespace,
whitespace, pid_parameter
pid_parameter ),
), value(Ok(Command::Show(ShowCommand::Pid)), end)
value(Ok(Command::Show(ShowCommand::Pid)), end) ))(input)
))
)(input)
} }
fn command(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> { fn command(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {

View File

@ -138,7 +138,7 @@ fn main() -> ! {
writeln!(stdout, "ADC id: {:04X}", id).unwrap(); writeln!(stdout, "ADC id: {:04X}", id).unwrap();
break; break;
} }
Ok(id) => { Ok(_id) => {
// This always happens on the first attempt. So retry silently // This always happens on the first attempt. So retry silently
} }
}; };