diff options
-rw-r--r-- | device-functions.c | 50 | ||||
-rw-r--r-- | device-functions.h | 2 | ||||
-rw-r--r-- | instr-daemon.c | 2 | ||||
-rw-r--r-- | menus.c | 24 | ||||
-rw-r--r-- | parser.c | 2 |
5 files changed, 44 insertions, 36 deletions
diff --git a/device-functions.c b/device-functions.c index 4e21c14..ddeb5bb 100644 --- a/device-functions.c +++ b/device-functions.c @@ -201,7 +201,7 @@ void Main_Rst (void) Set_Trig_Source(i,globals.ChannelState[i].trigger_source); - Set_Amplitude(0,0,0,0,0,0,i,globals.ChannelState[i].amplitude,0); + Set_Amplitude(0,0,0,0,0,0,0,i,globals.ChannelState[i].amplitude,0); Set_Offset(0,0,0,0,i,globals.ChannelState[i].offset); Set_Output_State(i,globals.ChannelState[i].output_state); @@ -247,7 +247,7 @@ static int attenuator_count (int channel) } -int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override, +int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override,int aux_override, int switch_range_only,int channel,float new_ampl,int called_from_set_pw) { int word_out, word_out_aux; /* what is sent to the DAC */ @@ -320,6 +320,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w word_out=word_override; relay_range=range_override; actual_pol=pol_override; + word_out_aux=aux_override; } else { /* set the amplitude controls now. */ int status; @@ -636,7 +637,7 @@ int Set_Pw(int check_possible_only,int word_override,int range_override,int chan g_print_debug("pw range %d, word %d\n",relay_range,word_out); if (!called_from_set_ampl) { - Set_Amplitude(0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,1); + Set_Amplitude(0,0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,1); } return OK; @@ -709,12 +710,12 @@ int Set_Offset(int check_possible_only,int override_on,int word_override,int ran } if ((globals.Flash.ampl_coupled_to_os[channel] || globals.Flash.ampl_os_ranges_related[channel]) && !globals.Changes.update_amp) { - Set_Amplitude(0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,0); } /* change amplitude range if required for calibration */ if (override_on) { - Set_Amplitude(0,0,1,0,relay_range,0,channel,0.0,0); + Set_Amplitude(0,0,1,0,relay_range,0,0,channel,0.0,0); } /* increase PW if required to compensate for series output diode turn-on time */ @@ -1392,7 +1393,7 @@ int Set_zout(int channel,int setting,int really_for_zout) if (really_for_zout) { if (globals.Changes.update_zout) { /* change of Zout may require change in amplitude controls */ - Set_Amplitude(0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,0); } if (update_zout_slowly) { @@ -1432,7 +1433,7 @@ int Set_Load(int channel, float value) if (globals.Changes.update_load) { /* change of load may require change in amplitude controls */ - Set_Amplitude(0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude,0); } return OK; @@ -1463,10 +1464,10 @@ int Set_EA(int channel,int mode) /* set to max amplitude range when switching from normal to EA or Ext Amplify */ if ( (globals.ChannelState[channel].amp_mode==amp_mode_normal) && (mode!=amp_mode_normal) ) { if (globals.ChannelState[channel].amplitude<0.0) - Set_Amplitude(0,0,0,0,0,set_DAC_to_zero,channel, + Set_Amplitude(0,0,0,0,0,0,set_DAC_to_zero,channel, globals.ChannelState[channel].amplitude=globals.Flash.min_ampl[channel],0); /* most negative */ else - Set_Amplitude(0,0,0,0,0,set_DAC_to_zero,channel, + Set_Amplitude(0,0,0,0,0,0,set_DAC_to_zero,channel, globals.ChannelState[channel].amplitude=globals.Flash.max_ampl[channel],0); /* most positive */ } @@ -1474,9 +1475,9 @@ int Set_EA(int channel,int mode) /* protect when switching from EA or Ext Amplify back to normal */ if ( (globals.ChannelState[channel].amp_mode!=amp_mode_normal) && (mode==amp_mode_normal) ) { if (globals.ChannelState[channel].amplitude<0.0) { - Set_Amplitude(0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude=-smallest_allowed_number,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude=-smallest_allowed_number,0); } else { - Set_Amplitude(0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude=smallest_allowed_number,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,globals.ChannelState[channel].amplitude=smallest_allowed_number,0); } } @@ -1970,7 +1971,7 @@ int Set_Dly_Shr_Nom(int channel,int calibration_point_number) } else { ampl = globals.Flash.min_ampl[channel]; } - Set_Amplitude(0,0,0,0,0,0,channel,ampl,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,ampl,0); // set to PW to 20 ns, if possible @@ -2041,7 +2042,7 @@ int Set_Dly_Shr_Cal(int channel,int calibration_point_number,float cal_point) int Set_Cal_Nom(int channel,int calibration_point_number,int parameter, float *nom_val) { - int nominal_wordout,polarity,range,entry,status,num_in_range,num_of_ranges; + int nominal_wordout,nominal_wordout_aux,polarity,range,entry,status,num_in_range,num_of_ranges; float nominal_val,other_setting,temp1,temp2; int reset_state; int disable_errors; @@ -2059,7 +2060,14 @@ int Set_Cal_Nom(int channel,int calibration_point_number,int parameter, float *n nominal_val=-nominal_val; } nominal_wordout=globals.Flash.ampl_dacval[channel][range][polarity][entry]; - if (Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0) || Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0)) { + + if (globals.Flash.distort_enabled[channel]) { + nominal_wordout_aux=globals.Flash.distort_dacval[channel][range][polarity][entry]; + } else { + nominal_wordout_aux=0; + } + + if (Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0) || Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0)) { /* confirm that timing settings can support min/max ampl settings */ return CalibrationTimingProblem; } @@ -2138,7 +2146,7 @@ int Set_Cal_Nom(int channel,int calibration_point_number,int parameter, float *n switch (parameter) { case (pwl_ampl_values): - status=Set_Amplitude(0,polarity,1,nominal_wordout,range,0,channel,nominal_val,0); + status=Set_Amplitude(0,polarity,1,nominal_wordout,range,nominal_wordout_aux,0,channel,nominal_val,0); break; case (pwl_os_values): status=Set_Offset(0,1,nominal_wordout,range,channel,nominal_val); @@ -2531,7 +2539,7 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) } } - Set_Amplitude(0,0,0,0,0,0,channel,0.0,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,0.0,0); Main_update_shift_registers(); Set_Offset(0,0,0,0,channel,0.0); @@ -3271,7 +3279,7 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) /* update output */ switch (parameter) { case (pwl_ampl_values): - Set_Amplitude(0,0,0,0,0,0,channel,cal_point,0); + Set_Amplitude(0,0,0,0,0,0,0,channel,cal_point,0); break; case (pwl_os_values): @@ -3436,9 +3444,9 @@ int Check_MinMax_Cal(int channel,int parameter) /* see if new point prevents zero, min, max, or current value from being obtained */ switch (parameter) { case (pwl_ampl_values): - if (status=Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0)) return status; - if (status=Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0)) return status; - if (status=Set_Amplitude(1,0,0,0,0,0,channel,rst_ampl_value(channel),0)) return status; + if (status=Set_Amplitude(1,0,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0)) return status; + if (status=Set_Amplitude(1,0,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0)) return status; + if (status=Set_Amplitude(1,0,0,0,0,0,0,channel,rst_ampl_value(channel),0)) return status; break; case (pwl_os_values): @@ -4365,7 +4373,7 @@ void Set_Rcl(int setting_num) Set_Trig_Source(i,globals.ChannelState[i].trigger_source); - Set_Amplitude(0,0,0,0,0,0,i,globals.ChannelState[i].amplitude,0); + Set_Amplitude(0,0,0,0,0,0,0,i,globals.ChannelState[i].amplitude,0); if (globals.Flash.voltage_offset_enabled[i] || globals.Flash.current_offset_enabled[i]) { Set_Offset(0,0,0,0,i,globals.ChannelState[i].offset); diff --git a/device-functions.h b/device-functions.h index 80c81cb..c60bacb 100644 --- a/device-functions.h +++ b/device-functions.h @@ -11,7 +11,7 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i void Main_Rst(void); void set_dac(int dac, int word); -int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override, +int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override,int aux_override, int switch_range_only,int channel,float new_ampl,int called_from_set_pw); int Set_Pw(int check_possible_only,int word_override,int range_override,int channel,float set_pw,int called_from_set_ampl); int Set_Offset(int check_possible_only,int override_on,int word_override,int range_override,int channel,float new_offset); diff --git a/instr-daemon.c b/instr-daemon.c index c6eb8c0..511547d 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -272,7 +272,7 @@ int main(int argc, char **argv) for (j=0;j<ampl_polarities;j++) { // do each polarity - Set_Amplitude(0,j,1,0,0,0,i,0.0,0); + Set_Amplitude(0,j,1,0,0,0,0,i,0.0,0); Set_Trig_Source(i,source_hold); // trigger IL710 twice to initialize it @@ -2242,7 +2242,7 @@ static int Submenu_Mult_Value(float mult_by) } } - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,new_value,0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,new_value,0)) { Submenu_Value=new_value; } break; @@ -2721,7 +2721,7 @@ static void Submenu_Service_Encoder(int encoder_change) } - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,new_value,0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,new_value,0)) { Submenu_Value=new_value; } break; @@ -3223,52 +3223,52 @@ static int Submenu_Implement_Changes(void) // hard-coded count of 10 - not ideal! case (mode_ampl_fixed_point0): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][0],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][0],0)) { return error_num; } break; case (mode_ampl_fixed_point1): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][1],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][1],0)) { return error_num; } break; case (mode_ampl_fixed_point2): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][2],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][2],0)) { return error_num; } break; case (mode_ampl_fixed_point3): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][3],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][3],0)) { return error_num; } break; case (mode_ampl_fixed_point4): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][4],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][4],0)) { return error_num; } break; case (mode_ampl_fixed_point5): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][5],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][5],0)) { return error_num; } break; case (mode_ampl_fixed_point6): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][6],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][6],0)) { return error_num; } break; case (mode_ampl_fixed_point7): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][7],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][7],0)) { return error_num; } break; case (mode_ampl_fixed_point8): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][8],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][8],0)) { return error_num; } break; case (mode_ampl_fixed_point9): - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][9],0)) { + if (error_num=Set_Amplitude(0,0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][9],0)) { return error_num; } break; @@ -1728,7 +1728,7 @@ static int Go_ampl_26(gchar** response, int channel, char *parameter,char *units } Set_EA(channel,amp_mode_normal); - return Set_Amplitude(0,0,0,0,0,0,channel,new_ampl,0); + return Set_Amplitude(0,0,0,0,0,0,0,channel,new_ampl,0); break; case query_simple: |