From b9033521a24953529ff1905fc918d9d73a70efc4 Mon Sep 17 00:00:00 2001 From: "Ryan@pi02" Date: Wed, 20 Mar 2024 12:42:15 -0400 Subject: [PATCH] add emergency button, update time is 100 msec, database push every 5 sec --- Listen2Arduino.py | 6 +++--- interlock/config.h | 6 +++--- interlock/interlock.ino | 25 ++++++++++++++----------- interlock/map.h | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Listen2Arduino.py b/Listen2Arduino.py index 7a2e2d6..3864f83 100755 --- a/Listen2Arduino.py +++ b/Listen2Arduino.py @@ -38,7 +38,7 @@ input_normal= [ CLOSED, #// 4 Fume hood flow switch OPEN, #// 5 Vacuum condition - gnd CLOSED, #// 6 Tritium monitor - OPEN, #// 7 UNUSED + OPEN, #// 7 Control Room Emergency Switch CLOSED, #// 8 Power failure CLOSED, #// 9 Coolant flow - gnd OPEN, #//10 Vacuum condition - mid @@ -56,7 +56,7 @@ in_txt = [ "Reset Button", #1 "Fume Hood Flow", #4 "Vacuum Gauge 2", #5 "Tritium Monitor", #6 - "error: port map", #7 + "Emergency Switch", #7 "Bldg Power Fail", #8 "Coolant Flow 2", #9 "Vacuum Gauge 1", #10 @@ -75,7 +75,7 @@ in_short_txt = [ "FumeHoodFlow", #4 "VacuumGauge2", #5 "TritiumMonitor", #6 - "NotUsed", #7 + "EmergencySwitch", #7 "BldgPowerFail", #8 "CoolantFlow2", #9 "VacuumGauge1", #10 diff --git a/interlock/config.h b/interlock/config.h index 0157092..50d3dfd 100644 --- a/interlock/config.h +++ b/interlock/config.h @@ -70,7 +70,7 @@ const STATES alarm[16] = { trouble3, // Fume hood flow switch trouble2, // Vacuum condition - gnd trouble3, // Tritium monitor - normal, // UNUSED + trouble3, // Control Room Emergency Switch trouble3, // Power failure trouble3, // Coolant flow - gnd trouble2, // Vacuum condition - mid @@ -96,7 +96,7 @@ bool input_normal[16] = { CLOSED, // 3 , lvl= 3, Fume hood flow switch, level-3 OPEN, // 4 , lvl= 2, Vacuum condition - gnd, level-2 CLOSED, // 5 , lvl= 3, Tritium monitor - OPEN, // 6 , lvl= 0, UNUSED + CLOSED, // 6 , lvl= 3, Control Room Emergency Switch CLOSED, // 7 , lvl= 3, Power failure CLOSED, // 8 , lvl= 2, Coolant flow - gnd OPEN, // 9 , lvl= 2, Vacuum condition - mid @@ -141,7 +141,7 @@ String in_txt[] = { "Reset Button", "Fume Hood Flow", "Vacuum Gauge 2", "Tritium Monitor", - "error: port map", + "Control Room Emergency Switch", "Bldg Power Fail", "Coolant Flow 2", "Vacuum Gauge 1", diff --git a/interlock/interlock.ino b/interlock/interlock.ino index e6e86c1..79b817e 100644 --- a/interlock/interlock.ino +++ b/interlock/interlock.ino @@ -30,8 +30,8 @@ int lcdLooper = 0; int lcdLine2 = 16; // Timer for Serial output -//unsigned long previousMillis = 0; -const unsigned long interval = 5000; // 1000 milliseconds = 1 second +const unsigned long interval = 100; // 1000 milliseconds = 1 second +unsigned int count = 0; /******* *Setup function runs once on startup @@ -97,7 +97,11 @@ void loop() { delay(2000); if (P1.readDiscrete(in1) == CLOSED){ //Reset to normal condition newState = normal; - } + } //unsigned long currentMillis = millis(); + //if (currentMillis - previousMillis >= interval) { + //Serial.print("server is at "); + //Serial.println(Ethernet.localIP()); + } // Check the inputs and update the state @@ -110,11 +114,8 @@ void loop() { // Reset the watchdog timer P1.petWD(); - //unsigned long currentMillis = millis(); - //if (currentMillis - previousMillis >= interval) { - //Serial.print("server is at "); - //Serial.println(Ethernet.localIP()); - + if( count % 50 == 0 ) { + Serial.print("State: "); Serial.print(currentState); Serial.print(";"); @@ -136,9 +137,11 @@ void loop() { Serial.print(";"); } Serial.println(""); - - //previousMillis = currentMillis; // Reset the timer - //} + + count = 0; + + } delay(interval); + count ++; } diff --git a/interlock/map.h b/interlock/map.h index 82eea3d..f1c1157 100644 --- a/interlock/map.h +++ b/interlock/map.h @@ -17,7 +17,7 @@ #define in4 1,4 // Fume hood flow switch #define in5 1,5 // Vacuum condition - gnd #define in6 1,6 // Tritium monitor -#define in7 1,7 // UNUSED +#define in7 1,7 // Control Room Emergency trip #define in8 1,8 // Power failure #define in9 1,9 // Coolant flow - gnd #define in10 1,10 // Vacuum condition - mid