fix WaitForResponse (without timeout)

This commit is contained in:
pwpiwi 2020-02-06 07:59:18 +01:00
parent 01aa068b6f
commit df7b80fecc

View file

@ -472,7 +472,6 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
#endif #endif
uint64_t start_time = msclock(); uint64_t start_time = msclock();
uint64_t end_time = start_time + ms_timeout;
if (response == NULL) { if (response == NULL) {
response = &resp; response = &resp;
@ -480,7 +479,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
// Wait until the command is received // Wait until the command is received
while (true) { while (true) {
if (msclock() > end_time) { if (ms_timeout != -1 && msclock() > start_time + ms_timeout) {
break; // timeout break; // timeout
} }
if (msclock() - start_time > 2000 && show_warning) { if (msclock() - start_time > 2000 && show_warning) {