summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device-functions.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/device-functions.c b/device-functions.c
index 9275df7..f616d41 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -380,11 +380,14 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
set_shiftreg_bits(SR_3, POS_7, FIVE_BITS, 1<<relay_range);
}
- int pol_bit = globals.Flash.polarity_xtra_rly[channel] + XTR_POS;
- if (new_ampl<0.0) {
- set_shiftreg_bits(SR_2, pol_bit, ONE_BIT, BIT_LOW); /* set O.POL line low to switch pol relay to - */
- } else {
- set_shiftreg_bits(SR_2, pol_bit, ONE_BIT, BIT_HIGH); /* set O.POL line high to switch pol relay to + */
+ // only do this on dual-polarity dual-channel units
+ if ((globals.Flash.min_ampl[channel] * globals.Flash.max_ampl[channel]) < 0.0) {
+ int pol_bit = globals.Flash.polarity_xtra_rly[channel] + XTR_POS;
+ if (new_ampl<0.0) {
+ set_shiftreg_bits(SR_2, pol_bit, ONE_BIT, BIT_LOW); /* set O.POL line low to switch pol relay to - */
+ } else {
+ set_shiftreg_bits(SR_2, pol_bit, ONE_BIT, BIT_HIGH); /* set O.POL line high to switch pol relay to + */
+ }
}
}