commit eb248c3501c355afdd096d5f9dfd5b8e97a47be5
parent 4b56cb17f3bea40b329ae0861ab680d527ff2b09
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sun, 25 Jul 2021 00:30:48 +0200
do not send multiple programs of the same type if the queue is too full, only send the latest version
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/source/virusLib/microcontroller.cpp b/source/virusLib/microcontroller.cpp
@@ -121,7 +121,17 @@ bool Microcontroller::sendPreset(uint8_t program, const std::vector<TWord>& pres
if(m_hdi08.hasDataToSend() || needsToWaitForHostBits(0,1))
{
+ for(auto it = m_pendingPresetWrites.begin(); it != m_pendingPresetWrites.end();)
+ {
+ const auto& pendingPreset = *it;
+ if (pendingPreset.isMulti == isMulti && pendingPreset.program == program)
+ it = m_pendingPresetWrites.erase(it);
+ else
+ ++it;
+ }
+
m_pendingPresetWrites.emplace_back(SPendingPresetWrite{program, isMulti, preset});
+
return true;
}