summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:08:20 +0900
committerroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:08:20 +0900
commit5116292db1fb4003980fa0a4d828eeb8bbf561bb (patch)
tree2d4bf9eca3f3f3881761cdb22f7a927da96aab5c /device-functions.c
parent31e63ddbf9ddd56f8bd08744dc03d24e9d935818 (diff)
add attenuator_count function
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!)