From a64cf447ef5a6f2701ae736ab07abf4e0807102a Mon Sep 17 00:00:00 2001
From: jwikmark <jacob@wikmark.se>
Date: Wed, 14 Mar 2018 13:40:54 +0100
Subject: [PATCH] turning off I resets it

---
 src/tanklabgui.jl | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/tanklabgui.jl b/src/tanklabgui.jl
index 41019d1..1ea274a 100644
--- a/src/tanklabgui.jl
+++ b/src/tanklabgui.jl
@@ -27,9 +27,9 @@ function makegui(P, run_process, plottingframerate = 10, guiframerate = 10)
         u      in slider(0:0.01:1, label=" um"),
         run    in button("Run"), #This should only exist in the simulated version
         cali   in button("Calibrate"),
-        K      in slider(0:0.1:50, label="K"),
-        Ti     in slider(0:0.1:50, label="Ti"),
-        Td     in slider(0:0.1:50, label="Td"),
+        K      in slider(0:0.1:30, label="K"),
+        Ti     in slider(0:0.1:30, label="Ti"),
+        Td     in slider(0:0.1:30, label="Td"),
         mode   in togglebuttons(["Manual", "Automatic"], label=""),
         tankno in togglebuttons(["Upper", "Lower"], label=""),
         pOn    in togglebuttons(["On", "Off"], label="P"),
@@ -117,6 +117,12 @@ function makegui(P, run_process, plottingframerate = 10, guiframerate = 10)
         end
     end
 
+    on(observe(iOn)) do val
+        if val=="Off"
+            tankpid.I = 0
+        end
+    end
+
     # Below is the construction of the gui DOM
     LabGUI.set!(gui, widgets)
     add!(gui, rcont)
-- 
GitLab