From f0b7ded1289f8b95e25d41e18eaea21a61070232 Mon Sep 17 00:00:00 2001 From: Simone Girardi Date: Fri, 20 Jan 2023 11:01:25 +0100 Subject: [PATCH] FirmwareUpdater: fixes and minor improvements: - 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. --- src/tools/FirmwareUpdater/mainwindow.cpp | 47 ++++++++++--------- .../ethLoader/ethLoaderLib/EthMaintainer.cpp | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/tools/FirmwareUpdater/mainwindow.cpp b/src/tools/FirmwareUpdater/mainwindow.cpp index dea8100556..95e7af79af 100755 --- a/src/tools/FirmwareUpdater/mainwindow.cpp +++ b/src/tools/FirmwareUpdater/mainwindow.cpp @@ -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); @@ -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); diff --git a/src/tools/ethLoader/ethLoaderLib/EthMaintainer.cpp b/src/tools/ethLoader/ethLoaderLib/EthMaintainer.cpp index 24dc6ba4d9..a213108689 100644 --- a/src/tools/ethLoader/ethLoaderLib/EthMaintainer.cpp +++ b/src/tools/ethLoader/ethLoaderLib/EthMaintainer.cpp @@ -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.