mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 07:33:33 +08:00
Cleanup a bit.
This commit is contained in:
@@ -173,15 +173,13 @@ int read_data(int uart, int *id)
|
|||||||
const int timeout = 1000;
|
const int timeout = 1000;
|
||||||
struct pollfd fds[] = { { .fd = uart, .events = POLLIN } };
|
struct pollfd fds[] = { { .fd = uart, .events = POLLIN } };
|
||||||
|
|
||||||
|
char mode;
|
||||||
if (poll(fds, 1, timeout) > 0) {
|
if (poll(fds, 1, timeout) > 0) {
|
||||||
|
/* Get the mode: binary or text */
|
||||||
/* get the mode: binary or text */
|
|
||||||
char mode;
|
|
||||||
read(uart, &mode, 1);
|
read(uart, &mode, 1);
|
||||||
|
/* Read the device ID being polled */
|
||||||
read(uart, id, 1);
|
read(uart, id, 1);
|
||||||
|
|
||||||
//printf("[%x %x]\n", mode, *id);
|
|
||||||
/* if we have a binary mode request */
|
/* if we have a binary mode request */
|
||||||
if (mode != BINARY_MODE_REQUEST_ID) {
|
if (mode != BINARY_MODE_REQUEST_ID) {
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@@ -266,10 +264,7 @@ int hott_telemetry_thread_main(int argc, char *argv[])
|
|||||||
default:
|
default:
|
||||||
continue; // Not a module we support.
|
continue; // Not a module we support.
|
||||||
}
|
}
|
||||||
//printf("Write start\n");
|
|
||||||
send_data(uart, buffer, size);
|
send_data(uart, buffer, size);
|
||||||
} else {
|
|
||||||
printf("NOK: %x\n", id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user