From c58e070614790cba63ccb6e39264b14ae5d30371 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 01:38:22 +0900 Subject: ignore jig alarm input on older keypads with 3 alarm inputs --- menus.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'menus.c') diff --git a/menus.c b/menus.c index 331a9be..fa433f7 100644 --- a/menus.c +++ b/menus.c @@ -2832,6 +2832,7 @@ static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower #define Jig_Input 0x08 /* jig open */ int new_button_state; + bool Overload_Alarm, Over_Temp_Alarm, Over_Volt_Alarm, Over_Other_Alarm, Jig_Alarm; /* read the button data */ new_button_state = I2C_Read(PCF8574A+Button_Press_Port); @@ -2867,13 +2868,18 @@ static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower /* reenable encoder */ I2C_Write(PCF8574A+Button_Press_Port,255); + // on all keypads + Overload_Alarm = !(*button_port_val & Overload_Input); + Over_Temp_Alarm = !(*upper_encoder_val & Over_Temp); + Over_Volt_Alarm = !(*upper_encoder_val & Over_Volt); + Over_Other_Alarm = !(*upper_encoder_val & Over_Other); + + // only on newer keypad boards + Jig_Alarm = !(*upper_encoder_val & Jig_Input) && !globals.Flash.older_keypad_3_alarm_pins; + /* alarm condition */ /* valid for both local and remote modes */ - if ( !(*upper_encoder_val & Over_Temp) - || !(*upper_encoder_val & Over_Volt) - || !(*upper_encoder_val & Jig_Input) - || !(*upper_encoder_val & Over_Other) - || !(*button_port_val & Overload_Input) ) { + if (Over_Temp_Alarm || Over_Volt_Alarm || Jig_Alarm || Over_Other_Alarm || Overload_Alarm) { /* disable all outputs immediately */ int outputs_turned_off = 0; @@ -2890,15 +2896,15 @@ static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower /* Report the problem if outputs had to be turned off. */ if ((outputs_turned_off > 0) || globals.Flash.warn_even_if_output_off) { /* flag the problem */ - if (!(*upper_encoder_val & Over_Temp)) { + if (Over_Temp_Alarm) { queue_and_broadcast_sensor_alarm(Overtemp_Detected); - } else if (!(*upper_encoder_val & Over_Volt)) { + } else if (Over_Volt_Alarm) { queue_and_broadcast_sensor_alarm(Overvolt_Detected); - } else if (!(*upper_encoder_val & Jig_Input)) { + } else if (Jig_Alarm) { queue_and_broadcast_sensor_alarm(Jig_Open_Detected); - } else if (!(*upper_encoder_val & Over_Other)) { + } else if (Over_Other_Alarm) { queue_and_broadcast_sensor_alarm(Device_Specific_Aux_Error_Detected); - } else if (!(*button_port_val & Overload_Input)) { + } else if (Overload_Alarm) { queue_and_broadcast_sensor_alarm(Overload_Detected); } } -- cgit