Jelajahi Sumber

pull commit

ys-hwang 6 tahun lalu
induk
melakukan
4cea944a56

+ 1 - 1
Dev/OHV/OHV.Module.Interactivity/OHV.Module.Interactivity.csproj

@@ -19,7 +19,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
+    <OutputPath>..\..\..\..\..\OutReales\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>

+ 35 - 9
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoView.xaml

@@ -255,7 +255,7 @@
                     </Button>
                     <Button Grid.Column="4" Grid.Row="2" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10" Background="{c:Binding 'IsLeftServoOriginReturn ? media:Brushes.DodgerBlue : media:Brushes.Transparent'}"
+                            materialDesign:ButtonAssist.CornerRadius="10" Background="{c:Binding 'IsRightServoOriginReturn ? media:Brushes.DodgerBlue : media:Brushes.Transparent'}"
                             ToolTip="MaterialDesignRaisedButton with Round Corners">
                         <StackPanel>
                             <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap"><Run Text="Origin Return"/></TextBlock>
@@ -263,7 +263,7 @@
                     </Button>
                     <Button Grid.Column="4" Grid.Row="3" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10" Background="{c:Binding 'IsLeftServoFault ? media:Brushes.DodgerBlue : media:Brushes.Transparent'}"
+                            materialDesign:ButtonAssist.CornerRadius="10" Background="{c:Binding 'IsRightServoFault ? media:Brushes.DodgerBlue : media:Brushes.Transparent'}"
                             ToolTip="MaterialDesignRaisedButton with Round Corners">
                         <StackPanel>
                             <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap"><Run Text="Servo Fault"/></TextBlock>
@@ -325,18 +325,31 @@
 
                         <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center"
                                 Width="Auto" Height="120">
-                            <RepeatButton
+                            <Button 
+                            x:Name="M"
                             Margin="5"
                             Grid.Row="2" 
                             Grid.Column="1"
                             HorizontalAlignment="Stretch"
                             Height="auto"
-                            Command="{Binding JogCommand}" CommandParameter="-" Width="90">
+                             Width="90" PreviewMouseDown="Button_PreviewMouseDown" PreviewMouseUp="Button_PreviewMouseUp">
+                                <!--<i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="MouseLeftButtonDown">
+                                        <i:InvokeCommandAction Command="{Binding JogCommand}" CommandParameter="-"/>
+                                    </i:EventTrigger>
+                                    <i:EventTrigger EventName="MouseLeftButtonUp">
+                                        <i:InvokeCommandAction Command="{Binding JogStopCommand}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>-->
+                                <!--<Button.InputBindings>
+                                    <MouseBinding Gesture="MouseLeftButtonUp" Command="{Binding JogStopCommand}" />
+                                    <MouseBinding Gesture="MouseLeftButtonDown" Command="{Binding JogCommand}" CommandParameter="-"/>
+                                </Button.InputBindings>-->
                                 <StackPanel>
                                     <materialDesign:PackIcon Kind="MinusBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                                     <TextBlock><Run Text="Jog(-)"/></TextBlock>
                                 </StackPanel>
-                            </RepeatButton>
+                            </Button>
 
                             <materialDesign:Badged
                             Grid.Row="2"
@@ -355,18 +368,31 @@
                                 </Button>
                             </materialDesign:Badged>
 
-                            <RepeatButton
+                            <Button
                             Margin="5"
                             Grid.Row="2" 
                             Grid.Column="3"
                             HorizontalAlignment="Stretch"
                             Height="auto"
-                            Command="{Binding JogCommand}" CommandParameter="+" Width="90">
+                            Width="90" PreviewMouseDown="Button_PreviewMouseDown" PreviewMouseUp="Button_PreviewMouseUp">
+                                <!--<i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="MouseLeftButtonDown">
+                                        <i:InvokeCommandAction Command="{Binding JogCommand}" CommandParameter="+"/>
+                                    </i:EventTrigger>
+                                    <i:EventTrigger EventName="MouseLeftButtonUp">
+                                        <i:InvokeCommandAction Command="{Binding JogStopCommand}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>-->
+                                <!--<Button.InputBindings>
+                                    <MouseBinding Gesture="LeftButtonUp" Command="{Binding JogStopCommand}" />
+                                    <MouseBinding Gesture="LeftButtonDown" Command="{Binding JogCommand}" CommandParameter="+"/>
+                                </Button.InputBindings>-->
+
                                 <StackPanel>
                                     <materialDesign:PackIcon Kind="PlusBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                                     <TextBlock><Run Text="Jog(+)"/></TextBlock>
                                 </StackPanel>
-                            </RepeatButton>
+                            </Button>
                         </StackPanel>
 
                     </StackPanel>
@@ -470,7 +496,7 @@
                         <TextBlock Text="SAVE" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
                     </StackPanel>
                 </Button>
-                
+
                 <Button Margin="7,0,7,7" HorizontalAlignment="Stretch" Height="90" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
                     <StackPanel>
                         <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>

+ 24 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoView.xaml.cs

@@ -24,5 +24,29 @@ namespace OHV.Module.Interactivity.PopUp
         {
             InitializeComponent();
         }
+
+        private void Button_PreviewMouseDown( object sender , MouseButtonEventArgs e )
+        {
+            var btn = sender as Button;
+            if ( btn == null ) return;
+
+            var model = this.DataContext as LockServoViewModel;
+            if ( btn.Name.Equals( "M" ) )
+            {
+                string o = "-";
+                model.ExecuteJogCommand( (object)o );
+            }
+            else
+            {
+                model.ExecuteJogCommand( "+" );
+            }
+        }
+
+        private void Button_PreviewMouseUp( object sender , MouseButtonEventArgs e )
+        {
+            var model = this.DataContext as LockServoViewModel;
+            model.ExecuteJogStop();
+
+        }
     }
 }

+ 50 - 3
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoViewModel.cs

@@ -193,6 +193,8 @@ namespace OHV.Module.Interactivity.PopUp
         public ICommand SelectedPosDataSave { get; set; }
         public ICommand JogVelPopupCommand { get; set; }
 
+        public ICommand JogStopCommand { get; set; }
+
         public event Action<IDialogResult> RequestClose;
 
         IEventAggregator eventAggregator;
@@ -215,6 +217,7 @@ namespace OHV.Module.Interactivity.PopUp
             this.SelectedPosDataSave = new DelegateCommand<object>( ExecuteSelectedPosDataSave );
             this.JogCommand = new DelegateCommand<object>( ExecuteJogCommand );
             this.JogVelPopupCommand = new DelegateCommand( ExecuteJogVelPopup );
+            this.JogStopCommand = new DelegateCommand( ExecuteJogStop );
 
             this.eventAggregator = ea;
             this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe( AxisUICallbackCommunication );
@@ -236,6 +239,18 @@ namespace OHV.Module.Interactivity.PopUp
             this.PosLockBrush = Brushes.Orange;
         }
 
+        public void ExecuteJogStop( )
+        {
+            var msg = new AxisControlEventArgs
+            {
+                Dir = AxisControlEventArgs.eEventDir.ToBack ,
+                Kind = AxisControlEventArgs.eAxisControlKind.Stop,
+                AxisName = this.SelectAxis ,
+            };
+
+            this.PublishEvent( msg );
+        }
+
         private void ExecuteJogVelPopup( )
         {
             var numPad = new CalcuratorView();
@@ -276,7 +291,8 @@ namespace OHV.Module.Interactivity.PopUp
                         }
 
                         var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
-                        sqlAxisLeft.Value = this.CurrentLockLeft;
+                        //sqlAxisLeft.Value = this.CurrentLockLeft;
+                        sqlAxisLeft.Value = this.TargetPosLockLeft;
                         sql.AxisPositionDataDAL.Update( sqlAxisLeft );
                     }
                     else if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_RIGHT )
@@ -291,7 +307,8 @@ namespace OHV.Module.Interactivity.PopUp
                                 break;
                         }
                         var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
-                        sqlAxisRight.Value = this.CurrentLockLeft;
+                        //sqlAxisRight.Value = this.CurrentLockRight;
+                        sqlAxisRight.Value = this.TargetPosLockRight;
                         sql.AxisPositionDataDAL.Update( sqlAxisRight );
                     }
                     else
@@ -300,7 +317,7 @@ namespace OHV.Module.Interactivity.PopUp
             } );
         }
 
-        private void ExecuteJogCommand( object obj )
+        public void ExecuteJogCommand( object obj )
         {
             if ( this.JogVelocity <= 0 )
             {
@@ -517,6 +534,7 @@ namespace OHV.Module.Interactivity.PopUp
 
         private void ExecuteSelectPosCommand( object obj )
         {
+            List<Common.Model.AxisPositionData> dataList = null;
             this.SelectedPosition = obj.ToString();
 
             if ( obj.Equals( ConstString.TEACH_POSITION_LOCK ) )
@@ -529,6 +547,35 @@ namespace OHV.Module.Interactivity.PopUp
                 this.PosLockBrush = Brushes.Gray;
                 this.PosUnlockBrush = Brushes.Orange;
             }
+
+            if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT )
+            {
+                switch ( this.SelectedPosition )
+                {
+                    case ConstString.TEACH_POSITION_LOCK:
+                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+                        break;
+                    case ConstString.TEACH_POSITION_UNLOCK:
+                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+                        break;
+                }
+                var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
+                this.TargetPosLockLeft = sqlAxisLeft.Value;
+            }
+            else
+            {
+                switch ( this.SelectedPosition )
+                {
+                    case ConstString.TEACH_POSITION_LOCK:
+                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
+                        break;
+                    case ConstString.TEACH_POSITION_UNLOCK:
+                        dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
+                        break;
+                }
+                var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
+                this.TargetPosLockRight = sqlAxisRight.Value;
+            }
         }
 
         private void ExecuteSelectAxisCommand( object obj )

+ 10 - 4
Dev/OHV/OHV.Module.Monitoring/Interactivity/InOutIOViewModel.cs

@@ -47,16 +47,20 @@ namespace OHV.Module.Monitoring.Interactivity
                 if(SetProperty( ref this.currentPage, value ) )
                 {
                     var input = this.allIOList.Where(i => i.PageNo == this.currentPage && i.IOType.Equals("IN")).ToArray();
+                    this.InIOList.Clear();
+                    this.InIOList = null;
                     this.InIOList = new SelectionList<BitBlock>( input );
                     this.InIOList.ForEach( i =>
                     {
                         i.Row = i.Element.Index;
                         i.Col = 0;
                         i.Tag = $"[{i.Element.Address}] {i.Element.Tag}";
-                        i.IsSelected = i.Element.IsBitOn;
+                        i.IsOn = i.Element.IsBitOn;
                     } );
 
                     var output = this.allIOList.Where(i => i.PageNo == this.currentPage && i.IOType.Equals("OUT")).ToArray();
+                    this.OutIOList.Clear();
+                    this.OutIOList = null;
                     this.OutIOList = new SelectionList<BitBlock>( output );
                     this.OutIOList.PropertyChanged += OutIOList_PropertyChanged;
                     this.OutIOList.ForEach( o =>
@@ -64,7 +68,7 @@ namespace OHV.Module.Monitoring.Interactivity
                         o.Row = o.Element.Index;
                         o.Col = 0;
                         o.Tag = $"[{o.Element.Address}] {o.Element.Tag}";
-                        o.IsSelected = o.Element.IsBitOn;
+                        o.IsOn = o.Element.IsBitOn;
                     } );
                 }
             }
@@ -114,7 +118,7 @@ namespace OHV.Module.Monitoring.Interactivity
                         i.Row = i.Element.Index;
                         i.Col = 0;
                         i.Tag = $"[{i.Element.Address}] {i.Element.Tag}";
-                        i.IsSelected = i.Element.IsBitOn;
+                        i.IsOn = i.Element.IsBitOn;
                     });
 
                     var output = this.allIOList.Where(i => i.PageNo == this.currentPage && i.IOType.Equals("OUT")).ToArray();
@@ -125,7 +129,7 @@ namespace OHV.Module.Monitoring.Interactivity
                         o.Row = o.Element.Index;
                         o.Col = 0;
                         o.Tag = $"[{o.Element.Address}] {o.Element.Tag}";
-                        o.IsSelected = o.Element.IsBitOn;
+                        o.IsOn = o.Element.IsBitOn;
                     });
                     break;
 
@@ -148,6 +152,8 @@ namespace OHV.Module.Monitoring.Interactivity
 
         private void EzIO_OnChangedIO(BitBlock bit)
         {
+            if ( bit.PageNo != CurrentPage ) return;
+
             var b = this.allIOList.Where(io => io.Tag.Equals(bit.Tag)).FirstOrDefault();
 
             if (b.IOType.Equals("IN"))

+ 2 - 2
Dev/OHV/OHV.Vehicle/OHV.Vehicle.csproj

@@ -37,7 +37,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>\\Ohv_001\vcs\</OutputPath>
+    <OutputPath>..\..\..\..\..\OutReales\</OutputPath>
     <DefineConstants>TRACE;DEBUG</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -54,7 +54,7 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote|AnyCPU'">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>\\Ohv_001\vcs\</OutputPath>
+    <OutputPath>\\Ohv_001\VCS\</OutputPath>
     <DefineConstants>TRACE;DEBUG</DefineConstants>
     <DebugType>full</DebugType>
     <PlatformTarget>AnyCPU</PlatformTarget>

+ 5 - 3
Dev/OHV/VehicleControlSystem/ControlLayer/Axis/EzAxis.cs

@@ -90,6 +90,8 @@ namespace VehicleControlSystem.ControlLayer.Axis
             this.SetAccelTime( this.ValocityData.AutoRunAccelerate );
             this.SetDecelTime( this.ValocityData.AutoRunDecelerate );
 
+            this.SetParameter( 17 , 6 );
+
             return 0;
         }
 
@@ -253,7 +255,7 @@ namespace VehicleControlSystem.ControlLayer.Axis
             else
                 uiVelocity = (uint)Convert.ToInt32( dVelocity / this.Config.Scale );
 
-
+            uiVelocity = 50;
             if( dir == E_JogMoveDir.Positive )
                 return EziMOTIONPlusELib.FAS_MoveVelocity( Config.AxisNo, uiVelocity, EziSERVO2PlusE.DIR_INC );
             else
@@ -385,8 +387,8 @@ namespace VehicleControlSystem.ControlLayer.Axis
         public override int ServoOn()
         {
             int result = EziMOTIONPlusELib.FAS_IsSlaveExist(Config.AxisNo);
-            if (result != EziMOTIONPlusELib.FMM_OK)
-                return result;
+            //if (result != EziMOTIONPlusELib.FMM_OK)
+            //    return result;
 
             return EziMOTIONPlusELib.FAS_ServoEnable( Config.AxisNo, 1 );
         }

+ 15 - 5
Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs

@@ -55,11 +55,12 @@ namespace VehicleControlSystem.ControlLayer
                 switch ( args.Kind )
                 {
                     case AxisControlEventArgs.eAxisControlKind.Stop:
+                        this.ReqStop();
                         break;
                     case AxisControlEventArgs.eAxisControlKind.EStop:
                         break;
                     case AxisControlEventArgs.eAxisControlKind.Move:
-                        //this.ReqOrderByMove( args );
+                        this.ReqOrderByMove( args );
                         break;
                     case AxisControlEventArgs.eAxisControlKind.Jog:
                         this.ReqJog( args );
@@ -99,7 +100,10 @@ namespace VehicleControlSystem.ControlLayer
             }
         }
 
-        
+        private void ReqStop( )
+        {
+            this.axes.ForEach( x => { x.Stop(); } );
+        }
 
         void PublishEvent(AxisControlEventArgs args)
         {
@@ -309,8 +313,8 @@ namespace VehicleControlSystem.ControlLayer
                 AxisName = arg.AxisName,
                 Kind = AxisControlEventArgs.eAxisControlKind.OriginReturn,
             };
-            if (result != EziMOTIONPlusELib.FMM_OK)
-                msg.Result = Results.Fail<int>("Origin Fail").WithValue(result);
+            if ( result != EziMOTIONPlusELib.FMM_OK )
+                msg.Result = Results.Fail( "Origin Fail" );
             else
                 msg.Result = Results.Ok();
 
@@ -376,10 +380,16 @@ namespace VehicleControlSystem.ControlLayer
                 Axis.AxisConfig c = new Axis.AxisConfig
                 {
                     AxisName = config.Name,
-                    AxisNo = config.Id,
                     Scale = config.Scale,
                     Address = config.Address,
+                    AxisNo = config.Id,
                 };
+
+                //if ( config.Name.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) )
+                //    c.AxisNo = 40;
+                //else
+                //    c.AxisNo = 41;
+
                 axes.Add(new EzAxis(c));
             });
 

+ 6 - 2
Dev/OHV/VehicleControlSystem/ControlLayer/IO/EzIO.cs

@@ -453,7 +453,10 @@ namespace VehicleControlSystem.ControlLayer.IO
                             if (EziMOTIONPlusELib.FAS_GetAllStatus(board.BoardID, ref axisDIn, ref axisDOut, ref axisStatus,
                                 ref cmdPos, ref actPos, ref posErr, ref actVel, ref posItemNo) == EziMOTIONPlusELib.FMM_OK)
                             {
-                                var input = this._inPutIOList.Where(x => x.BoardNo == board.BoardID).DefaultIfEmpty().ToList();
+
+                                if ( this._inPutIOList.Where( x => x.BoardNo == board.BoardID ).Count() <= 0 ) break;
+
+                                var input = this._inPutIOList.Where( x => x.BoardNo == board.BoardID ).DefaultIfEmpty().ToList();
                                 input.ForEach(i =>
                                {
                                    var isOn = Convert.ToBoolean(axisDIn & this.servoAmpInputBitOnMask[i.Index]) ? true : false;
@@ -503,7 +506,8 @@ namespace VehicleControlSystem.ControlLayer.IO
                                 output.ForEach(o =>
                                {
                                    var isOn = Convert.ToBoolean(outValue & this.bitOnMask[o.Index]) ? true : false;
-                                   if (o.IsBitOn != isOn) o.IsChanged = true;
+                                   if (o.IsBitOn != isOn) 
+                                       o.IsChanged = true;
                                    o.IsBitOn = isOn;
                                });
                             }

+ 27 - 20
Dev/OHV/VehicleControlSystem/ControlLayer/Serial/BatteryTabos/Advantech/Advantech.cs

@@ -96,42 +96,42 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
 
             if(ret < 0)
             {
-                this.CanError(new Exception("AdvCAN Open Error"));
+                throw new Exception( "AdvCAN Open Error" );
                 return;
             }
 
             ret = this.device.acEnterResetMode();
             if(ret < 0)
             {
-                this.CanError( new Exception( "AdvCAN Reset Error" ) );
+                throw new Exception( "AdvCAN Reset Error" );
                 return;
             }
 
             ret = this.device.acSetBaud(500);
             if ( ret < 0 )
             {
-                this.CanError( new Exception( "AdvCAN BaudRate Set Error" ) );
+                throw new Exception( "AdvCAN BaudRate Set Error" );
                 return;
             }
 
             ret = this.device.acSetTimeOut( 2000 , 2000 );
             if(ret < AdvCANIO.SUCCESS)
             {
-                this.CanError( new Exception( "AdvCAN TimeOut Set Error" ) );
+                throw new Exception( "AdvCAN TimeOut Set Error " );
                 return;
             }
 
             ret = this.device.acSetSelfReception(false);
             if(ret < AdvCANIO.SUCCESS)
             {
-                this.CanError( new Exception( "AdvCAN SelfReception Set Error" ) );
+                throw new Exception( "AdvCAN SelfReception Set Error" );
                 return;
             }
 
             ret = this.device.acEnterWorkMode();
             if(ret < AdvCANIO.SUCCESS)
             {
-                this.CanError( new Exception( "AdvCAN EnterWorkMode Error" ) );
+                throw new Exception( "AdvCAN EnterWorkMode Error" );
                 return;
             }
 
@@ -185,15 +185,15 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
                 }
                 catch ( ObjectDisposedException exception )
                 {
-                    this.CanError( exception );
+                    this.CanError( );
                 }
                 catch ( IOException exception )
                 {
-                    this.CanError( exception );
+                    this.CanError(  );
                 }
                 catch ( Exception exception )
                 {
-                    this.CanError( exception );
+                    this.CanError( );
                     logger.E( $"eSlnet {exception.Message}" );
                 }
             }
@@ -269,11 +269,11 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
 
             if(ret == AdvCANIO.TIME_OUT)
             {
-                CanError( new Exception( "" ) );
+                CanError( );
             }
             else if (ret == AdvCANIO.OPERATION_ERROR)
             {
-                CanError( new Exception( "" ) );
+                CanError(  );
             }
 
             return 1;
@@ -290,29 +290,36 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
         /// <returns></returns>
         void ReadMessage( )
         {
+            Thread.Sleep( 1000 );
             uint readCount = 3;
-            uint pulNumberofRead = 0;
+            uint pulNumberofRead = 3;
             AdvCan.canmsg_t[] recv = new AdvCan.canmsg_t[ 3 ];
 
             var ret = this.device.acCanRead(recv, readCount, ref pulNumberofRead );
 
-            if(ret == AdvCANIO.TIME_OUT)
+            if ( ret == AdvCANIO.TIME_OUT )
             {
-                CanError(new Exception(""));
+                CanError( );
             }
-            else if (ret == AdvCANIO.OPERATION_ERROR)
+            else if ( ret == AdvCANIO.OPERATION_ERROR )
             {
-                CanError( new Exception( "" ) );
+                CanError( );
             }
-            else
+            else if ( ret == AdvCANIO.SUCCESS )
             {
-                this.AdvCanReceive(recv);
+                this.AdvCanReceive( recv );
             }
+            else
+            { }
         }
 
         private void AdvCanReceive( AdvCan.canmsg_t[] recv )
         {
+            //null check battery receive
             var ll = recv.Select( x => x.data ).ToList();
+            if ( !ll.Any(null) )
+                return;
+
             ll.ForEach( r =>
              {
                  if ( r[ 1 ] == 1 )
@@ -370,13 +377,13 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
             var result = rs.Cast<object>().ToList();
         }
 
-        void CanError( Exception e )
+        void CanError(  )
         {
             //var result = PCANBasic.Uninitialize( this.handle );
             this.IsConnected = false;
             var ret = this.device.acCanClose();
 
-            logger.E( $"[Battery Advantech] - {e.Message} -" );
+            //logger.E( $"[Battery Advantech] - {e.Message} -" );
 
             this.manager._OnDisconnected();
         }