From 12c2be0a038fe14b809e65709a8c7db379efabdb Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 2 Oct 2019 21:25:06 +0200 Subject: [PATCH] command_parser: shorten to parallel_r, add tests --- firmware/README.md | 46 +++++++++++++++++----------------- firmware/src/command_parser.rs | 18 ++++++++++++- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/firmware/README.md b/firmware/README.md index 73b0f1a..f5c64d1 100644 --- a/firmware/README.md +++ b/firmware/README.md @@ -50,26 +50,26 @@ The scope of this setting is per TCP session. ### Commands -| Syntax | Function | -| --- | --- | -| `report` | Show current input | -| `report mode` | Show current report mode | -| `report mode ` | Set report mode | -| `pwm <0/1> max_i_pos ` | Set PWM duty cycle for **max_i_pos** to *width / total* | -| `pwm <0/1> max_i_neg ` | Set PWM duty cycle for **max_i_neg** to *width / total* | -| `pwm <0/1> max_v ` | Set PWM duty cycle for **max_v** to *width / total* | -| `pwm <0/1> ` | Set PWM duty cycle for **i_set** to manual *width / total* | -| `pwm <0/1> pid` | Set PWM to be controlled by PID | -| `pid` | Show PID configuration | -| `pid <0/1> target ` | Set the PID controller target | -| `pid <0/1> kp ` | Set proportional gain | -| `pid <0/1> ki ` | Set integral gain | -| `pid <0/1> kd ` | Set differential gain | -| `pid <0/1> output_min ` | Set mininum output | -| `pid <0/1> output_max ` | Set maximum output | -| `pid <0/1> integral_min ` | Set integral lower bound | -| `pid <0/1> integral_max ` | Set integral upper bound | -| `s-h` | Show Steinhart-Hart equation parameters | -| `s-h <0/1> ` | Set Steinhart-Hart parameter for a channel | -| `s-h <0/1> ` | Set parallel resistance of the ADC | -| `postfilter <0/1> rate ` | Set postfilter output data rate | +| Syntax | Function | +| --- | --- | +| `report` | Show current input | +| `report mode` | Show current report mode | +| `report mode ` | Set report mode | +| `pwm <0/1> max_i_pos ` | Set PWM duty cycle for **max_i_pos** to *width / total* | +| `pwm <0/1> max_i_neg ` | Set PWM duty cycle for **max_i_neg** to *width / total* | +| `pwm <0/1> max_v ` | Set PWM duty cycle for **max_v** to *width / total* | +| `pwm <0/1> ` | Set PWM duty cycle for **i_set** to manual *width / total* | +| `pwm <0/1> pid` | Set PWM to be controlled by PID | +| `pid` | Show PID configuration | +| `pid <0/1> target ` | Set the PID controller target | +| `pid <0/1> kp ` | Set proportional gain | +| `pid <0/1> ki ` | Set integral gain | +| `pid <0/1> kd ` | Set differential gain | +| `pid <0/1> output_min ` | Set mininum output | +| `pid <0/1> output_max ` | Set maximum output | +| `pid <0/1> integral_min ` | Set integral lower bound | +| `pid <0/1> integral_max ` | Set integral upper bound | +| `s-h` | Show Steinhart-Hart equation parameters | +| `s-h <0/1> ` | Set Steinhart-Hart parameter for a channel | +| `s-h <0/1> parallel_r ` | Set parallel resistance of the ADC | +| `postfilter <0/1> rate ` | Set postfilter output data rate | diff --git a/firmware/src/command_parser.rs b/firmware/src/command_parser.rs index 0aab5b8..ea901b7 100644 --- a/firmware/src/command_parser.rs +++ b/firmware/src/command_parser.rs @@ -323,7 +323,7 @@ fn steinhart_hart_parameter(input: &[u8]) -> IResult<&[u8], Result