forked from M-Labs/ionpak-thermostat
command_parser: fix pid
This commit is contained in:
parent
f64e4fe2f3
commit
6d4676a72a
@ -193,6 +193,7 @@ fn pwm(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
|||||||
))(input)
|
))(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `pid <parameter> <value>`
|
||||||
fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
||||||
let (input, parameter) =
|
let (input, parameter) =
|
||||||
alt((value(PidParameter::Target, tag("target")),
|
alt((value(PidParameter::Target, tag("target")),
|
||||||
@ -212,18 +213,18 @@ fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
|||||||
Ok((input, result))
|
Ok((input, result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `pid <parameter> <value>`
|
/// `pid` | pid_parameter
|
||||||
fn pid(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
fn pid(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
||||||
let (input, _) = tag("pid")(input)?;
|
preceded(
|
||||||
let (input, _) = whitespace(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>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user