diff --git a/firmware/application/io_wave.cpp b/firmware/application/io_wave.cpp index f8249205..57cc5568 100644 --- a/firmware/application/io_wave.cpp +++ b/firmware/application/io_wave.cpp @@ -125,7 +125,7 @@ uint16_t WAVFileReader::bits_per_sample() { Optional WAVFileWriter::create( const std::filesystem::path& filename, size_t sampling_rate_set, - std::string title_set + const std::string& title_set ) { sampling_rate = sampling_rate_set; title = title_set; @@ -139,19 +139,24 @@ Optional WAVFileWriter::create( Optional WAVFileWriter::update_header() { header_t header { sampling_rate, (uint32_t)bytes_written - sizeof(header_t), info_chunk_size }; + const auto seek_0_result = file.seek(0); if( seek_0_result.is_error() ) { return seek_0_result.error(); } + const auto old_position = seek_0_result.value(); + const auto write_result = file.write(&header, sizeof(header)); if( write_result.is_error() ) { return write_result.error(); } + const auto seek_old_result = file.seek(old_position); if( seek_old_result.is_error() ) { return seek_old_result.error(); } + return { }; } diff --git a/firmware/application/io_wave.hpp b/firmware/application/io_wave.hpp index 6bebc020..baf43cd6 100644 --- a/firmware/application/io_wave.hpp +++ b/firmware/application/io_wave.hpp @@ -173,7 +173,7 @@ public: Optional create( const std::filesystem::path& filename, size_t sampling_rate, - std::string title_set + const std::string& title_set ); private: diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 7d4980d8..6138ff75 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -23,7 +23,6 @@ // Color bitmaps generated with: // Gimp image > indexed colors (16), then "xxd -i *.bmp" -//TEST: ADS-B tx velocity and squawk frames //TEST: Menuview refresh, seems to blink a lot //TEST: Check AFSK transmit end, skips last bits ? //TEST: Imperial in whipcalc diff --git a/firmware/portapack-h1-havoc.bin b/firmware/portapack-h1-havoc.bin index 0f2656d4..582c037b 100644 Binary files a/firmware/portapack-h1-havoc.bin and b/firmware/portapack-h1-havoc.bin differ