From 4a348e2c6cb3ec3ef19cbba1b2c5db366842368a Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 27 Apr 2016 10:12:21 -0700 Subject: [PATCH] Revise CaptureThread loop to not get stuck if SD write speed too slow. --- firmware/application/capture_thread.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/application/capture_thread.hpp b/firmware/application/capture_thread.hpp index e43fbcfa..d3b6841b 100644 --- a/firmware/application/capture_thread.hpp +++ b/firmware/application/capture_thread.hpp @@ -134,12 +134,12 @@ private: StreamOutput stream { write_size_log2, buffer_count_log2 }; while( !chThdShouldTerminate() ) { - chEvtWaitAny(EVT_MASK_CAPTURE_THREAD); - - while( stream.available() >= write_size ) { + if( stream.available() >= write_size ) { if( !transfer(stream, write_buffer.get()) ) { return false; } + } else { + chEvtWaitAny(EVT_MASK_CAPTURE_THREAD); } }