Skip to content

Commit

Permalink
Populate boards[].name for expansion boards
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Feb 22, 2022
1 parent 36c6c6d commit e584f0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/CAN/ExpansionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ constexpr ObjectModelTableEntry ExpansionManager::objectModelTable[] =
{ "firmwareVersion", OBJECT_MODEL_FUNC(self->FindIndexedBoard(context.GetLastIndex()).typeName, ExpansionDetail::firmwareVersion), ObjectModelEntryFlags::none },
{ "maxMotors", OBJECT_MODEL_FUNC((int32_t)self->FindIndexedBoard(context.GetLastIndex()).numDrivers), ObjectModelEntryFlags::none },
{ "mcuTemp", OBJECT_MODEL_FUNC_IF(self->FindIndexedBoard(context.GetLastIndex()).hasMcuTemp, self, 1), ObjectModelEntryFlags::live },
{ "name", OBJECT_MODEL_FUNC(self->FindIndexedBoard(context.GetLastIndex()).typeName, ExpansionDetail::longName), ObjectModelEntryFlags::none },
{ "shortName", OBJECT_MODEL_FUNC(self->FindIndexedBoard(context.GetLastIndex()).typeName, ExpansionDetail::shortName), ObjectModelEntryFlags::none },
{ "state", OBJECT_MODEL_FUNC(self->FindIndexedBoard(context.GetLastIndex()).state.ToString()), ObjectModelEntryFlags::none },
{ "uniqueId", OBJECT_MODEL_FUNC_IF(self->FindIndexedBoard(context.GetLastIndex()).uniqueId.IsValid(),
Expand Down Expand Up @@ -69,7 +70,7 @@ constexpr ObjectModelTableEntry ExpansionManager::objectModelTable[] =
constexpr uint8_t ExpansionManager::objectModelTableDescriptor[] =
{
6, // number of sections
13, // section 0: boards[]
14, // section 0: boards[]
3, // section 1: mcuTemp
3, // section 2: vIn
3, // section 3: v12
Expand Down
3 changes: 3 additions & 0 deletions src/ObjectModel/ObjectModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ void ExpressionValue::ExtractRequestedPart(const StringRef& rslt) const noexcept

switch((ExpansionDetail)param)
{
case ExpansionDetail::longName:
rslt.cat("Duet 3 Expansion ");
// no break
case ExpansionDetail::shortName:
rslt.catn(sVal, indexOfDivider1);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectModel/ObjectModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CanExpansionBoardDetails;

enum class ExpansionDetail : uint32_t
{
shortName, firmwareVersion, firmwareFileName, firmwareDate
shortName, firmwareVersion, firmwareFileName, firmwareDate, longName
};

#endif
Expand Down

0 comments on commit e584f0d

Please sign in to comment.