From 3a7e097b05c1283e2a1dc344799cd3bf9bd96969 Mon Sep 17 00:00:00 2001 From: mjc Date: Thu, 1 Jan 1970 10:36:31 +0900 Subject: Enforce minimum ampl magnitude (based on zero_equiv_ampl) in AVRQ -AHV, -XHV options --- device-functions.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'device-functions.c') diff --git a/device-functions.c b/device-functions.c index 83a384f..51134ff 100644 --- a/device-functions.c +++ b/device-functions.c @@ -4707,6 +4707,12 @@ int number_of_fixed_ampl_points(int channel) } +gboolean non_zero_first_ampl_point (int channel) +{ + return (globals.Flash.ampl_pwl_amp[channel][0][0][0] != 0.0); +} + + float rst_ampl_value (int channel) { // smallest positive value, or zero @@ -4714,8 +4720,16 @@ float rst_ampl_value (int channel) int max; max = number_of_fixed_ampl_points(channel); - if (max == 0) { + if (non_zero_first_ampl_point(channel)) { + + // For AVRQ -AHV, -XHV options, where valids ampls may be + // 1.0 to 1.5 kV, positive or negative + return globals.Flash.ampl_zero_equiv[channel]; + + } else if (max == 0) { + // not a unit that uses a list of fixed amplitudes + // normal scenario if ((globals.Flash.min_ampl[channel] > 0.0) && (globals.Flash.max_ampl[channel] > 0.0)) { // both min and max ampls are positive, range does not include zero. AVR-D4-B. @@ -4727,7 +4741,10 @@ float rst_ampl_value (int channel) // normal unit return 0.0; } + } else { + // a list of fixed amplitudes is used + int i, pos_count, neg_count; pos_count = 0; neg_count = 0; -- cgit