Invalid state now frees up allocated memory
Semaphore is reset so receiver can reuse said entry
This commit is contained in:
parent
851cbb6e52
commit
1e9a831361
1 changed files with 2 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue