summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c19
1 files changed, 18 insertions, 1 deletions
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;