command_parser: shorten to parallel_r, add tests
This commit is contained in:
parent
8611cc1c79
commit
12c2be0a03
@ -71,5 +71,5 @@ The scope of this setting is per TCP session.
|
||||
| `pid <0/1> integral_max <value>` | Set integral upper bound |
|
||||
| `s-h` | Show Steinhart-Hart equation parameters |
|
||||
| `s-h <0/1> <a/b/c> <value>` | Set Steinhart-Hart parameter for a channel |
|
||||
| `s-h <0/1> <parallel_resistance> <value>` | Set parallel resistance of the ADC |
|
||||
| `s-h <0/1> parallel_r <value>` | Set parallel resistance of the ADC |
|
||||
| `postfilter <0/1> rate <rate>` | Set postfilter output data rate |
|
||||
|
@ -323,7 +323,7 @@ fn steinhart_hart_parameter(input: &[u8]) -> IResult<&[u8], Result<Command, Erro
|
||||
alt((value(ShParameter::A, tag("a")),
|
||||
value(ShParameter::B, tag("b")),
|
||||
value(ShParameter::C, tag("c")),
|
||||
value(ShParameter::ParallelR, tag("parallel_resistance"))
|
||||
value(ShParameter::ParallelR, tag("parallel_r"))
|
||||
))(input)?;
|
||||
let (input, _) = whitespace(input)?;
|
||||
let (input, value) = float(input)?;
|
||||
@ -506,6 +506,22 @@ mod test {
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_steinhart_hart() {
|
||||
let command = Command::parse(b"s-h");
|
||||
assert_eq!(command, Ok(Command::Show(ShowCommand::SteinhartHart)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_steinhart_hart_parallel_r() {
|
||||
let command = Command::parse(b"s-h 1 parallel_r 23.05");
|
||||
assert_eq!(command, Ok(Command::SteinhartHart {
|
||||
channel: 1,
|
||||
parameter: ShParameter::ParallelR,
|
||||
value: 23.05,
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_postfilter_rate() {
|
||||
let command = Command::parse(b"postfilter 0 rate 21");
|
||||
|
Loading…
Reference in New Issue
Block a user