From 0ca9ca8ad226bf887ce0873f47ae4c51bfacc9dc Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Sat, 1 Apr 2023 11:02:29 +0200 Subject: [PATCH] Invalid state now frees up allocated memory Semaphore is reset so receiver can reuse said entry --- Firmware/src/Messages/Parser.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/src/Messages/Parser.cpp b/Firmware/src/Messages/Parser.cpp index 2f6711b..500b448 100644 --- a/Firmware/src/Messages/Parser.cpp +++ b/Firmware/src/Messages/Parser.cpp @@ -398,7 +398,7 @@ auto message::parser::StateVisitor::operator()(state::Complete) -> State { } auto message::parser::StateVisitor::operator()(state::Invalid) -> State { message->second.give(); - return state::Invalid{}; + return state::Complete{}; } auto message::parser::parse( @@ -406,8 +406,7 @@ auto message::parser::parse( freertos::Queue &lightActionQueue) -> void { StateVisitor visitor{message, lightActionQueue}; State state{state::ModeSelection{}}; - while (!etl::holds_alternative(state) && - !etl::holds_alternative(state)) { + while (!etl::holds_alternative(state)) { state = etl::visit(visitor, state); } }