From f96c0cbe62a8eb5bb544a40a6ef4231652829812 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 04:27:27 +0900 Subject: misc fixes to max zout checks --- device-functions.c | 14 +++++++++++++- error_utils.c | 27 +++++++++++++++++++++------ globals.h | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/device-functions.c b/device-functions.c index b9fdb0f..25814c1 100644 --- a/device-functions.c +++ b/device-functions.c @@ -1350,14 +1350,26 @@ static void stop_gate_override () int Set_zout(int channel,int setting,int really_for_zout) { + int error_num; + int i; + int update_zout_slowly; + update_zout_slowly=NO; /* abandon if high channel selected by user but not enabled by firmware */ if (channel && !globals.Flash.ChanKey_zout) { return InvalidChannel; } - update_zout_slowly=NO; + if (really_for_zout) { + for (i=0; i *running_limit) { + *actual_error = possible_error; + } +} + + void check_another_max_value (float test_limit, float *running_limit, float proposed_value, int possible_error, int *actual_error) { if (test_limit < *running_limit) { check_initial_max_value (test_limit, running_limit, proposed_value, possible_error, actual_error); @@ -680,6 +690,12 @@ void check_another_max_value (float test_limit, float *running_limit, float prop } +void check_another_max_value_int (int test_limit, int *running_limit, int proposed_value, int possible_error, int *actual_error) { + if (test_limit < *running_limit) { + check_initial_max_value_int (test_limit, running_limit, proposed_value, possible_error, actual_error); + } +} + int Error_check(ChannelStruct ChannelStateToTest[max_channels]) { @@ -870,7 +886,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) // for -LV option, restrict power dissipated in internal attenuators if (globals.Flash.switchable_zout[i] && - (globals.ChannelState[i].zout==globals.Flash.zout_max[i]) && + (ChannelStateToTest[i].zout==globals.Flash.zout_max[i]) && (globals.Flash.switchable_zout_max_duty[i] > 0.0) && (max_duty_this_ampl > globals.Flash.switchable_zout_max_duty[i])) { max_duty_this_ampl = globals.Flash.switchable_zout_max_duty[i]; @@ -1390,14 +1406,13 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } /* --- check zout / duty settings --- */ - - check_initial_max_value (globals.Flash.zout_max[i], &globals.Constraints.err_max_zout[i], ChannelStateToTest[i].zout, max_zout_error, &report_error); + check_initial_max_value_int (globals.Flash.zout_max[i], &globals.Constraints.err_max_zout[i], ChannelStateToTest[i].zout, max_zout_error, &report_error); if (globals.Flash.switchable_zout[i] && - (globals.ChannelState[i].zout==globals.Flash.zout_max[i]) && + (ChannelStateToTest[i].zout==globals.Flash.zout_max[i]) && (globals.Flash.switchable_zout_max_duty[i] > 0.0) && - (duty_cycle > (globals.Flash.switchable_zout_max_duty[i] / duty_scale))) { + (duty_cycle > (globals.Flash.switchable_zout_max_duty[i] * 100.0 / duty_scale))) { // can only operate at min Zout at high duty cycles, due to attenuator limits - check_another_max_value (globals.Flash.zout_min[i], &globals.Constraints.err_max_zout[i], ChannelStateToTest[i].zout, max_zout_duty_error, &report_error); + check_another_max_value_int (globals.Flash.zout_min[i], &globals.Constraints.err_max_zout[i], ChannelStateToTest[i].zout, max_zout_duty_error, &report_error); } /* --- check resistance settings --- */ diff --git a/globals.h b/globals.h index 6b2e272..7aafe73 100644 --- a/globals.h +++ b/globals.h @@ -884,7 +884,7 @@ typedef struct { float err_max_slew[max_channels]; float err_min_load_type[max_channels]; float err_max_load_type[max_channels]; - float err_max_zout[max_channels]; + int err_max_zout[max_channels]; float composite_min_burst_time[max_channels]; /* minimum ever possible gap, taking into account all constraints */ } ConstraintsStruct; -- cgit