Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
project("AOG-TaskController")
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 3)
set(PROJECT_VERSION_PATCH 1)
set(PROJECT_VERSION_PATCH 2)
set(PROJECT_VERSION
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
)
Expand Down
18 changes: 18 additions & 0 deletions src/task_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ bool ClientState::is_element_or_parent_off(std::uint16_t elementNumber) const
auto childObject = nonConstPool.get_object_by_index(j);
if (childObject && childObject->get_object_id() == childId)
{
// Check if child is a DeviceElement with matching element number
if (childObject->get_object_type() == isobus::task_controller_object::ObjectTypes::DeviceElement)
{
auto childElementObject = std::dynamic_pointer_cast<isobus::task_controller_object::DeviceElementObject>(childObject);
Expand All @@ -200,6 +201,23 @@ bool ClientState::is_element_or_parent_off(std::uint16_t elementNumber) const
return is_element_or_parent_off(elementObject->get_element_number());
}
}
// Check if child is a DeviceProcessData whose DDI is mapped to the target element number
else if (childObject->get_object_type() == isobus::task_controller_object::ObjectTypes::DeviceProcessData)
{
auto processDataObject = std::dynamic_pointer_cast<isobus::task_controller_object::DeviceProcessDataObject>(childObject);
if (processDataObject)
{
auto ddi = static_cast<isobus::DataDescriptionIndex>(processDataObject->get_ddi());
auto parentElementNumber = elementObject->get_element_number();
if (has_element_number_for_ddi(ddi) &&
get_element_number_for_ddi(ddi) == elementNumber &&
parentElementNumber != elementNumber)
{
// Found a different parent element, recursively check if it or its parents are off
return is_element_or_parent_off(parentElementNumber);
}
}
}
}
}
}
Expand Down
Loading