summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device-functions.c462
-rw-r--r--device-functions.h2
-rw-r--r--error_utils.c53
-rw-r--r--flash.c15
-rw-r--r--globals.h37
-rw-r--r--menus.c107
-rw-r--r--parser.c97
7 files changed, 26 insertions, 747 deletions
diff --git a/device-functions.c b/device-functions.c
index e1ec380..3b1bf22 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -111,9 +111,6 @@ void Main_Rst (void)
globals.ChannelState[i].burst_time = globals.Constraints.composite_min_burst_time[i];
globals.ChannelState[i].rise_time = globals.Flash.min_rise_time[i];
globals.ChannelState[i].soft_current_limit = globals.Flash.max_soft_current_limit[i];
- globals.ChannelState[i].vcc1 = 0.0;
- globals.ChannelState[i].vcc2 = globals.Flash.vcc2_min[i];
- globals.ChannelState[i].vlogic = 0.0;
globals.ChannelState[i].slew = globals.Flash.min_slew[i];
globals.Flags.do_check_settings=NO; /* don't check for conflicting settings */
@@ -154,9 +151,6 @@ void Main_Rst (void)
Set_current_limit(0,i,globals.ChannelState[i].soft_current_limit);
- Set_avrq_ampl(0,0,0,2,globals.ChannelState[i].vcc1);
- Set_avrq_ampl(0,0,0,3,globals.ChannelState[i].vcc2);
- Set_avrq_ampl(0,0,0,4,globals.ChannelState[i].vlogic);
globals.Flags.do_check_settings=YES; /* check for conflicting settings */
}
@@ -199,18 +193,6 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w
new_ampl = fabs(new_ampl);
}
- if (globals.Flash.enable_avrq_extra_ampls && channel) {
- return Set_avrq_ampl(check_possible_only,word_override,range_override,channel,new_ampl);
- }
- if (globals.Flash.enable_avrq_extra_ampls && !channel) {
- if ((new_ampl>=0.0) && (new_ampl<globals.Flash.ampl_zero_equiv[channel])) {
- new_ampl=globals.Flash.ampl_zero_equiv[channel];
- }
- if ((new_ampl<0.0) && (new_ampl>-globals.Flash.ampl_zero_equiv[channel])) {
- new_ampl=-globals.Flash.ampl_zero_equiv[channel];
- }
- }
-
if (!globals.Flash.voltage_enabled[channel] && !globals.Flash.current_enabled[channel]) {
return Unrecognized;
}
@@ -1289,10 +1271,6 @@ int Set_Load(int channel, float value)
return InvalidChannel;
}
- if (globals.Flash.enable_avrq_extra_ampls) {
- return Set_avrq_res(0,0,0,channel,value);
- }
-
/* duty cycle check */
int i;
for (i=0; i<max_channels; ++i) {
@@ -1544,12 +1522,6 @@ int Set_Update_Chans(void)
globals.ChannelState[i].slew=globals.ChannelState[0].slew;
}
- for (i=1; i<num_of_chan; ++i) {
- globals.ChannelState[i].vcc1=globals.ChannelState[0].vcc1;
- globals.ChannelState[i].vcc2=globals.ChannelState[0].vcc2;
- globals.ChannelState[i].vlogic=globals.ChannelState[0].vlogic;
- }
-
}
return OK;
@@ -1990,22 +1962,6 @@ int Set_Cal_Nom(int channel,int calibration_point_number,int parameter, float *n
nominal_val=globals.Flash.slew_pwl_time[channel][range][polarity][entry];
nominal_wordout=globals.Flash.slew_pwl_Vc_norm4095[channel][range][polarity][entry];
break;
- case pwl_vcc1_values:
- nominal_val=globals.Flash.vcc1_pwl_amp[0][0][0][entry];
- nominal_wordout=globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][entry];
- true_channel=0;
- break;
- case pwl_vcc2_values:
- nominal_val=globals.Flash.vcc2_pwl_amp[0][0][0][entry];
- nominal_wordout=globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][entry];
- true_channel=0;
- break;
- case pwl_load_type_values:
- nominal_val=globals.Flash.load_type_pwl_time[channel][range][polarity][entry];
- nominal_wordout=globals.Flash.load_type_pwl_Vc_norm4095[channel][range][polarity][entry];
- reset_state=0;
- disable_errors=1;
- break;
}
/* just get nominal value, don't activate */
@@ -2128,18 +2084,6 @@ int Set_Cal_Nom(int channel,int calibration_point_number,int parameter, float *n
}
break;
- case pwl_load_type_values:
- Set_avrq_res(0,nominal_wordout,range,channel,nominal_val);
- break;
-
- case pwl_vcc1_values:
- status=Set_Amplitude(0,polarity,1,nominal_wordout,range,0,channel,nominal_val,0);
- break;
-
- case pwl_vcc2_values:
- status=Set_Amplitude(0,polarity,1,nominal_wordout,range,0,channel,nominal_val,0);
- break;
-
}
/* enables or disables delay diagnostic mode */
@@ -2215,23 +2159,6 @@ int Set_VI_Cal_Pnt(int parameter,int channel,int calibration_point_number,float
max_ranges=timing_ranges;
pwl_amp=&globals.Flash.slew_pwl_time[0][0][0][0];
break;
- case pwl_vcc1_values:
- max_polarity=1;
- max_ranges=1;
- true_channel=0;
- pwl_amp=&globals.Flash.vcc1_pwl_amp[0][0][0][0];
- break;
- case pwl_vcc2_values:
- max_polarity=1;
- max_ranges=1;
- true_channel=0;
- pwl_amp=&globals.Flash.vcc2_pwl_amp[0][0][0][0];
- break;
- case pwl_load_type_values:
- max_polarity=load_type_polarities;
- max_ranges=load_type_ranges;
- pwl_amp=&globals.Flash.load_type_pwl_time[0][0][0][0];
- break;
}
index=true_channel*max_ranges*max_polarity*max_points
+range*max_polarity*max_points
@@ -2275,7 +2202,6 @@ int Set_VI_Cal_Pnt(int parameter,int channel,int calibration_point_number,float
case pwl_burst_values:
case pwl_rise_time_values:
case pwl_slew_values:
- case pwl_load_type_values:
/* exclude relative changes of 45% or more unless < 15 ns */
if ( (fabs(cal_point-nom_ampl)/nom_ampl > 0.45) && (fabs(cal_point-nom_ampl)>15e-9)) {
return CalibrationPercentError;
@@ -2292,15 +2218,6 @@ int Set_VI_Cal_Pnt(int parameter,int channel,int calibration_point_number,float
}
break;
- case pwl_vcc1_values:
- case pwl_vcc2_values:
- if (fabs(nom_ampl) > smallest_allowed_number) {
- /* exclude relative changes of 30% or more */
- if (fabs( (cal_point-nom_ampl)/nom_ampl) > 0.3) {
- return CalibrationPercentError;
- }
- }
- break;
}
@@ -2416,32 +2333,6 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
size_of_short1=sizeof(globals.Flash.slew_pwl_Vc_norm4095);
size_of_float1=sizeof(globals.Flash.slew_pwl_time);
break;
- case pwl_vcc1_values:
- max_polarity=1;
- max_ranges=1;
- pointer_short1=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0];
- pointer_float1=&globals.Flash.vcc1_pwl_amp[0][0][0][0];
- size_of_short1=sizeof(globals.Flash.vcc1_pwl_Vc_norm4095);
- size_of_float1=sizeof(globals.Flash.vcc1_pwl_amp);
- true_channel=0;
- break;
- case pwl_vcc2_values:
- max_polarity=1;
- max_ranges=1;
- pointer_short1=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0];
- pointer_float1=&globals.Flash.vcc2_pwl_amp[0][0][0][0];
- size_of_short1=sizeof(globals.Flash.vcc2_pwl_Vc_norm4095);
- size_of_float1=sizeof(globals.Flash.vcc2_pwl_amp);
- true_channel=0;
- break;
- case pwl_load_type_values:
- max_polarity=load_type_polarities;
- max_ranges=load_type_ranges;
- pointer_short1=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0];
- pointer_float1=&globals.Flash.load_type_pwl_time[0][0][0][0];
- size_of_short1=sizeof(globals.Flash.load_type_pwl_Vc_norm4095);
- size_of_float1=sizeof(globals.Flash.load_type_pwl_time);
- break;
}
Get_VI_Rng_Info(parameter,channel,calibration_point_number,&range,&polarity,&entry,&num_in_range,&num_of_ranges);
@@ -2737,34 +2628,6 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
timing_extrapolation_allowed=NO;
top_range_only=YES; /* higher drive voltage = lower ripple in slew */
break;
- case pwl_vcc1_values:
- max_polarity=1;
- max_ranges=1;
- pwl_vc=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0];
- pwl_amp=&globals.Flash.vcc1_pwl_amp[0][0][0][0];
- *UseNegData=0;
- use_ampl=new_ampl;
- true_channel=0;
- break;
- case pwl_vcc2_values:
- max_polarity=1;
- max_ranges=1;
- pwl_vc=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0];
- pwl_amp=&globals.Flash.vcc2_pwl_amp[0][0][0][0];
- *UseNegData=0;
- use_ampl=new_ampl;
- true_channel=0;
- break;
- case pwl_load_type_values:
- max_polarity=load_type_polarities;
- max_ranges=load_type_ranges;
- pwl_vc=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0];
- pwl_amp=&globals.Flash.load_type_pwl_time[0][0][0][0];
- *UseNegData=0;
- use_ampl=new_ampl;
- reciprocal_relationship=YES;
- timing_extrapolation_allowed=YES;
- break;
}
@@ -3095,41 +2958,6 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
Set_VI_Control(pwl_slew_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol);
break;
- case pwl_vcc1_values:
- max_polarity=1;
- max_ranges=1;
- true_channel=0;
- pointer_x_short=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0];
- pointer_y_float=&globals.Flash.vcc1_pwl_amp[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.vcc1_pwl_Vc_norm4095);
- size_of_y_float=sizeof(globals.Flash.vcc1_pwl_amp);
- old_val=globals.ChannelState[true_channel].vcc1;
- Set_VI_Control(pwl_vcc1_values,channel,old_val,&point_found,
- &range,&atten_range,&polarity,&entry,&word_out,&actual_pol);
- break;
- case pwl_vcc2_values:
- max_polarity=1;
- max_ranges=1;
- true_channel=0;
- pointer_x_short=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0];
- pointer_y_float=&globals.Flash.vcc2_pwl_amp[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.vcc2_pwl_Vc_norm4095);
- size_of_y_float=sizeof(globals.Flash.vcc2_pwl_amp);
- old_val=globals.ChannelState[true_channel].vcc2;
- Set_VI_Control(pwl_vcc2_values,channel,old_val,&point_found,
- &range,&atten_range,&polarity,&entry,&word_out,&actual_pol);
- break;
- case pwl_load_type_values:
- max_polarity=load_type_polarities;
- max_ranges=load_type_ranges;
- pointer_x_short=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0];
- pointer_y_float=&globals.Flash.load_type_pwl_time[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.load_type_pwl_Vc_norm4095);
- size_of_y_float=sizeof(globals.Flash.load_type_pwl_time);
- old_val=globals.ChannelState[channel].load_type;
- Set_VI_Control(pwl_load_type_values,channel,old_val,&point_found,
- &range,&atten_range,&polarity,&entry,&word_out,&actual_pol);
- break;
}
@@ -3239,8 +3067,6 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
/* update output */
switch (parameter) {
case (pwl_ampl_values):
- case (pwl_vcc1_values):
- case (pwl_vcc2_values):
Set_Amplitude(0,0,0,0,0,0,channel,cal_point,0);
break;
@@ -3271,10 +3097,6 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_slew_values:
Set_slew(0,0,0,channel,cal_point);
break;
-
- case pwl_load_type_values:
- Set_avrq_res(0,0,0,channel,cal_point);
- break;
}
return OK;
@@ -3351,23 +3173,6 @@ int Get_VI_Rng_Info(int parameter, int channel, int calibration_point_number, in
max_ranges=timing_ranges;
pwl=&globals.Flash.slew_pwl_time[0][0][0][0];
break;
- case pwl_vcc1_values:
- max_polarity=1;
- max_ranges=1;
- pwl=&globals.Flash.vcc1_pwl_amp[0][0][0][0];
- true_channel=0;
- break;
- case pwl_vcc2_values:
- max_polarity=1;
- max_ranges=1;
- pwl=&globals.Flash.vcc2_pwl_amp[0][0][0][0];
- true_channel=0;
- break;
- case pwl_load_type_values:
- max_polarity=load_type_polarities;
- max_ranges=load_type_ranges;
- pwl=&globals.Flash.load_type_pwl_time[0][0][0][0];
- break;
}
@@ -3464,20 +3269,6 @@ int Check_MinMax_Cal(int channel,int parameter)
|| Set_slew(1,0,0,channel,globals.Flash.max_slew[channel]);
break;
- case (pwl_vcc1_values):
- status=Set_Amplitude(1,0,0,0,0,0,channel,0.0,0)
- || Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.vcc1_max[0],0);
- break;
-
- case (pwl_vcc2_values):
- status=Set_Amplitude(1,0,0,0,0,0,channel,0.0,0)
- || Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.vcc2_max[0],0);
- break;
-
- case pwl_load_type_values:
- status=Set_avrq_res(1,0,0,channel,globals.Flash.low_load_type[channel])
- || Set_avrq_res(1,0,0,channel,globals.Flash.high_load_type[channel]);
- break;
}
if (status) {
@@ -3838,80 +3629,6 @@ int Set_current_limit(int check_possible_only,int channel,float new_adj_current_
}
-int Set_avrq_res(int check_possible_only,int word_override,int range_override,int channel,float new_res)
-{
- int point_found,relay_range,UseNegData,entry,actual_pol,word_out,dummy;
-
- if (!globals.Flash.switchable_load[channel]) {
- return Unrecognized;
- }
-
- /* abandon if high channel selected by user but not enabled by firmware */
- if (channel && !globals.Flash.ChanKey_load_type) {
- return InvalidChannel;
- }
-
- if (!check_possible_only) {
- int i, check_valid;
-
- for (i=0; i<max_channels; ++i) {
- TestState[i]=globals.ChannelState[i];
- }
- TestState[channel].load_type=new_res;
- if ((check_valid=Error_check(TestState))) {
- return check_valid;
- }
- }
-
- /* find appropriate range/fine settings from piece-wise linear data in flash memory */
- if (word_override) {
- word_out=word_override;
- relay_range=range_override;
- } else {
- /* ugly hack - fix me?
- CH2 = opto VCC
- Calibrate res at 3.0V
- Compensate for >3.0V */
- float compensated_new_res;
-
- if (globals.ChannelState[0].vcc2 > 0.0) {
- compensated_new_res = new_res * 3.0/globals.ChannelState[0].vcc2;
- } else {
- return amplitude_lower_limit;
- }
-
- int status;
- if ((status=Set_VI_Control(pwl_load_type_values,channel,compensated_new_res,&point_found,
- &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol))) {
- return status;
- }
- }
-
- if (check_possible_only) {
- if (point_found) {
- return OK;
- } else {
- return CalibrationMinMaxError;
- }
- }
-
- set_dac(globals.Flash.load_type_dac[channel],word_out);
-
- /* no ranges are used */
-
- /* update variables if OK */
- if (new_res!=globals.ChannelState[channel].load_type) {
- globals.Changes.update_load=YES;
- }
-
- globals.ChannelState[channel].load_type = new_res;
-
- Set_Update_Chans();
-
- return OK;
-}
-
-
int Set_slew(int check_possible_only,int word_override,int range_override,int channel,float new_slew)
{
int check_valid;
@@ -3989,174 +3706,6 @@ int Set_slew(int check_possible_only,int word_override,int range_override,int ch
}
-int Set_avrq_ampl(int check_possible_only,int word_override,int range_override,int channel,float new_avrq_ampl)
-{
- int check_valid;
- int status,point_found,relay_range,UseNegData,entry,actual_pol,word_out,dummy;
- int true_channel;
- int use_pwl;
-
- if (!globals.Flash.enable_avrq_extra_ampls) {
- return Unrecognized;
- }
-
- /* check channels */
- if ((channel < 1) || (channel>4)) {
- return InvalidChannel;
- }
-
- if (channel == 1) {
- true_channel = 1;
- } else {
- true_channel = 0;
- }
-
- if (!check_possible_only) {
- /* check duty cycle */
- int i;
- for (i=0; i<max_channels; ++i) {
- TestState[i]=globals.ChannelState[i];
- }
- switch (channel) {
- case 1:
- TestState[true_channel].amplitude=new_avrq_ampl;
- break;
- case 2:
- TestState[true_channel].vcc1=new_avrq_ampl;
- if (TestState[true_channel].vlogic >= smallest_allowed_number) {
- TestState[true_channel].vlogic = new_avrq_ampl;
- }
- break;
- case 3:
- TestState[true_channel].vcc2=new_avrq_ampl;
- break;
- case 4:
- TestState[true_channel].vlogic=new_avrq_ampl;
- break;
- }
- if ((check_valid=Error_check(TestState))) {
- return check_valid;
- }
- }
-
- /* find appropriate range/fine settings from piece-wise linear data in flash memory */
- if (word_override) {
- word_out=word_override;
- relay_range=range_override;
- } else {
- switch (channel) {
- case 1:
- use_pwl = pwl_ampl_values;
- break;
- case 2:
- use_pwl = pwl_vcc1_values;
- break;
- case 3:
- use_pwl = pwl_vcc2_values;
- break;
- case 4:
- use_pwl = pwl_vlogic_values;
- if (new_avrq_ampl > 0.0) {
- new_avrq_ampl = globals.ChannelState[true_channel].vcc1;
- }
- break;
- }
-
- if (use_pwl != pwl_vlogic_values)
- if ((status=Set_VI_Control(use_pwl,channel,new_avrq_ampl,&point_found,&relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol))) {
- return status;
- }
-
- }
-
- if (check_possible_only) {
- if (point_found) {
- return OK;
- } else {
- return CalibrationMinMaxError;
- }
- }
-
-
- /* update variables if OK */
- switch (channel) {
- case 1:
- Set_avrq_ampl(0,0,0,4,0.0);
-
- set_dac(1,word_out);
-
- globals.Registers.avrq_reg = globals.Registers.avrq_reg & 0x3f;
- I2C_Write(PCF8574A+rise_time_port,globals.Registers.avrq_reg);
-
- if (new_avrq_ampl!=globals.ChannelState[true_channel].amplitude) {
- globals.Changes.update_amp=YES;
- }
- globals.ChannelState[true_channel].amplitude=new_avrq_ampl;
- break;
- case 2:
- set_dac(1,word_out);
-
- globals.Registers.avrq_reg = 0x40 | (globals.Registers.avrq_reg & 0xbf);
- I2C_Write(PCF8574A+rise_time_port,globals.Registers.avrq_reg);
-
- if (new_avrq_ampl!=globals.ChannelState[true_channel].vcc1) {
- globals.Changes.update_amp=YES;
- }
- globals.ChannelState[true_channel].vcc1=new_avrq_ampl;
- break;
- case 3:
- set_dac(0,word_out);
- if (new_avrq_ampl!=globals.ChannelState[true_channel].vcc2) {
- globals.Changes.update_amp=YES;
- }
- globals.ChannelState[true_channel].vcc2=new_avrq_ampl;
-
- /* update ampl-dependent load resistance */
- Set_avrq_res(0,0,0,0,globals.ChannelState[0].load_type);
-
- break;
- case 4:
- if (new_avrq_ampl >= smallest_allowed_number) {
- relay_range = 0x80;
- } else {
- relay_range = 0x0;
- }
- globals.Registers.avrq_reg = relay_range | (globals.Registers.avrq_reg & 0x7f);
- I2C_Write(PCF8574A+rise_time_port,globals.Registers.avrq_reg);
-
- if (new_avrq_ampl!=globals.ChannelState[true_channel].vlogic) {
- globals.Changes.update_amp=YES;
- }
- globals.ChannelState[true_channel].vlogic=new_avrq_ampl;
- break;
- }
-
-
- /* reduce vlogic based on vcc1, if required */
- if (channel == 2) {
- if (globals.ChannelState[true_channel].vlogic > smallest_allowed_number) {
- Set_avrq_ampl(0,0,0,4,globals.ChannelState[true_channel].vcc1);
- } else {
- Set_avrq_ampl(0,0,0,4,0.0);
- }
- }
-
- /* reduce vcc1 if ibias is active, because they share a DAC */
- if ((channel == 1) && (globals.ChannelState[true_channel].amplitude > smallest_allowed_number)) {
- globals.ChannelState[0].vcc1=0.0;
- }
-
- /* reduce vcc1 if ibias is active, because they share a DAC */
- if ((channel == 2) && (globals.ChannelState[true_channel].vcc1 > smallest_allowed_number)) {
- globals.ChannelState[1].amplitude=0.0;
- }
-
- Set_Update_Chans();
-
- return OK;
-}
-
-
int go_cal(CalStruct *caldata)
{
int i, status, points;
@@ -4531,10 +4080,6 @@ void Set_Rcl(int setting_num)
globals.ChannelState[i].rise_time=globals.Flash.rcl_rise_time[i][setting_num];
globals.ChannelState[i].slew=globals.Flash.rcl_slew[i][setting_num];
- globals.ChannelState[i].vcc1=globals.Flash.rcl_vcc1[i][setting_num];
- globals.ChannelState[i].vcc2=globals.Flash.rcl_vcc2[i][setting_num];
- globals.ChannelState[i].vlogic=globals.Flash.rcl_vlogic[i][setting_num];
-
globals.ChannelState[i].soft_current_limit=globals.Flash.rcl_soft_current_limit[i][setting_num];
globals.ChannelState[i].load_type=globals.Flash.rcl_load[i][setting_num];
@@ -4602,10 +4147,6 @@ void Set_Rcl(int setting_num)
Set_Offset(0,0,0,0,i,globals.ChannelState[i].offset);
}
- Set_avrq_ampl(0,0,0,2,globals.ChannelState[i].vcc1);
- Set_avrq_ampl(0,0,0,3,globals.ChannelState[i].vcc2);
- Set_avrq_ampl(0,0,0,4,globals.ChannelState[i].vlogic);
-
Set_Output_State(i,globals.ChannelState[i].output_state);
}
@@ -4642,9 +4183,6 @@ void Set_Sav(int setting_num)
globals.Flash.rcl_slew[i][setting_num]=globals.ChannelState[i].slew;
globals.Flash.rcl_soft_current_limit[i][setting_num]=globals.ChannelState[i].soft_current_limit;
globals.Flash.rcl_load[i][setting_num]=globals.ChannelState[i].load_type;
- globals.Flash.rcl_vcc1[i][setting_num]=globals.ChannelState[i].vcc1;
- globals.Flash.rcl_vcc2[i][setting_num]=globals.ChannelState[i].vcc2;
- globals.Flash.rcl_vlogic[i][setting_num]=globals.ChannelState[i].vlogic;
/* integers setting_nums
globals.ChannelState[i].zout 50 (1) or min (0)
diff --git a/device-functions.h b/device-functions.h
index cdbbd9c..9e47de2 100644
--- a/device-functions.h
+++ b/device-functions.h
@@ -57,9 +57,7 @@ int Set_Burst_Count(int channel,int count,float new_burst_time);
int Set_Burst_Time(int check_possible_only,int word_override,int range_override,int channel,float new_burst_time);
int Set_rise_time(int check_possible_only,int word_override,int range_override,int channel,float new_burst_time);
int Set_current_limit(int check_possible_only,int channel,float adj_current_limit);
-int Set_avrq_res(int check_possible_only,int word_override,int range_override,int channel,float new_res);
int Set_slew(int check_possible_only,int word_override,int range_override,int channel,float new_burst_time);
-int Set_avrq_ampl(int check_possible_only,int word_override,int range_override,int channel,float new_avrq_ampl);
int go_cal(CalStruct *caldata);
void cal_string(char *parameter, CalStruct *caldata);
int self_cal();
diff --git a/error_utils.c b/error_utils.c
index bd52ccc..a98c7af 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -41,7 +41,7 @@ void set_gpib_error_flags (int error_num)
case UnknownUnits:
case InvalidChannel:
case ThisShouldntHappen:
- case ampl_min_max_obsolete:
+ case obsolete_feature:
case zero_equiv_ampl_too_large:
GPIB_Set_Command_Error();
break;
@@ -539,8 +539,8 @@ void get_error_text(gchar **response, int error_num)
format_error_text(response,-300,"Not ready for commands yet. Still booting up.");
break;
- case ampl_min_max_obsolete:
- format_error_text(response,-200,"Ampl min/max mode is obsolete. Use fixed ampl points instead.");
+ case obsolete_feature:
+ format_error_text(response,-200,"Obsolete feature enabled. Re-program.");
break;
case zero_equiv_ampl_too_large:
@@ -659,15 +659,12 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
if (!globals.Flash.ChanKey_current_limit) for (i=1; i<num_of_chan; ++i) {
ChannelStateToTest[i].soft_current_limit=ChannelStateToTest[0].soft_current_limit;
}
- for (i=1; i<num_of_chan; ++i) {
- ChannelStateToTest[i].vcc1=ChannelStateToTest[0].vcc1;
- }
- for (i=1; i<num_of_chan; ++i) {
- ChannelStateToTest[i].vcc2=ChannelStateToTest[0].vcc2;
- }
- for (i=1; i<num_of_chan; ++i) {
- ChannelStateToTest[i].vlogic=ChannelStateToTest[0].vlogic;
- }
+ }
+
+
+ // check for non-channel-specific obsolete features
+ if ( globals.Flash.enable_avrq_extra_ampls ) {
+ report_error = obsolete_feature;
}
@@ -701,9 +698,9 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
}
- // check for obsolete configurations - but allow further checks
- if (globals.Flash.ampl_min_max_only[i]) {
- report_error = ampl_min_max_obsolete;
+ // check for channel-specific obsolete configurations - but allow further checks
+ if ( globals.Flash.ampl_min_max_only[i] ) {
+ report_error = obsolete_feature;
}
if (fabs(globals.Flash.ampl_zero_equiv[i] > 200.0)) {
@@ -1069,32 +1066,6 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels])
/* disable amplitude checks if amplitude calibration is in progress */
if (!globals.Flags.extended_ampl_min_max) {
- globals.Constraints.err_max_vcc1[i]=globals.Flash.vcc1_max[i];
- globals.Constraints.err_max_vcc2[i]=globals.Flash.vcc2_max[i];
- globals.Constraints.err_max_vlogic[i]=ChannelStateToTest[0].vcc1;
- globals.Constraints.err_min_vcc1[i]=0.0;
- globals.Constraints.err_min_vcc2[i]=globals.Flash.vcc2_min[i];
- globals.Constraints.err_min_vlogic[i]=0.0;
- if ( ChannelStateToTest[i].vcc1>(1.001*globals.Constraints.err_max_vcc1[i])) {
- report_error=amplitude_upper_limit;
- }
- if ( ChannelStateToTest[i].vcc2>(1.001*globals.Constraints.err_max_vcc2[i])) {
- report_error=amplitude_upper_limit;
- }
- if ( ChannelStateToTest[i].vlogic>(1.001*globals.Constraints.err_max_vlogic[i])) {
- report_error=amplitude_upper_limit;
- }
- if ( ChannelStateToTest[i].vcc1<globals.Constraints.err_min_vcc1[i]) {
- report_error=amplitude_lower_limit;
- }
- if ( ChannelStateToTest[i].vcc2<globals.Constraints.err_min_vcc2[i]) {
- report_error=amplitude_lower_limit;
- }
- if ( ChannelStateToTest[i].vlogic<globals.Constraints.err_min_vlogic[i]) {
- report_error=amplitude_lower_limit;
- }
-
-
/* --- check fixed amplitudes ---- */
float min_fixed_ampl, max_fixed_ampl;
diff --git a/flash.c b/flash.c
index 0cf05a8..54bc17e 100644
--- a/flash.c
+++ b/flash.c
@@ -851,21 +851,6 @@ static void initFlashValues(FlashStruct *mem)
mem->copy_max_channels=max_channels; /* copy to flash, so it can be read by diag:eprom:int? */
-
- /* avrq tests
- mem->enable_avrq_extra_ampls=1;
- mem->channels=2;
- mem->ChanKey_amplitude=1;
- mem->current_enabled[1]=1;
- mem->voltage_enabled[1]=0;
- mem->fully_programmed=2;
- mem->ampl_DAC[0]=-1;
- mem->ampl_pwl_amp[1][0][0][1]=0.025;
- mem->max_ampl[1]=0.022;
- mem->max_vout[1]=0.022;
- mem->ampl_zero_equiv[1]=0.001;
- */
-
}
static gpointer userflashwritethreadfunc(gpointer data)
diff --git a/globals.h b/globals.h
index a39fe3b..3617762 100644
--- a/globals.h
+++ b/globals.h
@@ -91,7 +91,7 @@
#define DelayRangeError 77
#define ExternalModeDelayError 78
#define PRF_limited_by_offset 79
-#define ampl_min_max_obsolete 80
+#define obsolete_feature 80
#define zero_equiv_ampl_too_large 81
@@ -126,11 +126,7 @@
#define pwl_period_values 5
#define pwl_burst_values 6
#define pwl_rise_time_values 7
-#define pwl_load_type_values 8
#define pwl_slew_values 9
-#define pwl_vcc1_values 10
-#define pwl_vcc2_values 11
-#define pwl_vlogic_values 12
#define dac_max 8191
#define dac_min 819
@@ -358,10 +354,6 @@ typedef struct {
float soft_current_limit; /* adjustable protection trip-point */
float slew; /* slew rate */
- float vcc1; /* AVRQ control voltages */
- float vcc2;
- float vlogic;
-
} ChannelStruct;
@@ -602,17 +594,16 @@ typedef struct {
float rcl_rise_time[max_channels][max_stored_settings]; /* 7406 - rcl/sav data for rise time */
short rise_time_pwl_Vc_norm4095[max_channels][ampl_ranges][ampl_polarities][points_in_range]; /* 7438 */
-#define AVRQ_ZERO_EQUIV 3.0
- short vcc1_pwl_Vc_norm4095[1][1][1][points_in_range];
- float vcc1_pwl_amp[1][1][1][points_in_range];
- short vcc2_pwl_Vc_norm4095[1][1][1][points_in_range];
- float vcc2_pwl_amp[1][1][1][points_in_range];
- float rcl_vcc1[max_channels][max_stored_settings];
- float rcl_vcc2[max_channels][max_stored_settings];
- float rcl_vlogic[max_channels][max_stored_settings];
- float vcc1_max[max_channels];
- float vcc2_min[max_channels];
- float vcc2_max[max_channels];
+ short vcc1_pwl_Vc_norm4095[1][1][1][points_in_range]; /* no longer used */
+ float vcc1_pwl_amp[1][1][1][points_in_range]; /* no longer used */
+ short vcc2_pwl_Vc_norm4095[1][1][1][points_in_range]; /* no longer used */
+ float vcc2_pwl_amp[1][1][1][points_in_range]; /* no longer used */
+ float rcl_vcc1[max_channels][max_stored_settings]; /* no longer used */
+ float rcl_vcc2[max_channels][max_stored_settings]; /* no longer used */
+ float rcl_vlogic[max_channels][max_stored_settings]; /* no longer used */
+ float vcc1_max[max_channels]; /* no longer used */
+ float vcc2_min[max_channels]; /* no longer used */
+ float vcc2_max[max_channels]; /* no longer used */
float max_duty_mid1[max_channels]; /* addr 8078 - for AVO-8D3-B, etc */
float duty_ampl_mid1[max_channels]; /* addr 8086 */
@@ -765,12 +756,6 @@ typedef struct {
float err_max_slew[max_channels];
float err_min_load_type[max_channels];
float err_max_load_type[max_channels];
- float err_min_vcc1[max_channels];
- float err_max_vcc1[max_channels];
- float err_min_vcc2[max_channels];
- float err_max_vcc2[max_channels];
- float err_min_vlogic[max_channels];
- float err_max_vlogic[max_channels];
float composite_min_burst_time[max_channels]; /* minimum ever possible gap, taking into account all constraints */
} ConstraintsStruct;
diff --git a/menus.c b/menus.c
index c7e60bc..4781356 100644
--- a/menus.c
+++ b/menus.c
@@ -166,7 +166,6 @@
#define Show_route_secondary 1600
#define Show_load_type 1700
#define Show_slew 1800
-#define Show_avrq_ampl 1900
/* KEY MENU-JUGGLING VARIABLES - controlling what is actually shown on the display */
@@ -576,24 +575,6 @@ void Show_Main_Menu(void)
}
- /*----- display AVRQ extra amplitudes -----*/
-
- if (globals.Flash.enable_avrq_extra_ampls) {
- for (chan=2; chan<5; ++chan) {
- ++LCD_entry;
- Main_Menu_Structure[LCD_entry]=Submenu1_avrq+chan;
- LCD_row=LCD_entry % LCD_rows;
- LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
-
- show_item=Show_avrq_ampl+chan;
- menu_string = g_string_append (menu_string, "AMP");
- g_string_append_printf (menu_string, "%d", chan+1);
- menu_string = g_string_append (menu_string, ":");
- Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig,LCD_col_width-1);
- g_string_erase (menu_string, 0, -1);
- }
- }
-
/*----- display soft_current_limit, as appropriate -----*/
for (chan=0; chan<(globals.Flash.ChanKey_current_limit?globals.Flash.channels:1); ++chan) {
@@ -1118,22 +1099,6 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
}
break;
- case Show_avrq_ampl:
- switch (channel) {
- case 2:
- Submenu_Value=globals.ChannelState[0].vcc1;
- break;
- case 3:
- Submenu_Value=globals.ChannelState[0].vcc2;
- break;
- case 4:
- Submenu_Value=globals.ChannelState[0].vlogic;
- break;
- }
- show_plus_sign=YES;
- units = g_strdup("V");
- break;
-
case Show_offset:
Submenu_Value=globals.ChannelState[channel].offset;
show_plus_sign=YES;
@@ -1351,15 +1316,7 @@ static void Submenu_Display(int change_selection)
break;
case Submenu1_amp:
- if (globals.Flash.enable_avrq_extra_ampls) {
- if (channel==0) {
- title = g_strdup ("Amplitude1 (HV):");
- } else {
- title = g_strdup ("Amplitude2 (IBIAS):");
- }
- } else {
- title = g_strdup ("Amplitude:");
- }
+ title = g_strdup ("Amplitude:");
if (number_of_fixed_ampl_points(channel)>0) {
int fixed_count;
@@ -1384,23 +1341,6 @@ static void Submenu_Display(int change_selection)
break;
- case Submenu1_avrq:
-
- switch (channel) {
- case 2:
- title = g_strdup ("Amplitude3 (Vcc1):");
- break;
- case 3:
- title = g_strdup ("Amplitude4 (Vcc2):");
- break;
- case 4:
- title = g_strdup ("Amplitude5 (Vlogic):");
- break;
- }
-
- Submenu_Numeric_Parameter=Show_avrq_ampl+channel;
- break;
-
case Submenu1_burst_count:
title = g_strdup ("Pulses per burst:");
Submenu_Numeric_Parameter=Show_Burst_Count+channel;
@@ -2212,25 +2152,6 @@ static int Submenu_Mult_Value(float mult_by)
}
break;
- case Show_avrq_ampl:
- if (fabs(new_value)<AVRQ_ZERO_EQUIV && mult_by>1.0) {
- new_value=AVRQ_ZERO_EQUIV;
- } else if (fabs(new_value) < AVRQ_ZERO_EQUIV) {
- new_value=smallest_allowed_number;
- }
-
- if (channel == 4) { /* vlogic */
- if (mult_by > 1.0) {
- new_value = globals.ChannelState[0].vcc1;
- } else {
- new_value = 0.0;
- }
- }
- if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,new_value,0)) {
- Submenu_Value=new_value;
- }
- break;
-
case Show_Burst_Time:
if (error_num=Set_Burst_Time(0,0,0,channel,new_value)) {
Submenu_Value=new_value;
@@ -2480,21 +2401,6 @@ static void Submenu_Service_Encoder(int encoder_change)
}
}
- else if (abs_Submenu_Value < AVRQ_ZERO_EQUIV && (Submenu_Numeric_Parameter-channel)==Show_avrq_ampl) {
- abs_Submenu_Value=AVRQ_ZERO_EQUIV;
-
- if (channel == 4) { /* vlogic */
- if (encoder_change > 0) {
- Submenu_Value = abs_Submenu_Value = globals.ChannelState[0].vcc1;
- encoder_change = 0;
- } else {
- Submenu_Value = abs_Submenu_Value = 0.0;
- encoder_change = 0;
- }
- }
-
- }
-
else if ((channel<max_channels) && abs_Submenu_Value<globals.Flash.ampl_zero_equiv[channel] && (Submenu_Numeric_Parameter-channel)==Show_offset) {
abs_Submenu_Value=globals.Flash.ampl_zero_equiv[channel];
if (globals.Flash.max_offset[channel]<globals.Flash.ampl_zero_equiv[channel]) {
@@ -2721,17 +2627,6 @@ static void Submenu_Service_Encoder(int encoder_change)
}
break;
- case Show_avrq_ampl:
- if (new_value < AVRQ_ZERO_EQUIV) {
- new_value=0.0;
- }
-
- if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,new_value,0)) {
- Submenu_Value=new_value;
- }
-
- break;
-
case Show_offset:
if (globals.Flash.min_offset[channel]==globals.Flash.max_offset[channel]) {
return;
diff --git a/parser.c b/parser.c
index 63f0e57..831e0aa 100644
--- a/parser.c
+++ b/parser.c
@@ -112,7 +112,6 @@ static int Go_rcl_53(gchar** response, int channel, char *parameter,char *units,
static int Go_sav_54(gchar** response, int channel, char *parameter,char *units,int command_type);
static int Go_soft_current_limit_96(gchar** response, int channel, char *parameter,char *units,int command_type);
static int Go_curr_slew_98(gchar** response, int channel, char *parameter,char *units,int command_type);
-static int Go_avrq_ampl(gchar** response, int channel, char *parameter,char *units,int command_type);
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);
@@ -1030,9 +1029,6 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer
case 96:
error_num=Go_soft_current_limit_96(&response,channel,parameter,units,command_type);
break;
- case 97:
- error_num=Go_amp_pnt_83(&response,channel,parameter,units,command_type,pwl_load_type_values);
- break;
case 98:
error_num=Go_curr_slew_98(&response,channel,parameter,units,command_type);
break;
@@ -1113,10 +1109,7 @@ static int Parser_channel (int *channel,int with_id_code,int routine_num)
/* compare to maximum number of channels allowed */
- if (*channel>1 && *channel>globals.Flash.channels && !globals.Flash.enable_avrq_extra_ampls) {
- return InvalidChannel;
- }
- if (*channel>5 && globals.Flash.enable_avrq_extra_ampls) {
+ if (*channel>1 && *channel>globals.Flash.channels) {
return InvalidChannel;
}
@@ -1683,9 +1676,6 @@ static int Go_ampl_26(gchar** response, int channel, char *parameter,char *units
return status;
}
if (!strcmp(mode,"v")) {
- if (globals.Flash.enable_avrq_extra_ampls && channel > 1) {
- return Go_avrq_ampl (response, channel, parameter, units, command_type);
- }
if (!globals.Flash.voltage_enabled[channel]) {
return Unrecognized;
}
@@ -3425,22 +3415,9 @@ static int Go_amp_pnt_83(gchar** response, int channel, char *parameter,char *un
if (status = check_channel_ok (channel, globals.Flash.channels, globals.Flash.ChanKey_amplitude)) {
return status;
}
- if (!globals.Flash.enable_avrq_extra_ampls && !globals.Flash.voltage_enabled[channel] && !globals.Flash.current_enabled[channel]) {
+ if (!globals.Flash.voltage_enabled[channel] && !globals.Flash.current_enabled[channel]) {
return Unrecognized;
}
- if ((channel > 1) && globals.Flash.enable_avrq_extra_ampls) {
- switch (channel) {
- case 2:
- cal_type=pwl_vcc1_values;
- break;
- case 3:
- cal_type=pwl_vcc2_values;
- break;
- default:
- return InvalidChannel;
- break;
- }
- }
break;
case pwl_rise_time_values:
if (status = check_channel_ok (channel, globals.Flash.channels, globals.Flash.ChanKey_rise_time)) {
@@ -3458,14 +3435,6 @@ static int Go_amp_pnt_83(gchar** response, int channel, char *parameter,char *un
return Unrecognized;
}
break;
- case pwl_load_type_values:
- if (status = check_channel_ok (channel, globals.Flash.channels, globals.Flash.ChanKey_load_type)) {
- return status;
- }
- if (!globals.Flash.switchable_load[channel]) {
- return Unrecognized;
- }
- break;
case pwl_os_values:
if (status = check_channel_ok (channel, globals.Flash.channels, globals.Flash.ChanKey_offset)) {
return status;
@@ -3945,68 +3914,6 @@ static int Go_curr_slew_98(gchar** response, int channel, char *parameter,char *
}
-static int Go_avrq_ampl(gchar** response, int channel, char *parameter,char *units,int command_type)
-{
- float new_ampl;
- int status;
- float min_val,max_val,cur_val;
-
- new_ampl=1.0;
-
- switch (channel) {
- case 2:
- min_val=globals.Constraints.err_min_vcc1[0];
- max_val=globals.Constraints.err_max_vcc1[0];
- cur_val=globals.ChannelState[0].vcc1;
- break;
- case 3:
- min_val=globals.Constraints.err_min_vcc2[0];
- max_val=globals.Constraints.err_max_vcc2[0];
- cur_val=globals.ChannelState[0].vcc2;
- break;
- case 4:
- min_val=globals.Constraints.err_min_vlogic[0];
- max_val=globals.Constraints.err_max_vlogic[0];
- cur_val=globals.ChannelState[0].vlogic;
- break;
- default:
- return InvalidChannel;
- break;
- }
-
- switch (command_type) {
- case command_param_units:
- if (status=Handle_Units(&new_ampl,units,"v")) {
- return status;
- }
- /* no break */
-
- case command_withparam:
- if (status = process_float_param (parameter, &new_ampl, min_val, max_val, NORMAL_ZERO)) {
- return status;
- }
- return Set_Amplitude(0,0,0,0,0,0,channel,new_ampl,0);
- break;
-
- case query_simple:
-
- return query_float(response, cur_val);
- break;
-
- case query_param:
-
- return query_min_max_float (response, parameter, min_val, max_val);
- break;
-
- default:
- return SyntaxError;
- break;
- }
-
- return ThisShouldntHappen;
-}
-
-
static int Go_cal_100(gchar** response, int channel, char *parameter,char *units,int command_type)
{
int no_report, status;