Skip to content

Commit c157c35

Browse files
authored
Adding flip polarity to the "Calibrate All" (#1615)
Adding flip polarity to the "Calibrate All" feature to make it easier to configure a mixed set of switches
1 parent 4bff9cc commit c157c35

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

www/src/Components/HECalibration.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,30 @@ const HECalibration = ({
351351
max={Math.max(voltageIdle, voltagePressed)}
352352
/>
353353
</Col>
354+
<Col xs={12} className="mb-3">
355+
<FormCheck
356+
label={t('HETrigger:calibration-flip-polarity')}
357+
type="switch"
358+
name="is_polarized"
359+
id="HETriggerPolarize"
360+
isInvalid={false}
361+
checked={polarity}
362+
onChange={(e) => {
363+
setPolarity(e.target.checked);
364+
if (e.target.checked) {
365+
setVoltageIdle(Math.max(voltageIdle, voltagePressed));
366+
setVoltagePressed(Math.min(voltageIdle, voltagePressed));
367+
setVoltageActive(Math.max(release, voltageActive));
368+
setRelease(Math.min(release, voltageActive));
369+
} else {
370+
setVoltageIdle(Math.min(voltageIdle, voltagePressed));
371+
setVoltagePressed(Math.max(voltageIdle, voltagePressed));
372+
setVoltageActive(Math.min(release, voltageActive));
373+
setRelease(Math.max(release, voltageActive));
374+
}
375+
}}
376+
/>
377+
</Col>
354378
<Col xs={12} className="mb-3">
355379
{t(`HETrigger:activation-reading-text`)}
356380
</Col>

0 commit comments

Comments
 (0)