From dd8cc92a83e426ae110668bc53c306de6216551e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Jan 1970 09:14:53 +0900 Subject: added support for sequential vs binary attenuator stages --- device-functions.c | 10 +++++++++- flash.c | 3 ++- globals.h | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/device-functions.c b/device-functions.c index 997390f..c466ae4 100644 --- a/device-functions.c +++ b/device-functions.c @@ -335,7 +335,15 @@ 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 { - atten_ctl = ~((1 << (atten_range+1)) - 1); + 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. + atten_ctl = ~((1 << (atten_range+1)) - 1); + } else { + // For more standard configurations, where different attenuators + // are combined in a binary style - 000, 001, 010, 011, 100, etc + atten_ctl = ~(atten_range+1); + } } I2C_Write(PCF8574+Octal_Relay_Driver, atten_ctl); diff --git a/flash.c b/flash.c index 637f599..8ff94e2 100644 --- a/flash.c +++ b/flash.c @@ -861,7 +861,8 @@ static void initFlashValues(FlashStruct *mem) } mem->ext2_enabled[i] = 0; - mem->toggle_trig_at_boot[i] = 0; + mem->toggle_trig_at_boot[i] = 1; + mem->sequential_attenuators[i] = 0; } mem->relay_delay_in_sec=0.5; diff --git a/globals.h b/globals.h index 7eaf0ff..c8cba93 100644 --- a/globals.h +++ b/globals.h @@ -741,6 +741,8 @@ typedef struct { char ext2_enabled[max_channels]; /* addr 10250, for KMPF */ char toggle_trig_at_boot[max_channels]; /* addr 10252, for IL710 units */ + char sequential_attenuators[max_channels]; /* addr 10254, for AVRZ-5W-B-LVA style of 3 identical attenuators */ + char flash_end; } FlashStruct; -- cgit