From 65890b9f4a9c943e2dfb12a57d0e6bf58cf486eb Mon Sep 17 00:00:00 2001
From: Juliano Murari <juliano.murari@ess.eu>
Date: Fri, 29 Jul 2022 12:07:11 +0200
Subject: [PATCH] Add auto flattop

---
 99-Shared/adsis8300bcm/acct_m.bob | 258 +++++++++++++++++++-----------
 1 file changed, 164 insertions(+), 94 deletions(-)

diff --git a/99-Shared/adsis8300bcm/acct_m.bob b/99-Shared/adsis8300bcm/acct_m.bob
index 6867ddd..e776eae 100644
--- a/99-Shared/adsis8300bcm/acct_m.bob
+++ b/99-Shared/adsis8300bcm/acct_m.bob
@@ -1226,7 +1226,7 @@ pvs[1].setValue(dec)]]></text>
     <x>40</x>
     <y>354</y>
     <width>119</width>
-    <height>21</height>
+    <height>25</height>
     <auto_size>true</auto_size>
   </widget>
   <widget type="slide_button" version="2.0.0">
@@ -1235,8 +1235,8 @@ pvs[1].setValue(dec)]]></text>
     <label>Baseline Correction</label>
     <x>40</x>
     <y>378</y>
-    <width>174</width>
-    <height>21</height>
+    <width>175</width>
+    <height>25</height>
     <auto_size>true</auto_size>
   </widget>
   <widget type="slide_button" version="2.0.0">
@@ -1246,7 +1246,7 @@ pvs[1].setValue(dec)]]></text>
     <x>40</x>
     <y>402</y>
     <width>117</width>
-    <height>21</height>
+    <height>25</height>
     <auto_size>true</auto_size>
   </widget>
   <widget type="slide_button" version="2.0.0">
@@ -1255,8 +1255,8 @@ pvs[1].setValue(dec)]]></text>
     <label>Droop Compensation</label>
     <x>40</x>
     <y>426</y>
-    <width>186</width>
-    <height>21</height>
+    <width>187</width>
+    <height>25</height>
     <auto_size>true</auto_size>
   </widget>
   <widget type="textupdate" version="2.0.0">
@@ -1616,7 +1616,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>640</y>
     <width>199</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1636,7 +1636,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>616</y>
     <width>144</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1656,7 +1656,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>592</y>
     <width>85</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1676,7 +1676,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>568</y>
     <width>85</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1696,7 +1696,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>544</y>
     <width>85</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1711,11 +1711,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_11</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmLimit</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>635</y>
     <width>70</width>
@@ -1724,11 +1724,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_10</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmTrigger</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>611</y>
     <width>70</width>
@@ -1737,11 +1737,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_9</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmErrant</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>587</y>
     <width>70</width>
@@ -1750,11 +1750,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_8</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmLower</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>563</y>
     <width>70</width>
@@ -1763,11 +1763,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_7</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmUpper</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>539</y>
     <width>70</width>
@@ -1865,11 +1865,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_16</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmChargeTooHigh</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>683</y>
     <width>70</width>
@@ -1878,11 +1878,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_14</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmAiuFault</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>659</y>
     <width>70</width>
@@ -1896,7 +1896,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>760</y>
     <width>112</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1916,7 +1916,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>736</y>
     <width>145</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1936,7 +1936,7 @@ pvs[1].setValue(dec)]]></text>
     <x>37</x>
     <y>712</y>
     <width>135</width>
-    <height>21</height>
+    <height>25</height>
     <off_color>
       <color red="0" green="255" blue="0">
       </color>
@@ -1951,11 +1951,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_15</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmAdcStuck</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>755</y>
     <width>70</width>
@@ -1964,11 +1964,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_13</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmAdcUnderflow</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>731</y>
     <width>70</width>
@@ -1977,11 +1977,11 @@ pvs[1].setValue(dec)]]></text>
   </widget>
   <widget type="embedded" version="2.0.0">
     <name>Embedded Display_12</name>
-    <file>ml.bob</file>
     <macros>
       <ML>AlarmAdcOverflow</ML>
       <PVin>$(P)$(R)$(ID)</PVin>
     </macros>
+    <file>ml.bob</file>
     <x>370</x>
     <y>707</y>
     <width>70</width>
@@ -2239,76 +2239,6 @@ pvs[1].setValue(dec)]]></text>
     <vertical_alignment>1</vertical_alignment>
     <wrap_words>false</wrap_words>
   </widget>
-  <widget type="textentry" version="3.0.0">
-    <name>Text Input_14</name>
-    <pv_name>$(P)$(R)$(ID)FlatTopEnd</pv_name>
-    <x>575</x>
-    <y>1037</y>
-    <width>80</width>
-    <height>30</height>
-    <format>1</format>
-    <show_units>false</show_units>
-    <actions>
-    </actions>
-    <border_alarm_sensitive>false</border_alarm_sensitive>
-    <border_color>
-      <color red="0" green="128" blue="255">
-      </color>
-    </border_color>
-  </widget>
-  <widget type="textupdate" version="2.0.0">
-    <name>Text Update_92</name>
-    <pv_name>$(P)$(R)$(ID)FlatTopEndR</pv_name>
-    <x>666</x>
-    <y>1037</y>
-    <width>80</width>
-    <height>30</height>
-    <format>1</format>
-    <horizontal_alignment>1</horizontal_alignment>
-    <vertical_alignment>1</vertical_alignment>
-    <wrap_words>false</wrap_words>
-    <actions>
-    </actions>
-    <border_color>
-      <color red="0" green="128" blue="255">
-      </color>
-    </border_color>
-  </widget>
-  <widget type="textentry" version="3.0.0">
-    <name>Text Input_13</name>
-    <pv_name>$(P)$(R)$(ID)FlatTopStart</pv_name>
-    <x>575</x>
-    <y>997</y>
-    <width>80</width>
-    <height>30</height>
-    <format>1</format>
-    <show_units>false</show_units>
-    <actions>
-    </actions>
-    <border_alarm_sensitive>false</border_alarm_sensitive>
-    <border_color>
-      <color red="0" green="128" blue="255">
-      </color>
-    </border_color>
-  </widget>
-  <widget type="textupdate" version="2.0.0">
-    <name>Text Update_91</name>
-    <pv_name>$(P)$(R)$(ID)FlatTopStartR</pv_name>
-    <x>666</x>
-    <y>997</y>
-    <width>80</width>
-    <height>30</height>
-    <format>1</format>
-    <horizontal_alignment>1</horizontal_alignment>
-    <vertical_alignment>1</vertical_alignment>
-    <wrap_words>false</wrap_words>
-    <actions>
-    </actions>
-    <border_color>
-      <color red="0" green="128" blue="255">
-      </color>
-    </border_color>
-  </widget>
   <widget type="label" version="2.0.0">
     <name>BGGrey02-title_23</name>
     <text>Lower Thr. En. Wnd.</text>
@@ -2899,4 +2829,144 @@ pvs[1].setValue(dec)]]></text>
     <corner_width>5</corner_width>
     <corner_height>5</corner_height>
   </widget>
+  <widget type="slide_button" version="2.0.0">
+    <name>Slide Button_14</name>
+    <pv_name>$(P)$(R)$(ID)AutoFlatTopEnable</pv_name>
+    <label></label>
+    <x>514</x>
+    <y>970</y>
+    <width>43</width>
+    <height>25</height>
+    <auto_size>true</auto_size>
+  </widget>
+  <widget type="label" version="2.0.0">
+    <name>Label_358</name>
+    <text>Auto</text>
+    <x>517</x>
+    <y>945</y>
+    <width>48</width>
+    <height>30</height>
+    <vertical_alignment>1</vertical_alignment>
+    <wrap_words>false</wrap_words>
+    <actions>
+    </actions>
+    <border_color>
+      <color red="0" green="128" blue="255">
+      </color>
+    </border_color>
+  </widget>
+  <widget type="textentry" version="3.0.0">
+    <name>Text Input_13</name>
+    <pv_name>$(P)$(R)$(ID)FlatTopStart</pv_name>
+    <x>575</x>
+    <y>997</y>
+    <width>80</width>
+    <height>30</height>
+    <format>1</format>
+    <show_units>false</show_units>
+    <actions>
+    </actions>
+    <rules>
+      <rule name="update_auto_mode" prop_id="pv_name" out_exp="false">
+        <exp bool_exp="pv0=0">
+          <value>$(P)$(R)$(ID)FlatTopStart</value>
+        </exp>
+        <exp bool_exp="pv0=1">
+          <value>$(P)$(R)$(ID)AutoFlatTopStart</value>
+        </exp>
+        <pv_name>$(P)$(R)$(ID)AutoFlatTopEnable</pv_name>
+      </rule>
+    </rules>
+    <border_alarm_sensitive>false</border_alarm_sensitive>
+    <border_color>
+      <color red="0" green="128" blue="255">
+      </color>
+    </border_color>
+  </widget>
+  <widget type="textentry" version="3.0.0">
+    <name>Text Input_14</name>
+    <pv_name>$(P)$(R)$(ID)FlatTopEnd</pv_name>
+    <x>575</x>
+    <y>1037</y>
+    <width>80</width>
+    <height>30</height>
+    <format>1</format>
+    <show_units>false</show_units>
+    <actions>
+    </actions>
+    <rules>
+      <rule name="update_auto_mode" prop_id="pv_name" out_exp="false">
+        <exp bool_exp="pv0=0">
+          <value>$(P)$(R)$(ID)FlatTopEnd</value>
+        </exp>
+        <exp bool_exp="pv0=1">
+          <value>$(P)$(R)$(ID)AutoFlatTopEnd</value>
+        </exp>
+        <pv_name>$(P)$(R)$(ID)AutoFlatTopEnable</pv_name>
+      </rule>
+    </rules>
+    <border_alarm_sensitive>false</border_alarm_sensitive>
+    <border_color>
+      <color red="0" green="128" blue="255">
+      </color>
+    </border_color>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_92</name>
+    <pv_name>$(P)$(R)$(ID)FlatTopEndR</pv_name>
+    <x>666</x>
+    <y>1037</y>
+    <width>80</width>
+    <height>30</height>
+    <format>1</format>
+    <horizontal_alignment>1</horizontal_alignment>
+    <vertical_alignment>1</vertical_alignment>
+    <wrap_words>false</wrap_words>
+    <actions>
+    </actions>
+    <rules>
+      <rule name="update_auto_mode" prop_id="pv_name" out_exp="false">
+        <exp bool_exp="pv0=0">
+          <value>$(P)$(R)$(ID)FlatTopEndR</value>
+        </exp>
+        <exp bool_exp="pv0=1">
+          <value>$(P)$(R)$(ID)AutoFlatTopEndR</value>
+        </exp>
+        <pv_name>$(P)$(R)$(ID)AutoFlatTopEnable</pv_name>
+      </rule>
+    </rules>
+    <border_color>
+      <color red="0" green="128" blue="255">
+      </color>
+    </border_color>
+  </widget>
+  <widget type="textupdate" version="2.0.0">
+    <name>Text Update_91</name>
+    <pv_name>$(P)$(R)$(ID)FlatTopStartR</pv_name>
+    <x>666</x>
+    <y>997</y>
+    <width>80</width>
+    <height>30</height>
+    <format>1</format>
+    <horizontal_alignment>1</horizontal_alignment>
+    <vertical_alignment>1</vertical_alignment>
+    <wrap_words>false</wrap_words>
+    <actions>
+    </actions>
+    <rules>
+      <rule name="update_auto_mode" prop_id="pv_name" out_exp="false">
+        <exp bool_exp="pv0=0">
+          <value>$(P)$(R)$(ID)FlatTopStartR</value>
+        </exp>
+        <exp bool_exp="pv0=1">
+          <value>$(P)$(R)$(ID)AutoFlatTopStartR</value>
+        </exp>
+        <pv_name>$(P)$(R)$(ID)AutoFlatTopEnable</pv_name>
+      </rule>
+    </rules>
+    <border_color>
+      <color red="0" green="128" blue="255">
+      </color>
+    </border_color>
+  </widget>
 </display>
-- 
GitLab