Forráskód Böngészése

add efem lock UI, add gold power set simulator

chenzk 2 hónapja%!(EXTRA string=óta)
szülő
commit
5df7250a7f

+ 8 - 0
CyberX8_MainPages/ViewModels/EfemViewModel.cs

@@ -141,6 +141,7 @@ namespace CyberX8_MainPages.ViewModels
 
         private double _vacuumValue;
         private bool _doorUnlock;
+        private bool _isDoorLocked;
         #endregion
 
         #region 属性
@@ -569,6 +570,11 @@ namespace CyberX8_MainPages.ViewModels
             get { return _doorUnlock; }
             set { SetProperty(ref _doorUnlock,value); }
         }
+        public bool IsDoorLocked
+        {
+            get { return _isDoorLocked; }
+            set { SetProperty(ref _isDoorLocked, value); }
+        }
         #endregion
 
         #region 命令
@@ -1179,6 +1185,7 @@ namespace CyberX8_MainPages.ViewModels
 
                 VacuumValue = CommonFunction.GetValue<double>(RtDataValues, "EFEM.VacuumValue");
                 DoorUnlock = CommonFunction.GetValue<bool>(RtDataValues, "EFEM.DoorUnlock");
+                IsDoorLocked = CommonFunction.GetValue<bool>(RtDataValues, "EFEM.DoorLocked");
             }
             RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
 
@@ -1249,6 +1256,7 @@ namespace CyberX8_MainPages.ViewModels
 
             m_RtDataKeys.Add("EFEM.VacuumValue");
             m_RtDataKeys.Add("EFEM.DoorUnlock");
+            m_RtDataKeys.Add("EFEM.DoorLocked");
         }
         /// <summary>
         /// Robot位置信息变更(动画)

+ 6 - 5
CyberX8_MainPages/Views/EfemView.xaml

@@ -125,17 +125,18 @@
         <userControls:DummyCassette Canvas.Left="751" Canvas.Top="272" RotateTransformValue="180" Width="100" Height="100" HorizontalAlignment="Left" VerticalAlignment="Center"/>
         <TextBlock Canvas.Top="142" Canvas.Left="670" Text="Dummy" HorizontalAlignment="Center" Margin="0,5,0,0" FontSize="16">
         </TextBlock>
-        <GroupBox Header="" Background="{DynamicResource Table_BG_Content}" Width="500" Height="70" Canvas.Left="1020" Canvas.Top="464" HorizontalAlignment="Center" VerticalAlignment="Top">
+        <GroupBox Header="" Background="{DynamicResource Table_BG_Content}" Width="500" Height="70" Canvas.Left="1020" Canvas.Top="454" HorizontalAlignment="Center" VerticalAlignment="Top">
             <Grid>
                 <TextBlock Margin="20,0,0,0" Text="Vacuum" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" />
                 <TextBlock Margin="100,0,0,0" Text="{Binding VacuumValue}" HorizontalAlignment="Left" FontSize="14" VerticalAlignment="Center"/>
             </Grid>
         </GroupBox>
-        <GroupBox Header="Door" Background="{DynamicResource Table_BG_Content}" Width="500" Height="70" Canvas.Left="1020" Canvas.Top="541" HorizontalAlignment="Center" VerticalAlignment="Top">
+        <GroupBox Header="Door" Background="{DynamicResource Table_BG_Content}" Width="500" Height="70" Canvas.Left="1020" Canvas.Top="525" HorizontalAlignment="Center" VerticalAlignment="Top">
             <Grid>
-                <Ellipse Width="16" Height="16"  Fill="{Binding DoorUnlock, Converter={StaticResource boolToColor}}"   Stroke="Silver" Margin="76,18,396,14"/>
-                <customControls:PathButton Content="Open" Height="33" Width="120"  Command="{Binding DoorUnlockCommand}" Margin="124,10,244,5"/>
-                <customControls:PathButton Content="Clock" Height="33" Width="120" Margin="309,10,59,5" Command="{Binding DoorLockCommand}"/>
+                <Ellipse Width="16" Height="16"  Fill="{Binding DoorUnlock, Converter={StaticResource boolToColor}}"   Stroke="Silver" Margin="40,18,432,14"/>
+                <customControls:PathButton Content="Open" Height="33" Width="120"  Command="{Binding DoorUnlockCommand}" Margin="91,10,277,5"/>
+                <customControls:PathButton Content="Clock" Height="33" Width="120" Margin="262,10,106,5" Command="{Binding DoorLockCommand}"/>
+                <userControls:LockControl HorizontalAlignment="Left" VerticalAlignment="Top" Margin="442,11,0,0" IsLocked="{Binding IsDoorLocked}"/>
             </Grid>
         </GroupBox>
         <Grid Canvas.Top="253" Canvas.Left="1020" Width="500" HorizontalAlignment="Center" VerticalAlignment="Top">

+ 1 - 0
CyberX8_RT/Modules/Reservoir/StandardHotReservoirInitializeRoutine.cs

@@ -652,6 +652,7 @@ namespace CyberX8_RT.Modules.Reservoir
                 _isRegulatePump = true;
             }
             _reservoirDevice = DEVICE.GetDevice<StandardHotReservoirDevice>(Module.ToString());
+            _reservoirDevice.ClearErrorLogSet(Module);
             _recipe = _reservoirDevice.Recipe;
             if (!(objs[1] is null))
             {

+ 29 - 6
CyberX8_Simulator/Devices/PowerSupplierSocketSimulator.cs

@@ -22,6 +22,9 @@ namespace CyberX8_Simulator.Devices
         private const short POWER_CONTROL_ADDRESS = 0x0113;
         private const short STEP_PERIOD_ADDRESS = 0x1400;
         private const short STEP_PERIOD_START_ADDRESS = 0x1640;
+        private const short GOLD_CURRENT_SETTING_ADDRESS = 0x6102;
+        private const short GOLD_STEP_PERIOD_ADDRESS = 0x77D0;
+
         /// <summary>
         /// 电源状态(00-cv输出,01-cc输出)
         /// </summary>
@@ -39,6 +42,7 @@ namespace CyberX8_Simulator.Devices
         private DateTime _currentTime = DateTime.Now;
 
         private System.Timers.Timer _timer;
+        private byte[] _powerSupplierSetPoint = new byte[4];//记录每次设置的电流值
 
         public PowerSupplierSocketSimulator(int port):base(port)
         {
@@ -134,6 +138,11 @@ namespace CyberX8_Simulator.Devices
                     OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
                     return;
                 }
+                else if(startAddress == GOLD_CURRENT_SETTING_ADDRESS)
+                {
+                    OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, _powerSupplierSetPoint));
+                    return;
+                }
                 else if (startAddress == 0X80)
                 {
                     byte[] bytes = new byte[2];
@@ -237,6 +246,14 @@ namespace CyberX8_Simulator.Devices
                     _timer.Start();
                     OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, length));
                 }
+                else if(startAddress == GOLD_CURRENT_SETTING_ADDRESS)
+                {
+                    byte[] vauleData = new byte[4];   //0,1是高位,2,3是低位
+                    Array.Copy(data, 13, vauleData, 0, 4);
+                    _powerSupplierSetPoint = vauleData;
+                    int count = byteTransform.TransInt32(vauleData, 0);
+                    UpdateChannelGoldCurrent(flag, channel, command, (short)count);
+                }
             }
             else
             {
@@ -260,12 +277,16 @@ namespace CyberX8_Simulator.Devices
             Array.Copy(values,0,bytes, 9, values.Length);
             return bytes;
         }
-
         private void UpdateChannelCurrent(short flag,byte channel, byte command, short startAddress, short value)
         {
             _powerSupplierDic[channel].CurrentSetting = value;
             OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
         }
+        private void UpdateChannelGoldCurrent(short flag, byte channel, byte command, short count)
+        {
+            _powerSupplierDic[channel].CurrentSetting = count;
+            OnWriteMessage(CreateMultiWriteResponse(flag, channel, command, 2));
+        }
         private void UpdateChannelEnabled(short flag,byte channel, byte command, short startAddress, short value)
         {
             _powerSupplierDic[channel].OutputSwitchControl = (byte)value;
@@ -306,7 +327,7 @@ namespace CyberX8_Simulator.Devices
             return byt;
         }
 
-        private byte[] CreateMultiWriteResponse(short flag, byte channel, byte command, short startAddress, short count)
+        private byte[] CreateMultiWriteResponse(short flag, byte channel, byte command,byte registerCount)
         {
             byte[] byt = new byte[12];
             Array.Copy(byteTransform.GetBytes(flag), 0, byt, 0, 2);
@@ -316,10 +337,12 @@ namespace CyberX8_Simulator.Devices
             byt[5] = 0x06;
             byt[6] = channel;
             byt[7] = command;
-            byte[] addressByt = byteTransform.GetBytes(startAddress);
-            Array.Copy(addressByt, 0, byt, 8, 2);
-            byte[] valueByt = byteTransform.GetBytes(count);
-            Array.Copy(valueByt, 0, byt, 10, 2);
+            byt[8] = 0x00;
+            byt[9] = registerCount;
+            //byte[] addressByt = byteTransform.GetBytes(startAddress);
+            //Array.Copy(addressByt, 0, byt, 8, 2);
+            //byte[] valueByt = byteTransform.GetBytes(count);
+            //Array.Copy(valueByt, 0, byt, 10, 2);
             return byt;
         }