Skip to content

Commit

Permalink
Merge pull request #18 from tidewise/read-cmd_in-once-per-update-hook
Browse files Browse the repository at this point in the history
fix: read cmd in once per update hook
  • Loading branch information
wvmcastro authored Dec 17, 2024
2 parents 9b57973 + af0c7f8 commit 9fe580c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tasks/Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ void Task::publishFault()
}
void Task::updateHook()
{
while (_cmd_in.read(m_cmd_in) == RTT::NewData) {
TaskBase::updateHook();

if (_cmd_in.read(m_cmd_in) == RTT::NewData) {
if (m_cmd_in.elements.size() != 1) {
return exception(INVALID_COMMAND_SIZE);
}
Expand All @@ -185,8 +187,6 @@ void Task::updateHook()

auto state = readAndPublishControllerStates();
evaluateInverterStatus(state.inverter_status);

TaskBase::updateHook();
}
void Task::processIO()
{
Expand Down

0 comments on commit 9fe580c

Please sign in to comment.