Compare commits

..

2 Commits

Author SHA1 Message Date
15053f8864 PwmLimits: Save user value into flash
In place of the machine value derived from the pwm duty.
2024-08-12 12:27:21 +08:00
3171fcd224 PwmSummary: max -> user_value 2024-08-12 12:27:15 +08:00
4 changed files with 13 additions and 13 deletions

View File

@ -100,10 +100,10 @@ formatted as line-delimited JSON.
| `report mode` | Show current report mode |
| `report mode <off/on>` | Set report mode |
| `pwm` | Show current PWM settings |
| `pwm <0/1> max_i_pos <amp>` | Set maximum positive output current, clamped at [0, 2] |
| `pwm <0/1> max_i_neg <amp>` | Set maximum negative output current, clamped at [0, 2] |
| `pwm <0/1> max_v <volt>` | Set maximum output voltage, clamped at [0, 4] |
| `pwm <0/1> i_set <amp>` | Disengage PID, set fixed output current, clamped at [-2, 2] |
| `pwm <0/1> max_i_pos <amp>` | Set maximum positive output current |
| `pwm <0/1> max_i_neg <amp>` | Set maximum negative output current |
| `pwm <0/1> max_v <volt>` | Set maximum output voltage |
| `pwm <0/1> i_set <amp>` | Disengage PID, set fixed output current |
| `pwm <0/1> pid` | Let output current to be controlled by the PID |
| `center <0/1> <volt>` | Set the MAX1968 0A-centerpoint to the specified fixed voltage |
| `center <0/1> vref` | Set the MAX1968 0A-centerpoint to measure from VREF |

View File

@ -24,7 +24,7 @@ pub struct Channel<C: ChannelPins> {
pub vref_meas: ElectricPotential,
pub shdn: C::Shdn,
pub vref_pin: C::VRefPin,
pub itec_pin: C::ITecPin,
pub itec_pin: C::ItecPin,
/// feedback from `dac` output
pub dac_feedback_pin: C::DacFeedbackPin,
pub tec_u_meas_pin: C::TecUMeasPin,

View File

@ -521,7 +521,7 @@ impl Channels {
PwmSummary {
channel,
center: CenterPointJson(self.channel_state(channel).center.clone()),
i_set: (self.get_i(channel), self.channel_state(channel).i_set).into(),
i_set: (self.get_i(channel), MAX_TEC_I).into(),
max_v: self.get_max_v(channel).into(),
max_i_pos: self.get_max_i_pos(channel).into(),
max_i_neg: self.get_max_i_neg(channel).into(),
@ -609,12 +609,12 @@ impl Serialize for CenterPointJson {
#[derive(Serialize)]
pub struct PwmSummaryField<T: Serialize> {
value: T,
set_value: T,
user_value: T,
}
impl<T: Serialize> From<(T, T)> for PwmSummaryField<T> {
fn from((value, set_value): (T, T)) -> Self {
PwmSummaryField { value, set_value }
fn from((value, user_value): (T, T)) -> Self {
PwmSummaryField { value, user_value }
}
}

View File

@ -61,7 +61,7 @@ pub trait ChannelPins {
type DacSync: OutputPin;
type Shdn: OutputPin;
type VRefPin;
type ITecPin;
type ItecPin;
type DacFeedbackPin;
type TecUMeasPin;
}
@ -76,7 +76,7 @@ impl ChannelPins for Channel0 {
type DacSync = PE4<Output<PushPull>>;
type Shdn = PE10<Output<PushPull>>;
type VRefPin = Channel0VRef;
type ITecPin = PA6<Analog>;
type ItecPin = PA6<Analog>;
type DacFeedbackPin = PA4<Analog>;
type TecUMeasPin = PC2<Analog>;
}
@ -91,7 +91,7 @@ impl ChannelPins for Channel1 {
type DacSync = PF6<Output<PushPull>>;
type Shdn = PE15<Output<PushPull>>;
type VRefPin = Channel1VRef;
type ITecPin = PB0<Analog>;
type ItecPin = PB0<Analog>;
type DacFeedbackPin = PA5<Analog>;
type TecUMeasPin = PC3<Analog>;
}
@ -108,7 +108,7 @@ pub struct ChannelPinSet<C: ChannelPins> {
pub dac_sync: C::DacSync,
pub shdn: C::Shdn,
pub vref_pin: C::VRefPin,
pub itec_pin: C::ITecPin,
pub itec_pin: C::ItecPin,
pub dac_feedback_pin: C::DacFeedbackPin,
pub tec_u_meas_pin: C::TecUMeasPin,
}