diff options
-rw-r--r-- | device-functions.c | 2 | ||||
-rw-r--r-- | globals.c | 2 | ||||
-rw-r--r-- | globals.h | 1 | ||||
-rw-r--r-- | parser.c | 39 |
4 files changed, 42 insertions, 2 deletions
diff --git a/device-functions.c b/device-functions.c index fc87bda..464079c 100644 --- a/device-functions.c +++ b/device-functions.c @@ -2710,6 +2710,8 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int continue; } else if (globals.Flash.attenuators[channel][*atten_range] == 0.0) { continue; + } else if (globals.Flags.attenuators_enabled == 0) { + continue; } else { use_atten = globals.Flash.attenuators[channel][*atten_range]; } @@ -5,7 +5,9 @@ GlobalStruct globals = { .Flags.do_check_settings = 1, + .Flags.attenuators_enabled = 1, .DefaultFlags.do_check_settings = 1, + .DefaultFlags.attenuators_enabled = 1, .Registers.last_rise_time_relay_setting = 99, @@ -763,6 +763,7 @@ typedef struct { int do_check_settings; int flash_writes_suspended; int force_output_fully_off; + int attenuators_enabled; } FlagStruct; @@ -116,6 +116,7 @@ static int Go_avrq_ampl(gchar** response, int channel, char *parameter,char *uni static int Go_cal_100(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_cal_interval_101(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_eprom_reset_102(gchar** response, int channel, char *parameter,char *units,int command_type); +static int Go_atten_103(gchar** response, int channel, char *parameter,char *units,int command_type); static int Parser_id_word(char *id_me, int *channel, int *with_id_code) { @@ -351,6 +352,8 @@ static int Parser_id_word(char *id_me, int *channel, int *with_id_code) id_code = 107; } else if (!strcmp(id_me,"reset") || !strcmp(id_me,"res")) { id_code = 108; + } else if (!strcmp(id_me,"attenuator") || !strcmp(id_me,"att")) { + id_code = 109; } else { id_code = 9999; } @@ -476,6 +479,7 @@ static int Parser_find_commands(int commands[], int command_depth) {88,107|optional}, /* calibration:all - 100 */ {88,37}, /* calibration:frequency - 101 */ {23,57,108}, /* diag:eprom:reset - 102 */ + {23,109,16|optional}, /* diag:attenuator:state - 103 */ }; @@ -1044,7 +1048,9 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer case 102: error_num=Go_eprom_reset_102(&response,channel,parameter,units,command_type); break; - + case 103: + error_num=Go_atten_103(&response,channel,parameter,units,command_type); + break; case 9999: // was only whitespace, ignore break; @@ -3267,7 +3273,7 @@ static int Parse_chan_list(int channel,char *parameter,int *primary_selected, in } n = atoi(digits->str); - g_string_free (digits, TRUE); + g_string_free (digits, TRUE); if (error_num) { return error_num; @@ -4029,3 +4035,32 @@ static int Go_cal_interval_101(gchar** response, int channel, char *parameter,ch return ThisShouldntHappen; } + + +static int Go_atten_103(gchar** response, int channel, char *parameter,char *units,int command_type) +{ + int on_off, status; + + switch (command_type) { + case command_withparam: + if (status=process_on_off (parameter, &on_off)) { + return status; + } + globals.Flags.attenuators_enabled = on_off; + + return OK; + break; + + case query_simple: + return query_int (response, globals.Flags.attenuators_enabled); + break; + + default: + return SyntaxError; + break; + } + + return ThisShouldntHappen; +} + + |