Skip to content

Commit

Permalink
FirmwareUpdater: fixes and minor improvements:
Browse files Browse the repository at this point in the history
- replace `else if` instead of `if` in `EthMaintainer` for `uprot_OPC_DISCOVER2`
- get the string type of a board using the convert function instead of checking manually the `info.boardtype` structure.
  • Loading branch information
sgiraz committed Jan 20, 2023
1 parent 34eccac commit f0b7ded
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
47 changes: 25 additions & 22 deletions src/tools/FirmwareUpdater/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,27 +1009,30 @@ void MainWindow::onAppendInfo(boardInfo2_t info,eOipv4addr_t address)
infoTreeWidget->addTopLevelItem(propertiesNode);

constexpr uint8_t maxNumberOfProcessesOnSingleCore {3};

QString type;
switch (info.boardtype) {
case eobrd_ethtype_ems4:
type = "ems";
break;
case eobrd_ethtype_mc4plus:
type = "mc4plus";
break;
case eobrd_ethtype_mc2plus:
type = "mc2plus";
break;
case eobrd_ethtype_none:
type = "none";
break;
case eobrd_ethtype_unknown:
type = "unknown";
break;
default:
break;
}

QString type = eoboards_type2string(eoboards_ethtype2type(info.boardtype));
// switch (info.boardtype) {
// case eobrd_ethtype_amc:
// type = "amc";
// break;
// case eobrd_ethtype_ems4:
// type = "ems";
// break;
// case eobrd_ethtype_mc4plus:
// type = "mc4plus";
// break;
// case eobrd_ethtype_mc2plus:
// type = "mc2plus";
// break;
// case eobrd_ethtype_none:
// type = "none";
// break;
// case eobrd_ethtype_unknown:
// type = "unknown";
// break;
// default:
// break;
// }

QTreeWidgetItem *typeNode = new QTreeWidgetItem(boardNode, QStringList() << "Type" << type);
boardNode->addChild(typeNode);
Expand Down Expand Up @@ -1093,7 +1096,7 @@ void MainWindow::onAppendInfo(boardInfo2_t info,eOipv4addr_t address)
boardNode->addChild(statusNode);

/*******************************************************************************/
bool isMulticore = info.processes.numberofthem > maxNumberOfProcessesOnSingleCore;
bool isMulticore = (eoboards_type2numberofcores(eoboards_ethtype2type(info.boardtype))) > 1 ? true : false;
QTreeWidgetItem *startUpNode = new QTreeWidgetItem(bootStrapNode, QStringList() << "Startup" << core->getProcessFromUint(info.processes.startup, isMulticore));
bootStrapNode->addChild(startUpNode);
bootStrapNode->setExpanded(true);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ethLoader/ethLoaderLib/EthMaintainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ string EthMaintainer::processDiscoveryReplies2(EthBoardList &boardlist, double w
}
}
}
if(uprot_OPC_DISCOVER2 == disc2->discoveryreply.reply.opc)
else if(uprot_OPC_DISCOVER2 == disc2->discoveryreply.reply.opc)
{
// the board has replied with the new multi-application-processes protocol.

Expand Down

0 comments on commit f0b7ded

Please sign in to comment.