Invalid state now frees up allocated memory

Semaphore is reset so receiver can reuse said entry
This commit is contained in:
GHOSCHT 2023-04-01 11:02:29 +02:00
parent 851cbb6e52
commit 1e9a831361
No known key found for this signature in database

View file

@ -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<LightController::LightAction> &lightActionQueue) -> void {
StateVisitor visitor{message, lightActionQueue};
State state{state::ModeSelection{}};
while (!etl::holds_alternative<state::Invalid>(state) &&
!etl::holds_alternative<state::Complete>(state)) {
while (!etl::holds_alternative<state::Complete>(state)) {
state = etl::visit(visitor, state);
}
}