summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 01:50:34 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 01:50:34 +0900
commit10a8d96cc8c5dd44a68c2ce70b29534a72091b70 (patch)
treeef1e8e4ad5636983e18bea22aa0fe6a1a580b75f /monitor.c
parentf1454040ac26cebde1ab007b90d3b475e39ca6da (diff)
make max step size deviation configurableINSTRUMENT_6_4_08b
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/monitor.c b/monitor.c
index 4c14bf8..41e5403 100644
--- a/monitor.c
+++ b/monitor.c
@@ -155,7 +155,7 @@ int I2C_Get_Monitor_Word(int channel)
int I2C_Check_Monitors(void)
{
int monitor_word;
- float new_val, avg_val, step_size;
+ float new_val, avg_val, step_size, max_dev_in_steps;
int channel;
int ampl_range,point_found,UseNegData,entry,word_out,atten_range;
@@ -218,8 +218,10 @@ int I2C_Check_Monitors(void)
step_size=globals.Flash.monitor_step[channel];
- /* reset average if change is bigger than MAX_STEP_DEV_FROM_AVG steps */
- if (fabs((new_val-avg_val)/step_size) > MAX_STEP_DEV_FROM_AVG) {
+ /* reset average if change is bigger than DEFAULT_MAX_STEP_DEV_FROM_AVG steps */
+
+ max_dev_in_steps = MAX(globals.Flash.max_mon_steps_before_reset_average[channel], DEFAULT_MAX_STEP_DEV_FROM_AVG);
+ if (fabs((new_val-avg_val)/step_size) > max_dev_in_steps) {
globals.ChannelState[channel].num_mon_vals = 1;
avg_val = new_val;
}