256 lines
6.4 KiB
C++
256 lines
6.4 KiB
C++
#include "SystemInfo.h"
|
|
#include <vector>
|
|
//#include "config/ConfigManager.h"
|
|
|
|
|
|
SystemInfo::SystemInfo()
|
|
{
|
|
InitializeCriticalSection(&m_MStatueCS);
|
|
InitializeCriticalSection(&m_InfoCs);
|
|
m_TestOutputState = 65535;
|
|
m_TestInputState = 65535;
|
|
m_TestExtout1State = 65535;
|
|
m_TestExtin1State = 65535;
|
|
m_WindValue = 0.0f;
|
|
m_PlatformTemp = 0.0f;
|
|
m_PlatformTempSettingValue = 0.0f;
|
|
m_PrintRemainTime = 0;
|
|
m_PauseRemainTime = 0;
|
|
m_MoldMainPos = 0.0f;
|
|
m_MoldSlavePos = 0.0f;
|
|
m_ArmPos = 0.0f;
|
|
m_IsDedustingStopAlarm = false;
|
|
m_IsOxygenSensorConnect = false;
|
|
m_IsHeatingConnect = false;
|
|
//m_LinearEncoderPos = 0.0f;
|
|
m_PowderQtyPos = 0.0f;
|
|
m_FanFrequency = 0.0f;
|
|
m_RemainPowder = 0.0f;
|
|
//m_PowderJarCabinPressureVoltage=0.0f;
|
|
//m_PowderJarCabinPressure=0.0f;
|
|
}
|
|
|
|
|
|
SystemInfo::~SystemInfo()
|
|
{
|
|
DeleteCriticalSection(&m_MStatueCS);
|
|
DeleteCriticalSection(&m_InfoCs);
|
|
}
|
|
|
|
void SystemInfo::SetDedustingStopAlarm(bool bvalue)
|
|
{
|
|
LockInfo();
|
|
m_IsDedustingStopAlarm = bvalue;
|
|
UnlockInfo();
|
|
}
|
|
|
|
bool SystemInfo::IsDedustingStopAlarm()
|
|
{
|
|
bool rel = false;
|
|
LockInfo();
|
|
rel = m_IsDedustingStopAlarm;
|
|
UnlockInfo();
|
|
return rel;
|
|
}
|
|
|
|
|
|
void SystemInfo::LockInfo()
|
|
{
|
|
EnterCriticalSection(&m_InfoCs);
|
|
}
|
|
|
|
void SystemInfo::UnlockInfo()
|
|
{
|
|
LeaveCriticalSection(&m_InfoCs);
|
|
}
|
|
|
|
float SystemInfo::GetPowderQty()
|
|
{
|
|
float value = 0.0f;
|
|
LockInfo();
|
|
value = m_PowderQtyPos;
|
|
UnlockInfo();
|
|
return value;
|
|
}
|
|
|
|
|
|
void SystemInfo::SetRemainPowder(float rp)
|
|
{
|
|
LockInfo();
|
|
m_RemainPowder = rp;
|
|
UnlockInfo();
|
|
}
|
|
|
|
float SystemInfo::GetRemainPowder()
|
|
{
|
|
float value = 0.0f;
|
|
LockInfo();
|
|
value = m_RemainPowder;
|
|
UnlockInfo();
|
|
return value;
|
|
}
|
|
|
|
void SystemInfo::GetEnvInfo(EnvInfo& envInfo)
|
|
{
|
|
LockInfo();
|
|
envInfo.m_OxygenRealTimeValue1 = m_ComPrintOxygen1;
|
|
envInfo.m_OxygenRealTimeValue2 = m_ComPrintOxygen2;
|
|
envInfo.m_WindValue = m_WindValue;
|
|
envInfo.m_AnaWindValue = m_WindValue;
|
|
//envInfo.m_AmbientTemp = m_AmbientTemp1;
|
|
envInfo.m_InnerTemp = m_PrintTemp1;
|
|
envInfo.m_PlatformTemp = m_PlatformTemp;
|
|
envInfo.m_PlatformTempSettingValue = m_PlatformTempSettingValue;
|
|
//envInfo.m_PrintPressure = m_PrintPressure;
|
|
//envInfo.m_AvgPrintPressure = m_AvgPrintPressure;
|
|
envInfo.m_MoldPos = m_MoldMainPos;
|
|
envInfo.m_ArmPos = m_ArmPos;
|
|
//envInfo.m_LinearEncoderPos = m_LinearEncoderPos;
|
|
envInfo.m_PowderPos = 0.0f;
|
|
//envInfo.m_ArmPos = m_ArmPos;
|
|
//envInfo.m_SupplyPos = m_SupplyPos;
|
|
//envInfo.m_MoldLoadTorque = m_MoldLoadTorque;
|
|
//envInfo.m_PowderLoadTorque = m_PowderLoadTorque;
|
|
//envInfo.m_ArmLoadTorque = m_ArmLoadTorque;
|
|
//envInfo.m_SupplyLoadTorque = m_SupplyLoadTorque;
|
|
//envInfo.m_WaterTemp = m_WaterTemp;
|
|
//envInfo.m_FanVoltage = m_FanVoltage;
|
|
envInfo.m_FanFrequency = m_FanFrequency;
|
|
envInfo.m_IsDedustingStopAlarm = m_IsDedustingStopAlarm;
|
|
//envInfo.m_IsUpDownLimit = m_IsUpDownLimit;
|
|
//envInfo.m_PowderQty = m_PowderQty;
|
|
//envInfo.m_ProtectGasPressure = m_ProtectGasPressure;
|
|
envInfo.jobCostMil = m_StateBean.jobCostMil;
|
|
envInfo.remainMil = m_StateBean.remainMil;
|
|
envInfo.realCostSeconds = m_StateBean.realCostSeconds;
|
|
//envInfo.m_CurrentAlarmInfo = m_CurrentAlarmInfo;
|
|
//envInfo.m_PrintPowderPressureDif = m_PrintPowderPressureDif;
|
|
envInfo.m_IsOxygenSensorConnect = m_IsOxygenSensorConnect;
|
|
//envInfo.m_IsChillerComConnect = m_IsChillerComConnect;
|
|
//envInfo.m_IsCameraConnect = m_IsCameraConnect;
|
|
envInfo.m_IsHeatingConnect = m_IsHeatingConnect;
|
|
//envInfo.m_PowderJarPressureDif = m_PowderJarPressureDif;
|
|
//envInfo.m_IsFreqAlarm = m_IsFreqAlarm;
|
|
//envInfo.m_IsPurifierConnectAlarm = m_IsPurifierConnectAlarm;
|
|
envInfo.m_RemainPowder = m_RemainPowder;
|
|
envInfo.m_EnvState = m_EnvState;
|
|
UnlockInfo();
|
|
}
|
|
|
|
|
|
#if 0
|
|
void SystemInfo::SetTestOutput(int index, bool flag)
|
|
{
|
|
IOCfgWrapper* ioCfgWrapper = ConfigManager::Instance()->GetIoCfgWrapper();
|
|
if (!ioCfgWrapper)return;
|
|
vector<IOCfg*>* cfgs = &ioCfgWrapper->m_OutputCfgs;
|
|
for (size_t i = 0; i < cfgs->size(); ++i) {
|
|
IOCfg* cfg = (*cfgs)[i];
|
|
if (cfg->m_index == index) {
|
|
if (cfg->m_isLowEffective) {
|
|
if (flag) {
|
|
m_TestOutputState = m_TestOutputState&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
else {
|
|
m_TestOutputState = m_TestOutputState | (1 << (cfg->m_index - 1));
|
|
}
|
|
}
|
|
else {
|
|
if (flag) {
|
|
m_TestOutputState = m_TestOutputState | (1 << (cfg->m_index - 1));
|
|
}
|
|
else {
|
|
m_TestOutputState = m_TestOutputState&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void SystemInfo::SetTestInput(int index, bool flag)
|
|
{
|
|
IOCfgWrapper* ioCfgWrapper = ConfigManager::Instance()->GetIoCfgWrapper();
|
|
vector<IOCfg*>* cfgs = &ioCfgWrapper->m_InputCfgs;
|
|
for (size_t i = 0; i < cfgs->size(); ++i) {
|
|
IOCfg* cfg = (*cfgs)[i];
|
|
if (cfg->m_index == index) {
|
|
if (cfg->m_isLowEffective) {
|
|
if (flag) {
|
|
m_TestInputState = m_TestInputState&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
else {
|
|
m_TestInputState = m_TestInputState | (1 << (cfg->m_index - 1));
|
|
}
|
|
}
|
|
else {
|
|
if (flag) {
|
|
m_TestInputState = m_TestInputState | (1 << (cfg->m_index - 1));
|
|
}
|
|
else {
|
|
m_TestInputState = m_TestInputState&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void SystemInfo::SetTestExtOut1(int index, bool flag)
|
|
{
|
|
IOCfgWrapper* ioCfgWrapper = ConfigManager::Instance()->GetIoCfgWrapper();
|
|
vector<IOCfg*>* cfgs = &ioCfgWrapper->m_Extout1Cfgs;
|
|
for (size_t i = 0; i < cfgs->size(); ++i) {
|
|
IOCfg* cfg = (*cfgs)[i];
|
|
if (cfg->m_index == index) {
|
|
if (cfg->m_isLowEffective) {
|
|
if (flag) {
|
|
m_TestExtout1State = m_TestExtout1State&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
else {
|
|
m_TestExtout1State = m_TestExtout1State | (1 << (cfg->m_index - 1));
|
|
}
|
|
}
|
|
else {
|
|
if (flag) {
|
|
m_TestExtout1State = m_TestExtout1State | (1 << (cfg->m_index - 1));
|
|
}
|
|
else {
|
|
m_TestExtout1State = m_TestExtout1State&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void SystemInfo::SetTestExtIn1(int index, bool flag)
|
|
{
|
|
IOCfgWrapper* ioCfgWrapper = ConfigManager::Instance()->GetIoCfgWrapper();
|
|
vector<IOCfg*>* cfgs = &ioCfgWrapper->m_Extin1Cfgs;
|
|
for (size_t i = 0; i < cfgs->size(); ++i) {
|
|
IOCfg* cfg = (*cfgs)[i];
|
|
if (cfg->m_index == index) {
|
|
if (cfg->m_isLowEffective) {
|
|
if (flag) {
|
|
m_TestExtin1State = m_TestExtin1State&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
else {
|
|
m_TestExtin1State = m_TestExtin1State | (1 << (cfg->m_index - 1));
|
|
}
|
|
}
|
|
else {
|
|
if (flag) {
|
|
m_TestExtin1State = m_TestExtin1State | (1 << (cfg->m_index - 1));
|
|
}
|
|
else {
|
|
m_TestExtin1State = m_TestExtin1State&(~(1 << (cfg->m_index - 1)));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
#endif
|