From 1e66428546ef8d7751d47fd9b3231bc328ae5869 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Fri, 29 Apr 2016 13:58:35 -0400 Subject: implement CH2 attenuator ranges --- device-functions.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'device-functions.c') 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. -- cgit