diff --git a/Window Tool/TimeSet/.vs/TimeSet/v15/.suo b/Window Tool/TimeSet/.vs/TimeSet/v15/.suo index 6e6ba91..017fca3 100644 Binary files a/Window Tool/TimeSet/.vs/TimeSet/v15/.suo and b/Window Tool/TimeSet/.vs/TimeSet/v15/.suo differ diff --git a/Window Tool/TimeSet/Debug/TimeSet.exe b/Window Tool/TimeSet/Debug/Co2_Time_MaxMin_Setting.exe similarity index 65% rename from Window Tool/TimeSet/Debug/TimeSet.exe rename to Window Tool/TimeSet/Debug/Co2_Time_MaxMin_Setting.exe index 55a8041..5bedf2b 100644 Binary files a/Window Tool/TimeSet/Debug/TimeSet.exe and b/Window Tool/TimeSet/Debug/Co2_Time_MaxMin_Setting.exe differ diff --git a/Window Tool/TimeSet/Debug/TimeSet.ilk b/Window Tool/TimeSet/Debug/TimeSet.ilk index c05de5f..1850a66 100644 Binary files a/Window Tool/TimeSet/Debug/TimeSet.ilk and b/Window Tool/TimeSet/Debug/TimeSet.ilk differ diff --git a/Window Tool/TimeSet/Debug/TimeSet.pdb b/Window Tool/TimeSet/Debug/TimeSet.pdb index 1ef21bb..0696d68 100644 Binary files a/Window Tool/TimeSet/Debug/TimeSet.pdb and b/Window Tool/TimeSet/Debug/TimeSet.pdb differ diff --git a/Window Tool/TimeSet/TimeSet/TimeSet.aps b/Window Tool/TimeSet/TimeSet/TimeSet.aps index 9fb6560..2646c3a 100644 Binary files a/Window Tool/TimeSet/TimeSet/TimeSet.aps and b/Window Tool/TimeSet/TimeSet/TimeSet.aps differ diff --git a/Window Tool/TimeSet/TimeSet/TimeSet.rc b/Window Tool/TimeSet/TimeSet/TimeSet.rc index 328b096..347e609 100644 Binary files a/Window Tool/TimeSet/TimeSet/TimeSet.rc and b/Window Tool/TimeSet/TimeSet/TimeSet.rc differ diff --git a/Window Tool/TimeSet/TimeSet/TimeSetDlg.cpp b/Window Tool/TimeSet/TimeSet/TimeSetDlg.cpp index ff28b86..3920067 100644 --- a/Window Tool/TimeSet/TimeSet/TimeSetDlg.cpp +++ b/Window Tool/TimeSet/TimeSet/TimeSetDlg.cpp @@ -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); + } +} diff --git a/Window Tool/TimeSet/TimeSet/TimeSetDlg.h b/Window Tool/TimeSet/TimeSet/TimeSetDlg.h index 3c27728..b7874c7 100644 --- a/Window Tool/TimeSet/TimeSet/TimeSetDlg.h +++ b/Window Tool/TimeSet/TimeSet/TimeSetDlg.h @@ -60,4 +60,5 @@ public: afx_msg void OnBnClickedButtonConnect(); afx_msg void OnBnClickedButtonSetLocalTime(); afx_msg void OnBnClickedButtonSetUserTime(); + afx_msg void OnBnClickedButtonSetThreshold(); }; diff --git a/Window Tool/TimeSet/TimeSet/resource.h b/Window Tool/TimeSet/TimeSet/resource.h index 5601592..8ac6fbf 100644 --- a/Window Tool/TimeSet/TimeSet/resource.h +++ b/Window Tool/TimeSet/TimeSet/resource.h @@ -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