|
|
@ -1059,24 +1059,28 @@ void COtherMonitorDevMgr::OnO2ConcentrationCommRecv()
|
|
|
|
//读取机台的电流电压值
|
|
|
|
//读取机台的电流电压值
|
|
|
|
void COtherMonitorDevMgr::ReadDeviceCurrentAndVoltage()
|
|
|
|
void COtherMonitorDevMgr::ReadDeviceCurrentAndVoltage()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ComComm Comm;
|
|
|
|
if (!DevComm.IsOpen())
|
|
|
|
if(!Comm.Open(m_DeviceCurrentAndVoltageCommPort,COMM_BAUD_RATE_9600))
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DevComm.Open(m_DeviceCurrentAndVoltageCommPort, COMM_BAUD_RATE_9600))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevCurrent1, Comm);
|
|
|
|
}
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevCurrent2, Comm);
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevCurrent1);
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevCurrent3, Comm);
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevCurrent2);
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevVoltage1, Comm);
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevCurrent3);
|
|
|
|
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevVoltage1);
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevSmoke,CommMgr);
|
|
|
|
ReadDeviceCurrentAndVoltageExt(_MonitorValType_DevSmoke);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
Comm.Close();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void COtherMonitorDevMgr::ReadDeviceCurrentAndVoltageExt(eMonitorValType MonitorValType,ComComm &Comm)
|
|
|
|
void COtherMonitorDevMgr::ReadDeviceCurrentAndVoltageExt(eMonitorValType MonitorValType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DevComm.IsOpen())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
Sleep(100);
|
|
|
|
Sleep(100);
|
|
|
|
|
|
|
|
|
|
|
|
unsigned char Buf[COM_BUF_LEN];
|
|
|
|
unsigned char Buf[COM_BUF_LEN];
|
|
|
|
memset(Buf, 0, COM_BUF_LEN);
|
|
|
|
memset(Buf, 0, COM_BUF_LEN);
|
|
|
|
//ADDR
|
|
|
|
//ADDR
|
|
|
@ -1122,10 +1126,10 @@ void COtherMonitorDevMgr::ReadDeviceCurrentAndVoltageExt(eMonitorValType Monitor
|
|
|
|
Buf[i++] = CRCH;
|
|
|
|
Buf[i++] = CRCH;
|
|
|
|
Buf[i++] = CRCL;
|
|
|
|
Buf[i++] = CRCL;
|
|
|
|
//发送
|
|
|
|
//发送
|
|
|
|
Comm.Write(Buf,i);
|
|
|
|
DevComm.Write(Buf, i);
|
|
|
|
Sleep(100);
|
|
|
|
Sleep(100);
|
|
|
|
memset(Buf, 0, COM_BUF_LEN);
|
|
|
|
memset(Buf, 0, COM_BUF_LEN);
|
|
|
|
Comm.Read(Buf,COM_BUF_LEN);
|
|
|
|
DevComm.Read(Buf, COM_BUF_LEN);
|
|
|
|
//从串口数据中提取读数
|
|
|
|
//从串口数据中提取读数
|
|
|
|
double ReadVal = -1;
|
|
|
|
double ReadVal = -1;
|
|
|
|
int high = Byte2Int(Buf[3]);
|
|
|
|
int high = Byte2Int(Buf[3]);
|
|
|
|