From 6d4676a72a9431ff516c2a2e97983bf0485fe4c7 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 19 Sep 2019 00:59:16 +0200 Subject: [PATCH] command_parser: fix pid --- firmware/src/command_parser.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/firmware/src/command_parser.rs b/firmware/src/command_parser.rs index 49c00c4..c5e202b 100644 --- a/firmware/src/command_parser.rs +++ b/firmware/src/command_parser.rs @@ -193,6 +193,7 @@ fn pwm(input: &[u8]) -> IResult<&[u8], Result> { ))(input) } +/// `pid ` fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result> { let (input, parameter) = alt((value(PidParameter::Target, tag("target")), @@ -212,18 +213,18 @@ fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result> { Ok((input, result)) } -/// `pid ` +/// `pid` | pid_parameter fn pid(input: &[u8]) -> IResult<&[u8], Result> { - let (input, _) = tag("pid")(input)?; - let (input, _) = whitespace(input)?; - - alt(( - preceded( - whitespace, - pid_parameter - ), - value(Ok(Command::Show(ShowCommand::Pid)), end) - ))(input) + preceded( + tag("pid"), + alt(( + preceded( + whitespace, + pid_parameter + ), + value(Ok(Command::Show(ShowCommand::Pid)), end) + )) + )(input) } fn command(input: &[u8]) -> IResult<&[u8], Result> {