fix high CPU usage when no motor in Mantenance Page

main
Yik Teng Hie 2 years ago
parent f095d18074
commit 74dfd4602c

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -290,9 +290,9 @@ public:
void RegisterAxisHandle(const CMtrProfile& mtrProfile, UINT_PTR hAxis);
UINT_PTR GetAxisHandle(const CMtrProfile& mtrProfile);
bool m_bTraceData;
bool m_bTraceData{ false };
bool m_bBenchDebug;
bool m_bBenchDebug{ false };
protected:
// for 8134

@ -15,27 +15,15 @@
class IODLLCLASS CInputSetting
{
public:
// configuration
// CInputSetting() :
// m_szName(nullptr),
// m_szModuleName(nullptr),
// m_bLogic(FALSE),
// m_nPointNo(0),
// m_nSlaveID(0),
// m_nPtrNo(0),
// m_nBoardType(0),
// m_nCardNo(0)
//{
//}
std::string m_strName;
std::string m_strModuleName;
BOOL m_bLogic;
int m_nPointNo;
int m_nSlaveID;
int m_nPtrNo;
int m_nBoardType;
int m_nCardNo;
BOOL m_bLogic{FALSE};
int m_nPointNo{ 0 };
int m_nSlaveID{ 0 };
int m_nPtrNo{ 0 };
int m_nBoardType{ 0 };
int m_nCardNo{ 0 };
};
class IODLLCLASS CInput : public CCard
@ -92,5 +80,5 @@ public:
unsigned long ReadCounter();
private:
CInputBase* m_inputBase;
CInputBase* m_inputBase{ nullptr };
};

@ -89,17 +89,17 @@ public:
BOOL Wait(BOOL bState, DWORD dwDebounce, DWORD dwTimeout);
CEvent m_evtCheck;
CEvent m_evtKillThread;
DWORD m_dwDebounce;
DWORD m_dwTimeout;
BOOL m_bWaitState;
CEvent m_evtCheck{ FALSE, TRUE, NULL, NULL };
CEvent m_evtKillThread{ FALSE, TRUE, NULL, NULL };
DWORD m_dwDebounce{ 0 };
DWORD m_dwTimeout{ 0 };
BOOL m_bWaitState{ FALSE };
// input ON event when using thread to wait upon ON State
CEvent m_evtOn;
CEvent m_evtOn{ FALSE, TRUE, NULL, NULL };
// input OFF event when using thread to wait upon OFF State
CEvent m_evtOff;
CEvent m_evtOff{ FALSE, TRUE, NULL, NULL };
std::string GetName(void);
@ -137,9 +137,9 @@ protected:
// the input card ID
int m_nCardID;
CWinThread* m_pThread;
BOOL m_bAbortCheck;
BOOL m_bThreadChecking;
CWinThread* m_pThread{ nullptr };
BOOL m_bAbortCheck{ FALSE };
BOOL m_bThreadChecking{ FALSE };
// currently these 2 functions are for 9112 and 9222 cards
bool IsDigitalInput(int nPt);

@ -3,11 +3,12 @@
//////////////////////////////////////////////////////////////////////
#pragma once
#include <array>
#include <vector>
#include "hardwareini.h"
#include "InputControllerBase.h"
#include <vector>
#ifdef BUILD_IODLL
#define IODLLCLASS __declspec(dllexport)
#else
@ -75,18 +76,18 @@ public:
return m_bsimIo;
}
bool m_bsimIo; // m_bsimIo - simIo
bool m_bsimIo{ false }; // m_bsimIo - simIo
private:
CInputControllerBase* m_inputControllerBase[MAX_INPUT_CARD_TYPE];
std::array<CInputControllerBase*, MAX_INPUT_CARD_TYPE> m_inputControllerBase{};
int m_nNoOfCardType;
int m_nNoOfCardType{ 0 };
CHardwareIni m_iniHardware;
std::vector<stCard> m_vecCard;
static CInputController* instance;
CWinThread* m_pThread;
CWinThread* m_pThread{ nullptr };
CEvt m_evtTerminate;
CEvt m_evtStartUpdate;
CEvt m_evtStartUpdate{ "INPUT CONTROLLER START UPDATE" };
};

@ -41,8 +41,8 @@ public:
friend UINT MotionThreadFn(LPVOID pParam);
// static void SetGalilMotionInt(int nAxisNo);
BOOL IsInPosition(CMtrProfile mtrProfile);
unsigned short GetMotionIOStatus(CMtrProfile mtrProfile);
BOOL IsInPosition(const CMtrProfile& mtrProfile);
unsigned short GetMotionIOStatus(const CMtrProfile& mtrProfile);
CMotionController();
virtual ~CMotionController();
@ -51,31 +51,31 @@ public:
// check if negative limit hit
// BOOL IsNegLimHit(int iMotorNo);
BOOL IsNegLimHit(CMtrProfile mtrProfile);
BOOL IsNegLimHit(const CMtrProfile& mtrProfile);
// check if positive limit hit
// BOOL IsPosLimHit(int iMotorNo);
BOOL IsPosLimHit(CMtrProfile mtrProfile);
BOOL IsPosLimHit(const CMtrProfile& mtrProfile);
// check if motor at home position
// BOOL IsHomed(int iMotorNo);
BOOL IsHomed(CMtrProfile mtrProfile);
BOOL IsHomed(const CMtrProfile& mtrProfile);
// check if servo ready
// BOOL IsServoReady(int iMotorNo);
BOOL IsServoReady(CMtrProfile mtrProfile);
BOOL IsServoReady(const CMtrProfile& mtrProfile);
// check if servo alarm
// BOOL IsServoAlarm(int iMotorNo);
BOOL IsServoAlarm(CMtrProfile mtrProfile);
BOOL IsServoAlarm(const CMtrProfile& mtrProfile);
// get Motor Pos value
// double GetMtrPos(int iMotorNo);
double GetMtrPos(CMtrProfile mtrProfile);
double GetMtrPos(const CMtrProfile& mtrProfile);
// get Motion status of motor
// int GetMotionStatus(int iMotorNo);
int GetMotionStatus(CMtrProfile mtrProfile);
int GetMotionStatus(const CMtrProfile& mtrProfile);
// get proportional gain value
double GetPValue(int iMotorNo);
@ -88,10 +88,10 @@ public:
// get position error value
// double GetPosErr(int iMotorNo);
double GetPosErr(CMtrProfile mtrProfile);
double GetPosErr(const CMtrProfile& mtrProfile);
// check if Motor type is servo motor
BOOL IsServoMtrType(CMtrProfile mtrProfile);
BOOL IsServoMtrType(const CMtrProfile& mtrProfile);
// copy all motor status
void CopyMtrStatus();
@ -103,7 +103,7 @@ public:
bool IsMtrOnOffStateChanged(int iMtrNo, bool& bOnOffState);
// check if motor is on
BOOL IsMtrOn(CMtrProfile mtrProfile);
BOOL IsMtrOn(const CMtrProfile& mtrProfile);
/* Return Motor(specify by iMtrNo) on or off state.
Function Return true = Motor specify by iMtrNo Is On, else return false = Motor is off */
@ -129,16 +129,16 @@ private:
CMtrOnOff m_mtrOnOff; // object to keep track of current motor On/Off States
std::vector<int> m_vecMtrCurPos; // array to store motor position before maintenance mode
std::vector<bool> m_vecMtrCurOnOff; // array to store motor On/Off States before maintenance mode
int m_iNoOfMtr; // total no of motor
int m_nNoOfCardType;
int m_iNoOfMtr{ 0 }; // total no of motor
int m_nNoOfCardType{ 0 };
CHardwareIni m_iniHardware;
bool m_bBenchDebugWithActualHardware;
static CMotionController* m_pInstance;
CWinThread* m_pThread;
CWinThread* m_pThread{ nullptr };
CEvt m_evtTerminate;
CEvt m_evtStartUpdate;
CEvt m_evtStartUpdate{ "MOTION CONTROLLER START UPDATE" };
};

@ -241,8 +241,6 @@ private:
int m_iMtrNo; // keep track motor number
// CMemoryState msBeforeCall, msAfterCall, memDifference;
enum
{
NO_SPECIFIC_MOTOR = -1,

@ -15,29 +15,15 @@
class IODLLCLASS COutputSetting
{
public:
// configuration
// COutputSetting() :
// m_szName(nullptr),
// m_szModuleName(nullptr),
// m_bLogic(FALSE),
// m_nPointNo(0),
// m_nSlaveID(0),
// m_nPtrNo(0),
// m_nBoardType(0),
// m_bEnableCheck(FALSE),
// m_nCardNo(0)
//{
//}
std::string m_strName;
std::string m_strModuleName;
BOOL m_bLogic;
int m_nPointNo;
int m_nSlaveID;
int m_nPtrNo;
int m_nBoardType;
BOOL m_bEnableCheck;
int m_nCardNo;
BOOL m_bLogic{ FALSE };
int m_nPointNo{ 0 };
int m_nSlaveID{ 0 };
int m_nPtrNo{ 0 };
int m_nBoardType{ 0 };
BOOL m_bEnableCheck{ FALSE };
int m_nCardNo{ 0 };
};
class IODLLCLASS COutput : public CCard

@ -3,6 +3,7 @@
//////////////////////////////////////////////////////////////////////
#pragma once
#include <array>
#include <map>
#include <vector>
@ -59,7 +60,7 @@ public:
std::vector<BOOL> m_vecOutputArray;
// to keep track output state array size
int m_iOutputStateArraySize;
int m_iOutputStateArraySize{ 0 };
CMutex m_OutputMutex;
@ -84,16 +85,16 @@ public:
bool m_bsimIo; // m_bsimIo - simIo
private:
COutputControllerBase* m_outputControllerBase[MAX_OUTPUT_CARD_TYPE];
std::array<COutputControllerBase*, MAX_OUTPUT_CARD_TYPE> m_outputControllerBase{};
int m_nNoOfCardType;
int m_nNoOfCardType{ 0 };
CHardwareIni m_iniHardware;
std::vector<stCard> m_vecCard;
static COutputController* instance;
CWinThread* m_pThread;
CWinThread* m_pThread{ nullptr };
CEvt m_evtTerminate;
CEvt m_evtStartUpdate;
CEvt m_evtStartUpdate{ "OUTPUT CONTROLLER START UPDATE" };
};

Binary file not shown.

Binary file not shown.

@ -8,14 +8,6 @@
#include "TimeEquipSubState.h"
/*
#ifdef BUILD_MCCTRDLL
#define MCCTRDLLCLASS __declspec(dllexport)
#else
#define MCCTRDLLCLASS __declspec(dllimport)
#endif
class MCCTRDLLCLASS CEquipState*/
class CEquipState
{
public:
@ -91,8 +83,8 @@ public:
START_ALL_TIMER_EVT, // Possible to start all timer? need to have this event?
};
static std::string m_csKeyName[MAX_EQUIPMENT_SUBSTATE]; // key name of debug info file
static const char* sSectionName[MAX_EQUIP_STATE]; // Section name of debug info file
static std::array<std::string, MAX_EQUIPMENT_SUBSTATE> m_csKeyName; // key name of debug info file
static std::array<const char*, MAX_EQUIP_STATE> sSectionName; // Section name of debug info file
protected:
// set equipment state time
@ -128,13 +120,9 @@ protected:
// add equipment SubState time
virtual void AddEquipSubStateTime(int iEquipSubStateNo, LONGLONG lTimeSpan);
// int *m_iEvt;
// CTimeEquipSubState *m_ctesEquipSubState;
std::array<int, MAX_EQUIP_SUB_STATE> m_iEvt;
std::array < CTimeEquipSubState, MAX_EQUIP_SUB_STATE> m_ctesEquipSubState;
std::array<CTimeEquipSubState, MAX_EQUIP_SUB_STATE> m_ctesEquipSubState;
private:
// prevent accidental copy

@ -10,62 +10,41 @@
#include "IniFile.h"
#include "DllDefines.h"
/*
* @brief csTimeName formerly used for monolithic UI
*/
class StTime
{
public:
StTime()
{
dTime = 0.0;
}
char csTimeName[50]{ 0 };
double dTime;
std::string csTimeName{};
double dTime{ 0.0 };
};
class StRamTime
{
public:
StRamTime()
{
dTime = 0.0;
}
char csTimeName[50]{ 0 };
double dTime;
std::string csTimeName{};
double dTime{ 0.0 };
};
class StInterrupt
{
public:
StInterrupt()
{
dInterruptTime = 0.0;
}
char csInterruptName[50]{ 0 };
double dInterruptTime;
std::string csInterruptName{};
double dInterruptTime{ 0.0 };
};
class StLong
{
public:
StLong()
{
lCount = 0;
}
char csTimeName[50];
long lCount;
std::string csTimeName{};
long lCount{ 0 };
};
class StOleDateTime
{
public:
StOleDateTime()
{
}
char csTimeName[50]{ 0 };
std::string csTimeName{ };
COleDateTime odtDateTime;
};
@ -119,13 +98,13 @@ public:
OLE_DATE_TIME,
};
StTime stTime[CEquipState::MAX_EQUIPMENT_SUBSTATE];
StTime stEquipStateTime[CEquipState::MAX_EQUIP_STATE];
StRamTime stRamTime[MAX_RAM_MEASUREMENT];
std::array<StTime, CEquipState::MAX_EQUIPMENT_SUBSTATE> stTime;
std::array<StTime, CEquipState::MAX_EQUIP_STATE> stEquipStateTime;
std::array<StRamTime, MAX_RAM_MEASUREMENT> stRamTime;
StInterrupt stInterrupt[MAX_INTERRUPT];
StLong stLong[MAX_CNT];
StOleDateTime stOleDateTime[MAX_OLE_DATE_TIME];
std::array<StInterrupt, MAX_INTERRUPT> stInterrupt;
std::array<StLong, MAX_CNT> stLong;
std::array<StOleDateTime, MAX_OLE_DATE_TIME> stOleDateTime;
};
class MCCTRDLLCLASS CSemiE10

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save