diff options
-rw-r--r-- | device-functions.c | 28 | ||||
-rw-r--r-- | device-functions.h | 1 | ||||
-rw-r--r-- | error_utils.c | 4 |
3 files changed, 32 insertions, 1 deletions
diff --git a/device-functions.c b/device-functions.c index de954fd..81bf1d9 100644 --- a/device-functions.c +++ b/device-functions.c @@ -2680,6 +2680,34 @@ static int inverse_interpolation (int x1, int x2, float y1, float y2, float y_ne } +float min_possible_hw_rise_time (int channel, float use_ampl) +{ + // special function to let rise time go to the lowest hardware-possible value, not just the specified minimum - for AVRQ + float min_so_far, try_this; + + int i, j, actual_pol; + + if (use_ampl<0.0) { + actual_pol=1; + } else { + actual_pol=0; + } + + min_so_far = globals.Flash.max_rise_time[channel]; + + for (i=0;i<ampl_ranges;i++) { + for (j=0;j<std_range_size;j++) { + try_this = globals.Flash.rise_time_pwl[channel][i][actual_pol][j]; + if ((try_this > 0.0) && (try_this < min_so_far)) { + min_so_far = try_this; + } + } + } + + return min_so_far; +} + + int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int *relay_range,int *atten_range, int *UseNegData,int *entry,int *word_out,int *actual_pol,int *word_out_aux) { diff --git a/device-functions.h b/device-functions.h index c0cb747..e3ba3a2 100644 --- a/device-functions.h +++ b/device-functions.h @@ -56,6 +56,7 @@ int Check_MinMax_Cal(int channel,int parameter); int control_pcb107(int address, int dac, int word, int range); 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); +float min_possible_hw_rise_time (int channel, float use_ampl); 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_slew(int check_possible_only,int word_override,int range_override,int channel,float new_burst_time); diff --git a/error_utils.c b/error_utils.c index ec5e351..297f6fa 100644 --- a/error_utils.c +++ b/error_utils.c @@ -1344,9 +1344,11 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) ) { report_error=rise_time_confined_values; } + check_initial_min_value (globals.Flash.min_rise_time[i], &globals.Constraints.err_min_rise_time[i], ChannelStateToTest[i].rise_time, min_rise_time_error, &report_error); + } else { + check_initial_min_value (min_possible_hw_rise_time(i, ChannelStateToTest[i].amplitude), &globals.Constraints.err_min_rise_time[i], ChannelStateToTest[i].rise_time, min_rise_time_error, &report_error); } - check_initial_min_value (globals.Flash.min_rise_time[i], &globals.Constraints.err_min_rise_time[i], ChannelStateToTest[i].rise_time, min_rise_time_error, &report_error); check_initial_max_value (globals.Flash.max_rise_time[i], &globals.Constraints.err_max_rise_time[i], ChannelStateToTest[i].rise_time, max_rise_time_error, &report_error); } |