Skip to content
Snippets Groups Projects
Commit 6044fda8 authored by bbartels's avatar bbartels
Browse files

quad: instruct virtual quad to relinquish cpu during I/O

parent 1b81541d
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,9 @@ test: all ...@@ -38,9 +38,9 @@ test: all
$(MAKE) -C src/queue test $(MAKE) -C src/queue test
$(MAKE) -C src/computation_graph test $(MAKE) -C src/computation_graph test
$(MAKE) -C src/quad_app test $(MAKE) -C src/quad_app test
# ruby scripts/tests/test_safety_checks.rb ruby scripts/tests/test_safety_checks.rb
# ruby scripts/tests/test_unix_uart.rb ruby scripts/tests/test_unix_uart.rb
# ruby scripts/tests/run_virtual_test_flight.rb ruby scripts/tests/run_virtual_test_flight.rb
clean: clean:
rm -rf $(INCDIR) $(LIBDIR) $(OUTDIR) $(EXEDIR) rm -rf $(INCDIR) $(LIBDIR) $(OUTDIR) $(EXEDIR)
......
...@@ -112,6 +112,7 @@ void * update_i2c_input_cache(void *arg) { ...@@ -112,6 +112,7 @@ void * update_i2c_input_cache(void *arg) {
cache[i].s = val; cache[i].s = val;
printf("%s: %ld\n", input_names[i], val); printf("%s: %ld\n", input_names[i], val);
} }
pthread_yield();
} }
return NULL; return NULL;
} }
...@@ -52,6 +52,6 @@ void * output_cached_led() { ...@@ -52,6 +52,6 @@ void * output_cached_led() {
sprintf(buff, "%d\n", on); sprintf(buff, "%d\n", on);
write(fifo, buff, strlen(buff)); write(fifo, buff, strlen(buff));
close(fifo); close(fifo);
usleep(500); // don't spam the reader pthread_yield();
} }
} }
...@@ -78,6 +78,7 @@ void * update_input_cache(void *arg) { ...@@ -78,6 +78,7 @@ void * update_input_cache(void *arg) {
printf("%s: Bad value - input not received\n", input_names[i]); printf("%s: Bad value - input not received\n", input_names[i]);
} }
} }
pthread_yield();
} }
return NULL; return NULL;
} }
...@@ -59,7 +59,7 @@ void * output_cache(void *arg) { ...@@ -59,7 +59,7 @@ void * output_cache(void *arg) {
sprintf(buff, "%ld\n", cache[i]); sprintf(buff, "%ld\n", cache[i]);
write(fifo, buff, strlen(buff)); write(fifo, buff, strlen(buff));
close(fifo); close(fifo);
usleep(500); // don't spam the reader pthread_yield();
} }
return NULL; return NULL;
} }
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