From dc1ba7e6f3317826fff555d2293f02cc80597bde Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 27 Apr 2016 10:44:44 -0700 Subject: [PATCH] Move CaptureThread::write_size into run(). --- firmware/application/capture_thread.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/firmware/application/capture_thread.hpp b/firmware/application/capture_thread.hpp index b48cb1ec..e77a9b51 100644 --- a/firmware/application/capture_thread.hpp +++ b/firmware/application/capture_thread.hpp @@ -76,7 +76,6 @@ public: size_t write_size_log2, size_t buffer_count_log2 ) : write_size_log2 { write_size_log2 }, - write_size { 1U << write_size_log2 }, buffer_count_log2 { buffer_count_log2 }, file_path { std::move(file_path) } { @@ -108,7 +107,6 @@ public: private: const size_t write_size_log2; - const size_t write_size; const size_t buffer_count_log2; const std::string file_path; File file; @@ -124,6 +122,7 @@ private: return false; } + const size_t write_size = 1U << write_size_log2; const auto write_buffer = std::make_unique(write_size); if( !write_buffer ) { return false; @@ -133,7 +132,7 @@ private: while( !chThdShouldTerminate() ) { if( stream.available() >= write_size ) { - if( !transfer(stream, write_buffer.get()) ) { + if( !transfer(stream, write_buffer.get(), write_size) ) { return false; } } else { @@ -144,7 +143,7 @@ private: return true; } - bool transfer(StreamOutput& stream, uint8_t* const write_buffer) { + bool transfer(StreamOutput& stream, uint8_t* const write_buffer, const size_t write_size) { bool success = false; led_usb.on();