summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/device-functions.c b/device-functions.c
index aed298d..fb6ea45 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -178,6 +178,19 @@ void set_dac(int dac, int word)
}
+static int attenuator_count (int channel)
+{
+ int i;
+ i = 0;
+
+ while ((i < max_attens) && (globals.Flash.attenuators[channel][i] > 0.0)) {
+ ++i;
+ }
+
+ return i;
+}
+
+
int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override,
int switch_range_only,int channel,float new_ampl,int called_from_set_pw)
{
@@ -303,7 +316,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
}
// Are attenuators used?
- if (globals.Flash.attenuators[channel][0] > 0.0) {
+ if (attenuator_count(channel) == 1) {
// deal with attenuator range - haven't done for CH2 yet
// only implement one attenuator so far (range 0), out of possible max_attens (8!)