summaryrefslogtreecommitdiff
path: root/menus.c
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 01:38:22 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 01:38:22 +0900
commitc58e070614790cba63ccb6e39264b14ae5d30371 (patch)
tree48d83cbd5bf7c1a96e8148dcd00cfb62d0f01f5c /menus.c
parent6c221c9e3ca75b6e7012e9c15cf69e69e4b2c4c8 (diff)
ignore jig alarm input on older keypads with 3 alarm inputsINSTRUMENT_6_4_38
Diffstat (limited to 'menus.c')
-rw-r--r--menus.c26
1 files changed, 16 insertions, 10 deletions
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);
}
}