diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2019-07-16 10:04:34 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2019-07-16 10:04:34 -0400 |
commit | 86399ac53208b655ddb7a6cd8b1047e6d2a7a559 (patch) | |
tree | 403251bc596927be8abd959ecfbeb5ec102ecf97 /error_utils.c | |
parent | a0bf8d3c1e1a9b0c8dfa9c82c34e13f40ffc7a15 (diff) |
forward port of avg_error calc divide-by-zero fix from AVR-8A-B-P-QTKB repair
Diffstat (limited to 'error_utils.c')
-rw-r--r-- | error_utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/error_utils.c b/error_utils.c index cc08a3f..5edea83 100644 --- a/error_utils.c +++ b/error_utils.c @@ -913,7 +913,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) check_another_max_value (temp, &globals.Constraints.err_max_freq[i], ChannelStateToTest[i].frequency, HVPS_Current_Too_High, &report_error); } - if (globals.Flash.max_avg_power[i] > 0.0) { + if ((globals.Flash.max_avg_power[i] > 0.0) && (fabs(ChannelStateToTest[i].amplitude) > 0.0)) { temp = (globals.Flash.max_avg_power[i] * ChannelStateToTest[i].load_type) / (ChannelStateToTest[i].amplitude * ChannelStateToTest[i].amplitude * ChannelStateToTest[i].pw); check_another_max_value (temp, &globals.Constraints.err_max_freq[i], ChannelStateToTest[i].frequency, average_power_limit, &report_error); } @@ -977,7 +977,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) &globals.Constraints.err_max_pw[i], ChannelStateToTest[i].pw, HVPS_Current_Too_High, &report_error); } - if (globals.Flash.max_avg_power[i] > 0.0) { + if ((globals.Flash.max_avg_power[i] > 0.0) && (fabs(ChannelStateToTest[i].amplitude) > 0.0)) { check_another_max_value (globals.Flash.max_avg_power[i] * ChannelStateToTest[i].load_type / (ChannelStateToTest[i].amplitude * ChannelStateToTest[i].amplitude * ChannelStateToTest[i].frequency), &globals.Constraints.err_max_pw[i], ChannelStateToTest[i].pw, average_power_limit, &report_error); |