summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:24:42 +0900
committerroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:24:42 +0900
commit838f4e7d3444e6932f2eaae3f2a03bb3ce757675 (patch)
tree15e7846983f341019bc80ac2261679f18e4ee447 /device-functions.c
parent152b5a2766e7662a4bcc847660a335d61fa9ebd1 (diff)
fix error in pw/delay control introduced by voltage-controlled 2CH delay
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c29
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]);