diff options
Diffstat (limited to 'device-functions.c')
-rw-r--r-- | device-functions.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/device-functions.c b/device-functions.c index 838dd7a..d27cf76 100644 --- a/device-functions.c +++ b/device-functions.c @@ -2648,9 +2648,9 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int use_ampl=use_ampl+globals.Flash.pw_shift_below_ampl_by[channel]; } - if (!globals.Flash.volt_ctrl_pw[channel]) { - reciprocal_relationship=YES; - } + // may be overridden below, if volt_ctrl_pw and words are increasing in value + reciprocal_relationship=YES; + break; case pwl_delay_values: max_polarity=timing_polarities; @@ -2660,9 +2660,9 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int *UseNegData=0; use_ampl=new_ampl; - if (!globals.Flash.volt_ctrl_delay[channel]) { - reciprocal_relationship=YES; - } + // may be overridden below, if volt_ctrl_delay and words are increasing in value + reciprocal_relationship=YES; + break; case pwl_period_values: max_polarity=timing_polarities; @@ -2816,6 +2816,23 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int *relay_range=range_i; *entry=entry_i; + /* check for linear voltage-controlled PW */ + if ( (parameter==pwl_pw_values) + && globals.Flash.volt_ctrl_pw[channel] + && (pwl_vc[index] < pwl_vc[index+1])) { + reciprocal_relationship=NO; + } + + /* check for linear voltage-controlled delay */ + if ( (parameter==pwl_delay_values) + && globals.Flash.volt_ctrl_delay[channel] + && (pwl_vc[index] < pwl_vc[index+1])) { + reciprocal_relationship=NO; + } + + // The above checks only apply if the control words are increasing with index. + // Normally just the first range is voltage-controlled. + if (reciprocal_relationship) { inverse_word_out = fraction * (1.0/((float) pwl_vc[index]) - 1.0/((float) pwl_vc[index+1])); inverse_word_out+=1/((float) pwl_vc[index]); |