summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2016-04-29 13:58:35 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2016-04-29 13:58:35 -0400
commit1e66428546ef8d7751d47fd9b3231bc328ae5869 (patch)
tree5a89b266b9561b0dcc2d61f1b141325e1b2fc197
parent4689ce99104085dd4fea756cd5219275ec0f97f1 (diff)
implement CH2 attenuator ranges
-rw-r--r--device-functions.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/device-functions.c b/device-functions.c
index c466ae4..44b2ff2 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -319,7 +319,6 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
int atten_ctl = 0;
if (attenuator_count(channel) == 1) {
- // deal with attenuator range - haven't done for CH2 yet
if (atten_range == 0) {
atten_ctl = BIT_HIGH;
@@ -327,7 +326,8 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
atten_ctl = BIT_LOW;
}
- set_shiftreg_bits(SR_2, XTR_POS + 1, ONE_BIT, atten_ctl);
+ // XRLY1 for CH1, XRLY2 for CH2
+ set_shiftreg_bits(SR_2, XTR_POS + 1 + channel, ONE_BIT, atten_ctl);
} else if (attenuator_count(channel) > 1) {
@@ -335,6 +335,11 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
if ((atten_range < 0) || (atten_range >= max_attens)) {
atten_ctl = 0xff;
} else {
+ if (channel) {
+ // shift over 4 positions, out of 8, if CH2
+ atten_range += 4;
+ }
+
if (globals.Flash.sequential_attenuators[channel]) {
// For AVRZ-5W-B-LVA, which uses 3 identical 20 dB attenuators.
// 0, 1, 2 or 3 in series are used.