1
0
Fork 0

Eliminates excessive sleep waiting for response and send wait for fast_mode

This commit is contained in:
Shawn Nock 2019-06-18 15:07:14 -04:00
parent 50f987eb48
commit ed9e766423
1 changed files with 4 additions and 2 deletions

View File

@ -83,7 +83,7 @@ static void read_response(uint8_t *dest, size_t *len) {
if (timer_expired()) { if (timer_expired()) {
BAIL_OUT(ERR_TIMEOUT); BAIL_OUT(ERR_TIMEOUT);
} }
usleep(250000); usleep(5000);
continue; continue;
} }
BAIL_OUT(ERR_SERIAL_PORT); BAIL_OUT(ERR_SERIAL_PORT);
@ -246,7 +246,9 @@ static void wrap_and_send_pkt(uint8_t *data, size_t len, bool fast_mode) {
if (pos == out_buf) { if (pos == out_buf) {
write(serial_fd, start_pkt, sizeof(start_pkt)); write(serial_fd, start_pkt, sizeof(start_pkt));
} else { } else {
usleep(20000); if (!fast_mode) {
usleep(20000);
}
write(serial_fd, start_data, sizeof(start_data)); write(serial_fd, start_data, sizeof(start_data));
} }