설정프로그램 추가

main
Imbis 6 months ago
parent 32b27345d6
commit efb86b3cb5

@ -139,6 +139,7 @@ BEGIN_MESSAGE_MAP(CTimeSetDlg, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON_CONNECT, &CTimeSetDlg::OnBnClickedButtonConnect)
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_THRESHOLD, &CTimeSetDlg::OnBnClickedButtonSetThreshold)
END_MESSAGE_MAP()
@ -448,6 +449,7 @@ void CTimeSetDlg::OnBnClickedButtonConnect()
GetDlgItem(IDC_COMBO_SERIAL_LIST)->EnableWindow(true);
GetDlgItem(IDC_BUTTON_SET_LOCAL_TIME)->EnableWindow(false);
GetDlgItem(IDC_BUTTON_SET_USER_TIME)->EnableWindow(false);
GetDlgItem(IDC_BUTTON_SET_THRESHOLD)->EnableWindow(false);
}
else
{
@ -506,6 +508,9 @@ void CTimeSetDlg::OnBnClickedButtonConnect()
GetDlgItem(IDC_COMBO_SERIAL_LIST)->EnableWindow(false);
GetDlgItem(IDC_BUTTON_SET_LOCAL_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);
}
}

@ -60,4 +60,5 @@ public:
afx_msg void OnBnClickedButtonConnect();
afx_msg void OnBnClickedButtonSetLocalTime();
afx_msg void OnBnClickedButtonSetUserTime();
afx_msg void OnBnClickedButtonSetThreshold();
};

@ -14,6 +14,9 @@
#define IDC_EDIT_SEC 1008
#define IDC_BUTTON_SET_USER_TIME 1009
#define IDC_BUTTON_SET_LOCAL_TIME 1010
#define IDC_EDIT_CO2_MIN 1011
#define IDC_EDIT_CO2_MAX 1012
#define IDC_BUTTON_SET_THRESHOLD 1013
// Next default values for new objects
//
@ -21,7 +24,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1010
#define _APS_NEXT_CONTROL_VALUE 1012
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Loading…
Cancel
Save