From 63439977901d54a01924ed76290931aeddbce66c Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 화, 05 7월 2022 18:16:55 +0900
Subject: [PATCH] Ongoing80 #4220 CF AOI Review 알람 추가

---
 ReviewSystem/CHMotorControls/MotorControl.cpp |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/ReviewSystem/CHMotorControls/MotorControl.cpp b/ReviewSystem/CHMotorControls/MotorControl.cpp
index ca168d3..3be3b86 100644
--- a/ReviewSystem/CHMotorControls/MotorControl.cpp
+++ b/ReviewSystem/CHMotorControls/MotorControl.cpp
@@ -24,6 +24,12 @@
 	m_nAutoEnable				= 0;
 	m_nAutoEnablePrev			= 0;
 
+	/*< LYW 20220704 - #4220 ADD Start >*/
+	m_nMotorAlive = 0;
+	m_nMotorAlivePrev = 0;
+	dwLastAliveTick = GetTickCount();
+	/*< LYW 20220704 - #4220 ADD End >*/
+
 	// wsi signal
 	m_nWsiMotionEndPrev			= 0;
 
@@ -96,6 +102,29 @@
 
 	if (m_nAxisCount<1) return;
 
+	//Alive
+	if (ReadAddressValue(50, m_nMotorAlive))
+	{
+		if (m_nMotorAlivePrev != m_nMotorAlive)
+		{
+			dwLastAliveTick = GetTickCount();
+		}
+		m_nAutoEnablePrev = m_nAutoEnable;
+
+		if (GetTickCount() - dwLastAliveTick >15000 && dwLastAliveTick != 0)
+		{
+			m_pMC2P->IMC2P_SendMotorAliveErrorAlram();
+			m_pMC2P->IMC2P_DisplayMessage(m_nIndex, _T("Motor Alive Error!"));
+			dwLastAliveTick = GetTickCount();
+		}
+	}
+	else
+	{
+		m_pMC2P->IMC2P_SendMotorAliveErrorAlram();
+		m_pMC2P->IMC2P_DisplayMessage(m_nIndex, _T("Motor Alive Read Fail!"));
+		dwLastAliveTick = GetTickCount();
+	}
+
 	// auto enable
 	const CMotorCommonAddr *pAddr = m_ControlInfo.GetMotorCommonAddr();
 	if (pAddr && pAddr->m_nAllAutoEnableAddr!=MOTOR_ADDRESS_NONE)

--
Gitblit v1.9.3