diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2013-10-02 11:27:39 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2013-10-02 11:27:39 -0400 |
commit | e1678aa56d0d1deaf003e0a04f09d26000d9eca5 (patch) | |
tree | 38364da8bc2b3a7402c60f5d22f0749e2755245b /error_utils.c | |
parent | 4f2926c5b5f396200ea5cc521ba1d2f622de5119 (diff) |
added chans_opposite_polarities for AVR-D3-B-MS1 error checking
Diffstat (limited to 'error_utils.c')
-rw-r--r-- | error_utils.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/error_utils.c b/error_utils.c index 503724d..718c40b 100644 --- a/error_utils.c +++ b/error_utils.c @@ -647,6 +647,21 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } } + float real_max_ampl[max_channels]; + float real_min_ampl[max_channels]; + for (i=0; i<max_channels; i++) { + real_max_ampl[i]=globals.Flash.max_ampl[i]; + real_min_ampl[i]=globals.Flash.min_ampl[i]; + } + + // handle AVR-D3-B-MS1, where the two channels must have opposite polarities + if ( (globals.Flash.channels==2) && globals.Flash.chans_opposite_polarities && globals.Flash.ChanKey_amplitude) { + if (ChannelStateToTest[0].amplitude > 0.0) { + real_max_ampl[1] = 0.0; + } else { + real_min_ampl[1]= 0.0; + } + } for (i=0; (i<num_of_chan) && !early_quit; ++i) { /* Must be changing a setting */ @@ -1048,7 +1063,7 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* --- check minimum amplitude --- */ - globals.Constraints.err_min_ampl[i]=globals.Flash.min_ampl[i]; + globals.Constraints.err_min_ampl[i]=real_min_ampl[i]; if ( (globals.Constraints.err_min_ampl[i]>=0.0 && ChannelStateToTest[i].amplitude<(0.999*globals.Constraints.err_min_ampl[i])) || (globals.Constraints.err_min_ampl[i]<0.0 && ChannelStateToTest[i].amplitude<(1.001*globals.Constraints.err_min_ampl[i])) ) { @@ -1083,7 +1098,8 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* --- check maximum amplitude --- */ - globals.Constraints.err_max_ampl[i]=globals.Flash.max_ampl[i]; + globals.Constraints.err_max_ampl[i]=real_max_ampl[i]; + if ( (globals.Constraints.err_max_ampl[i]>=0.0 && ChannelStateToTest[i].amplitude>(1.001*globals.Constraints.err_max_ampl[i])) || (globals.Constraints.err_max_ampl[i]<0.0 && ChannelStateToTest[i].amplitude>(0.999*globals.Constraints.err_max_ampl[i])) ) { report_error=amplitude_upper_limit; |