|
|
@ -139,6 +139,7 @@ BEGIN_MESSAGE_MAP(CTimeSetDlg, CDialogEx)
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_CONNECT, &CTimeSetDlg::OnBnClickedButtonConnect)
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_CONNECT, &CTimeSetDlg::OnBnClickedButtonConnect)
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SET_LOCAL_TIME, &CTimeSetDlg::OnBnClickedButtonSetLocalTime)
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SET_LOCAL_TIME, &CTimeSetDlg::OnBnClickedButtonSetLocalTime)
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SET_USER_TIME, &CTimeSetDlg::OnBnClickedButtonSetUserTime)
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SET_USER_TIME, &CTimeSetDlg::OnBnClickedButtonSetUserTime)
|
|
|
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SET_THRESHOLD, &CTimeSetDlg::OnBnClickedButtonSetThreshold)
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -448,6 +449,7 @@ void CTimeSetDlg::OnBnClickedButtonConnect()
|
|
|
|
GetDlgItem(IDC_COMBO_SERIAL_LIST)->EnableWindow(true);
|
|
|
|
GetDlgItem(IDC_COMBO_SERIAL_LIST)->EnableWindow(true);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_LOCAL_TIME)->EnableWindow(false);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_LOCAL_TIME)->EnableWindow(false);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_USER_TIME)->EnableWindow(false);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_USER_TIME)->EnableWindow(false);
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_THRESHOLD)->EnableWindow(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -506,6 +508,9 @@ void CTimeSetDlg::OnBnClickedButtonConnect()
|
|
|
|
GetDlgItem(IDC_COMBO_SERIAL_LIST)->EnableWindow(false);
|
|
|
|
GetDlgItem(IDC_COMBO_SERIAL_LIST)->EnableWindow(false);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_LOCAL_TIME)->EnableWindow(true);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_LOCAL_TIME)->EnableWindow(true);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_USER_TIME)->EnableWindow(true);
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_USER_TIME)->EnableWindow(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_SET_THRESHOLD)->EnableWindow(true);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -623,3 +628,57 @@ void CTimeSetDlg::OnBnClickedButtonSetUserTime()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CTimeSetDlg::OnBnClickedButtonSetThreshold()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
|
|
|
|
|
|
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
|
|
|
|
|
|
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
|
|
|
|
|
|
|
uint8_t TxData[100];
|
|
|
|
|
|
|
|
uint8_t TxIndex = 0;
|
|
|
|
|
|
|
|
uint16_t MaxData;
|
|
|
|
|
|
|
|
uint16_t MinData;
|
|
|
|
|
|
|
|
uint8_t i;
|
|
|
|
|
|
|
|
uint8_t checksum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TxData[TxIndex++] = 0x02;
|
|
|
|
|
|
|
|
TxData[TxIndex++] = 0x01;
|
|
|
|
|
|
|
|
TxData[TxIndex++] = 0x04;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CString strtemp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_CO2_MAX)->GetWindowText(strtemp);
|
|
|
|
|
|
|
|
MaxData = atoi(strtemp);
|
|
|
|
|
|
|
|
TxData[TxIndex++] = (MaxData >> 8) & 0xFF;
|
|
|
|
|
|
|
|
TxData[TxIndex++] = (MaxData >> 0) & 0xFF;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_CO2_MIN)->GetWindowText(strtemp);
|
|
|
|
|
|
|
|
MinData = atoi(strtemp);
|
|
|
|
|
|
|
|
TxData[TxIndex++] = (MinData >> 8) & 0xFF;
|
|
|
|
|
|
|
|
TxData[TxIndex++] = (MinData >> 0) & 0xFF;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (MaxData <= MinData)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox("Max / Min settings are incorrect.\r\nThe Max value must be greater than the Min value.", NULL, MB_ICONERROR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checksum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < TxIndex; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checksum += TxData[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TxData[TxIndex++] = checksum;
|
|
|
|
|
|
|
|
TxData[TxIndex++] = 0x03;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_Serial.IsOpen())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_Serial.Write(TxData, TxIndex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|