Skip to content
Snippets Groups Projects
Commit a4c63bea authored by fortissBot's avatar fortissBot
Browse files

Laser range finder: error value -1

refs 7886
parent d39f1cc7
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,13 @@ GEN_TYPE_boolean lrf_is_noval() {
/** Get one distance measurement from the laser range finder. */
GEN_TYPE_int lrf_read() {
if (uart_filestream == -1)
return -1;
// free buffer
uart_flush();
char bytes[5];
int n_read = 0;
......@@ -38,9 +45,6 @@ GEN_TYPE_int lrf_read() {
int d;
// free buffer
uart_flush();
// looks like a blocking call and actually is but is always very fast
// since it only has to read the queue
while (1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment