Fix a bug where a HANDLE pointer is used instead of HANDLE.
This commit is contained in:
parent
a25ee5781a
commit
e5d720c55d
@ -93,8 +93,8 @@ bool InitCommPort(HANDLE* hComm, int PortNumber) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CloseCommPort(HANDLE* hComm) {
|
bool CloseCommPort(HANDLE* hComm) {
|
||||||
if (hComm != INVALID_HANDLE_VALUE)
|
if (*hComm != INVALID_HANDLE_VALUE)
|
||||||
CloseHandle(hComm);
|
CloseHandle(*hComm);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -104,7 +104,6 @@ bool CloseCommPort(HANDLE* hComm) {
|
|||||||
int32_t ReadCommPort(HANDLE hComm, uint8_t* buf, uint16_t count, int32_t byte_timeout_ms) {
|
int32_t ReadCommPort(HANDLE hComm, uint8_t* buf, uint16_t count, int32_t byte_timeout_ms) {
|
||||||
int TotalBytesRead = 0;
|
int TotalBytesRead = 0;
|
||||||
bool Status = false;
|
bool Status = false;
|
||||||
bool TimedOut = false;
|
|
||||||
ULONGLONG StartTime = 0;
|
ULONGLONG StartTime = 0;
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
int tmpByteCount;
|
int tmpByteCount;
|
||||||
@ -126,11 +125,10 @@ int32_t ReadCommPort(HANDLE hComm, uint8_t* buf, uint16_t count, int32_t byte_ti
|
|||||||
|
|
||||||
// did we time out yet??
|
// did we time out yet??
|
||||||
if (GetTickCount64() - StartTime > byte_timeout_ms) {
|
if (GetTickCount64() - StartTime > byte_timeout_ms) {
|
||||||
TimedOut = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (TotalBytesRead < count);
|
} while (TotalBytesRead < count);
|
||||||
|
|
||||||
return TotalBytesRead;
|
return TotalBytesRead;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user