From 26f02996c396c95d690fe399151bbbd3534440cb Mon Sep 17 00:00:00 2001 From: sbman Date: Wed, 1 Jul 2015 17:37:03 -0700 Subject: [PATCH 1/3] Added ability to show currently selected profile Added the ability for the web app to show the currently selected profile upon browser load. Previously the application was showing the wrong profile when loading a new client during a run, and backlog information was shown on top of the incorrect graph. --- public/assets/js/picoreflow.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js index fe4d8ce..7d9f89a 100644 --- a/public/assets/js/picoreflow.js +++ b/public/assets/js/picoreflow.js @@ -426,6 +426,11 @@ $(document).ready(function() if (x.profile) { selected_profile_name = x.profile.name; + $.each(profiles, function(i,v) { + if(v.name == x.profile.name) { + updateProfile(i); + $('#e2').select2('val', i); + }); } $.each(x.log, function(i,v) { From 19d65914ef3c26484145bda227f997b193a65508 Mon Sep 17 00:00:00 2001 From: sbman Date: Wed, 1 Jul 2015 17:40:23 -0700 Subject: [PATCH 2/3] Corrected missing brace --- public/assets/js/picoreflow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js index 7d9f89a..82c3972 100644 --- a/public/assets/js/picoreflow.js +++ b/public/assets/js/picoreflow.js @@ -430,6 +430,7 @@ $(document).ready(function() if(v.name == x.profile.name) { updateProfile(i); $('#e2').select2('val', i); + } }); } From 00ed33b0028ea1410e29c60aa344193fe6a406c8 Mon Sep 17 00:00:00 2001 From: sbman Date: Thu, 2 Jul 2015 10:47:34 -0700 Subject: [PATCH 3/3] Added non responsive sensor emergency stop Added an 'emergency stop' feature to stop a run if the temperature sensor is no longer providing data. If the temperature sensor values are remaining stable and exactly the same for 20 time cycles consecutively while the heat is on, the run is reset to prevent damage to the part or the oven. --- lib/oven.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/oven.py b/lib/oven.py index 24c010f..a294a99 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -86,6 +86,8 @@ class Oven (threading.Thread): self.reset() def run(self): + temperature_count = 0 + last_temp = 0 while True: self.door = self.get_door_state() @@ -102,8 +104,24 @@ class Oven (threading.Thread): log.info("pid: %.3f" % pid) self.set_cool(pid <= -1) + if(pid > 0): + # The temp should be changing with the heat on + # Count the number of time_steps encountered with no change and the heat on + if last_temp == self.temp_sensor.temperature: + temperature_count += 1 + else: + temperature_count = 0 + # If the heat is on and nothing is changing, reset + # The direction or amount of change does not matter + # This prevents runaway in the event of a sensor read failure + if temperature_count > 20: + log.info("Error reading sensor, oven temp not responding to heat.") + self.reset() + else: + temperature_count = 0 + self.set_heat(pid > 0) - + #if self.profile.is_rising(self.runtime): # self.set_cool(False) # self.set_heat(self.temp_sensor.temperature < self.target) @@ -119,6 +137,9 @@ class Oven (threading.Thread): if self.runtime >= self.totaltime: self.reset() + #Capture the last temperature value + last_temp = self.temp_sensor.temperature + time.sleep(self.time_step) def set_heat(self, value):