Compare commits

..

No commits in common. "23d0c470e56c87af2fdf083d0ce058327b0922ac" and "ffcc3f661b10509603f4cf519422a42e827dca39" have entirely different histories.

4 changed files with 18 additions and 43 deletions

View File

@ -72,20 +72,20 @@ The scope of this setting is per TCP session.
| `report mode` | Show current report mode | | `report mode` | Show current report mode |
| `report mode <off/on>` | Set report mode | | `report mode <off/on>` | Set report mode |
| `pwm` | Show current PWM settings | | `pwm` | Show current PWM settings |
| `pwm <0/1> max_i_pos <amp>` | Set PWM duty cycle for **max_i_pos** to *ampere* | | `pwm <0/1> max_i_pos <ratio>` | Set PWM duty cycle for **max_i_pos** to *ampere* |
| `pwm <0/1> max_i_neg <amp>` | Set PWM duty cycle for **max_i_neg** to *ampere* | | `pwm <0/1> max_i_neg <ratio>` | Set PWM duty cycle for **max_i_neg** to *ampere* |
| `pwm <0/1> max_v <volts>` | Set PWM duty cycle for **max_v** to *volt* | | `pwm <0/1> max_v <ratio>` | Set PWM duty cycle for **max_v** to *volt* |
| `pwm <0/1> i_set <amp>` | Disengage PID, set **i_set** DAC to *ampere* | | `pwm <0/1> <volts>` | Disengage PID, set **i_set** DAC to *ampere* |
| `pwm <0/1> pid` | Set PWM to be controlled by PID | | `pwm <0/1> pid` | Set PWM to be controlled by PID |
| `center <0/1> <volts>` | Set the MAX1968 0A-centerpoint to *volts* | | `center <0/1> <volts>` | Set the MAX1968 0A-centerpoint to *volts* |
| `center <0/1> vref` | Set the MAX1968 0A-centerpoint to measure from VREF | | `center <0/1> vref` | Set the MAX1968 0A-centerpoint to measure from VREF |
| `pid` | Show PID configuration | | `pid` | Show PID configuration |
| `pid <0/1> target <deg_celsius>` | Set the PID controller target temperature | | `pid <0/1> target <value>` | Set the PID controller target |
| `pid <0/1> kp <value>` | Set proportional gain | | `pid <0/1> kp <value>` | Set proportional gain |
| `pid <0/1> ki <value>` | Set integral gain (unit: 10 Hz) | | `pid <0/1> ki <value>` | Set integral gain (unit: 10 Hz) |
| `pid <0/1> kd <value>` | Set differential gain (unit: 0.1 seconds) | | `pid <0/1> kd <value>` | Set differential gain (unit: 0.1 seconds) |
| `pid <0/1> output_min <amp>` | Set mininum output | | `pid <0/1> output_min <value>` | Set mininum output |
| `pid <0/1> output_max <amp>` | Set maximum output | | `pid <0/1> output_max <value>` | Set maximum output |
| `pid <0/1> integral_min <value>` | Set integral lower bound | | `pid <0/1> integral_min <value>` | Set integral lower bound |
| `pid <0/1> integral_max <value>` | Set integral upper bound | | `pid <0/1> integral_max <value>` | Set integral upper bound |
| `s-h` | Show Steinhart-Hart equation parameters | | `s-h` | Show Steinhart-Hart equation parameters |
@ -146,12 +146,12 @@ output limits.
Use the `pwm` command to see current settings and maximum values. Use the `pwm` command to see current settings and maximum values.
| Limit | Unit | Description | | Limit | Unit | Description |
| --- | :---: | --- | | --- | :---: | --- |
| `max_v` | Volts | Maximum voltage | | `max_v` | Volts | Maximum voltage |
| `max_i_pos` | Amperes | Maximum positive current | | `max_i_pos` | Amperes | Maximum positive current |
| `max_i_neg` | Amperes | Maximum negative current | | `max_i_neg` | Amperes | Maximum negative current |
| `i_set` | Amperes | (Not a limit; Open-loop mode) | | | Amperes | Output current control (Open-loop mode) |
Example: set the maximum voltage of channel 0 to 1.5 V. Example: set the maximum voltage of channel 0 to 1.5 V.
``` ```
@ -166,7 +166,7 @@ channel.
Example: set output current of channel 0 to 0 A. Example: set output current of channel 0 to 0 A.
``` ```
pwm 0 i_set 0 pwm 0 0
``` ```
## PID-stabilized temperature control ## PID-stabilized temperature control

View File

@ -1,17 +0,0 @@
{ mozillaOverlay ? builtins.fetchTarball "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz"
}:
let
pkgs = import <nixpkgs> {
overlays = [ (import mozillaOverlay) ];
};
rust = pkgs.rustChannelOfTargets "nightly" null [ "thumbv7em-none-eabihf" ];
in
pkgs.mkShell {
name = "thermostat-env";
buildInputs = with pkgs; [
rust gcc
openocd
] ++ (with python3Packages; [
numpy matplotlib
]);
}

View File

@ -249,16 +249,6 @@ fn pwm_setup(input: &[u8]) -> IResult<&[u8], Result<(PwmPin, f64), Error>> {
result.map(|value| (pin, value)); result.map(|value| (pin, value));
alt(( alt((
map(
preceded(
tag("i_set"),
preceded(
whitespace,
float
)
),
result_with_pin(PwmPin::ISet)
),
map( map(
preceded( preceded(
tag("max_i_pos"), tag("max_i_pos"),
@ -288,6 +278,8 @@ fn pwm_setup(input: &[u8]) -> IResult<&[u8], Result<(PwmPin, f64), Error>> {
) )
), ),
result_with_pin(PwmPin::MaxV) result_with_pin(PwmPin::MaxV)
),
map(float, result_with_pin(PwmPin::ISet)
)) ))
)(input) )(input)
} }
@ -536,8 +528,8 @@ mod test {
} }
#[test] #[test]
fn parse_pwm_i_set() { fn parse_pwm_manual() {
let command = Command::parse(b"pwm 1 i_set 16383"); let command = Command::parse(b"pwm 1 16383");
assert_eq!(command, Ok(Command::Pwm { assert_eq!(command, Ok(Command::Pwm {
channel: 1, channel: 1,
pin: PwmPin::ISet, pin: PwmPin::ISet,