summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flash.c2
-rw-r--r--globals.h6
-rw-r--r--menus.c2
-rw-r--r--monitor.c8
4 files changed, 12 insertions, 6 deletions
diff --git a/flash.c b/flash.c
index 687169c..d17cafa 100644
--- a/flash.c
+++ b/flash.c
@@ -887,6 +887,8 @@ static void initFlashValues(FlashStruct *mem)
mem->cap_for_pw_rc_limit[i] = 0.0;
mem->hvps_avg_curr_limit[i] = 0.0;
+
+ mem->max_mon_steps_before_reset_average[i] = DEFAULT_MAX_STEP_DEV_FROM_AVG;
}
mem->relay_delay_in_sec=0.5;
diff --git a/globals.h b/globals.h
index 85d81d4..f8379ee 100644
--- a/globals.h
+++ b/globals.h
@@ -351,7 +351,7 @@ typedef struct {
#define CURR_MON_MAX_OLD_COUNTS 50 // monitor readings are around 50/sec, average over one second
-#define MAX_STEP_DEV_FROM_AVG 5 // reset monitor average if more than N steps difference
+#define DEFAULT_MAX_STEP_DEV_FROM_AVG 5 // reset monitor average if more than N steps difference
typedef struct {
float frequency; /* the global frequency variable */
@@ -830,7 +830,9 @@ typedef struct {
float cap_for_pw_rc_limit[max_channels]; // size 8, addr 37396 - for AVR-8F-B
float hvps_avg_curr_limit[max_channels]; // size 8, addr 37404 - for AVR-8F-B
- char flash_end; // addr 37412
+ float max_mon_steps_before_reset_average[max_channels]; // size 8, addr 37412 - 5 steps for AVO-8E3, maybe more for 156A?
+
+ char flash_end; // addr 37420
} FlashStruct;
#pragma pack(pop)
diff --git a/menus.c b/menus.c
index 419e7e0..058d77c 100644
--- a/menus.c
+++ b/menus.c
@@ -2810,7 +2810,7 @@ static void Nonstd_menu_default_rs232(void)
static void Nonstd_menu_model_info(void)
{
- gchar *message = g_strdup_printf ("Avtech Electrosystems Ltd., since 1975. Model %s, S/N %s, FW v%s.",
+ gchar *message = g_strdup_printf ("Avtech Electrosystems Ltd., Model %s, S/N %s, FW v%s. Since 1975.",
globals.Flash.model_num,
globals.Flash.serial_num,
globals.HWDetect.firmware);
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;
}