summaryrefslogtreecommitdiff
path: root/error_utils.c
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 04:27:27 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 04:27:27 +0900
commitf96c0cbe62a8eb5bb544a40a6ef4231652829812 (patch)
tree8a64a457cf59b2772920a6dd40f4f54dc963777d /error_utils.c
parent99fa13aa3b871061991a4242d02ee773b75b2458 (diff)
misc fixes to max zout checksINSTRUMENT_6_4_27
Diffstat (limited to 'error_utils.c')
-rw-r--r--error_utils.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/error_utils.c b/error_utils.c
index 22f469e..ccd9837 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -673,6 +673,16 @@ void check_initial_max_value (float test_limit, float *running_limit, float prop
}
}
+
+void check_initial_max_value_int (int test_limit, int *running_limit, int proposed_value, int possible_error, int *actual_error) {
+ *running_limit = test_limit;
+
+ if ( proposed_value > *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 --- */