summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 02:04:28 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 02:04:28 +0900
commit3a3c23a5716695949a1c07cb44d01351128811bd (patch)
tree2eeccbbbf278708008f3e7c2152a8c8583a38ef5
parente5eda38a5b7debedb7a3f186424de4d7204be3e0 (diff)
ignore tiniest encoder steps
-rw-r--r--device-functions.c6
-rw-r--r--menus.c44
-rw-r--r--menus.h2
-rw-r--r--parser.c2
4 files changed, 32 insertions, 22 deletions
diff --git a/device-functions.c b/device-functions.c
index e286317..5fca2e5 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -224,7 +224,7 @@ void Main_Rst (void)
// reset all transient flags
globals.Flags = globals.DefaultFlags;
- Menu_Clear_Buttons();
+ Menu_Clear_Buttons(YES);
}
@@ -4184,7 +4184,7 @@ int do_full_self_cal(CalStruct *caldata)
caldata->response = g_string_new ("");
- Menu_Clear_Buttons();
+ Menu_Clear_Buttons(YES);
string = g_strdup_printf ("Self-calibration in progress - typical run time: %d min, %d sec. To skip, power off 60 sec, then power back on.",
globals.Flash.self_cal_typical_time_min,
@@ -4507,7 +4507,7 @@ void Set_Rcl(int setting_num)
}
- Menu_Clear_Buttons();
+ Menu_Clear_Buttons(YES);
globals.Flags.do_check_settings=YES; /* check for conflicting settings */
diff --git a/menus.c b/menus.c
index 8367650..52c6c3f 100644
--- a/menus.c
+++ b/menus.c
@@ -2296,17 +2296,25 @@ static int Submenu_Mult_Value(float mult_by)
static void Submenu_Service_Encoder(int encoder_change)
{
-
int error_num;
int equivalent_integer; /* non-exponent part stripped of its decimal point */
float new_value; /* new parameter value to be loaded */
float abs_Submenu_Value; /* absolute value of Submenu_Value */
int increment_size;
int new_int_value;
- int reset_encoder;
int channel;
- reset_encoder=YES;
+ // need an encoder change of at least 2 to do anything
+ if (abs(encoder_change) <= 1) {
+ Menu_Clear_Buttons(FALSE);
+ return;
+ }
+ else if (encoder_change > 0) {
+ --encoder_change;
+ } else {
+ ++encoder_change;
+ }
+
/* quit if RWLS mode */
update_remote_mode ();
@@ -2376,7 +2384,6 @@ static void Submenu_Service_Encoder(int encoder_change)
{
g_usleep (2e5);
- reset_encoder=YES; /* to avoid extra unwanted increments */
if (encoder_change>0) {
new_int_value=(int) (Submenu_Value + 1.0);
if (new_int_value>30) {
@@ -2394,7 +2401,6 @@ static void Submenu_Service_Encoder(int encoder_change)
{
g_usleep (2e5);
- reset_encoder=YES; /* to avoid extra unwanted increments */
new_int_value=(int) (Submenu_Value);
#define LARGE_CHANGE 3
@@ -2431,7 +2437,6 @@ static void Submenu_Service_Encoder(int encoder_change)
((Submenu_Numeric_Parameter-channel) == Show_route_secondary) ) {
g_usleep (2e5);
- reset_encoder=YES; /* to avoid extra unwanted increments */
new_int_value=(int) (Submenu_Value);
if (encoder_change>0) {
@@ -2734,9 +2739,7 @@ static void Submenu_Service_Encoder(int encoder_change)
last_encoder_adjust_error=error_num;
- if (reset_encoder) {
- Menu_Clear_Buttons();
- }
+ Menu_Clear_Buttons(TRUE);
return;
}
@@ -2744,7 +2747,7 @@ static void Submenu_Service_Encoder(int encoder_change)
static void Nonstd_menu_default_rs232(void)
{
- Menu_Clear_Buttons();
+ Menu_Clear_Buttons(TRUE);
LCD_clear(); /*0123456789012345678901234567890123456789*/
LCD_write(0,0,"The RS232 settings are now: 1200 baud,");
@@ -2754,7 +2757,7 @@ static void Nonstd_menu_default_rs232(void)
IO_Setup_RS232(1200, 1);
- Menu_Clear_Buttons();
+ Menu_Clear_Buttons(TRUE);
globals.MenuStatus.Nonstd_Display=YES;
}
@@ -2773,12 +2776,24 @@ static void Nonstd_menu_model_info(void)
}
-void Menu_Clear_Buttons(void)
+static void Reset_Encoder ()
+{
+ /* reset encoder-monitoring by presetting counters to mid range */
+ I2C_Write(PCF8574A+Upper_Encoder_Port,127);
+ I2C_Write(PCF8574A+Upper_Encoder_Port,255);
+}
+
+
+void Menu_Clear_Buttons(int reset_encoder)
{
int dummy1,dummy2,dummy3;
/* enable interrupt lines */
Read_Keypad(&dummy1,&dummy2,&dummy3);
+
+ if (reset_encoder) {
+ Reset_Encoder();
+ }
}
@@ -2825,11 +2840,6 @@ static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower
/* reenable encoder */
I2C_Write(PCF8574A+Button_Press_Port,255);
- /* reset encoder-monitoring by presetting counters to mid range */
- I2C_Write(PCF8574A+Upper_Encoder_Port,127);
- I2C_Write(PCF8574A+Upper_Encoder_Port,255);
-
-
/* alarm condition */
/* valid for both local and remote modes */
if ( !(*upper_encoder_val & Over_Temp)
diff --git a/menus.h b/menus.h
index 7952752..e35b0d2 100644
--- a/menus.h
+++ b/menus.h
@@ -2,5 +2,5 @@
void Update_Main_Menu_If_Visible(void);
void Show_Main_Menu(void);
-void Menu_Clear_Buttons(void);
+void Menu_Clear_Buttons(int reset_encoder);
void Menu_Check_Buttons(void);
diff --git a/parser.c b/parser.c
index 684a46c..5c66167 100644
--- a/parser.c
+++ b/parser.c
@@ -3767,7 +3767,7 @@ static int Go_eprom_sus_93(gchar** response, int channel, char *parameter,int co
return SyntaxError;
}
- Menu_Clear_Buttons();
+ Menu_Clear_Buttons(YES);
return OK;
break;