Skip to content

Commit

Permalink
Merge branch 'vedderb:master' into ci
Browse files Browse the repository at this point in the history
  • Loading branch information
darwinbeing authored Nov 17, 2024
2 parents f989788 + b4934a8 commit 2b005c6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
38 changes: 36 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static void showHelp()
qDebug() << "--eraseLisp : Erase lisp-script.";
qDebug() << "--uploadFirmware [path] : Upload firmware-file from path.";
qDebug() << "--uploadBootloaderBuiltin : Upload bootloader from generic included bootloaders.";
qDebug() << "--queryDeviceFwParams : Connect and print out device fw parameters.";
qDebug() << "--writeFileToSdCard [fileLocal:pathSdcard] : Write file to SD-card.";
qDebug() << "--packFirmware [fileIn:fileOut] : Pack firmware-file for compatibility with the bootloader. ";
qDebug() << "--packLisp [fileIn:fileOut] : Pack lisp-file and the included imports.";
Expand Down Expand Up @@ -310,6 +311,7 @@ int main(int argc, char *argv[])
bool eraseLisp = false;
QString firmwarePath = "";
bool uploadBootloaderBuiltin = false;
bool queryDeviceFwParams = false;
QString fwPackIn = "";
QString fwPackOut = "";
QString fileForSdIn = "";
Expand Down Expand Up @@ -597,6 +599,11 @@ int main(int argc, char *argv[])
found = true;
}

if (str == "--queryDeviceFwParams") {
queryDeviceFwParams = true;
found = true;
}

if (str == "--debugOutFile") {
if ((i + 1) < args.size()) {
i++;
Expand Down Expand Up @@ -1004,7 +1011,7 @@ int main(int argc, char *argv[])

if (isMcConf || isAppConf || isCustomConf || !lispPath.isEmpty() ||
eraseLisp || !firmwarePath.isEmpty() || uploadBootloaderBuiltin ||
!fileForSdIn.isEmpty() || bridgeAppData) {
queryDeviceFwParams || !fileForSdIn.isEmpty() || bridgeAppData) {
if (offscreen) {
qputenv("QT_QPA_PLATFORM", "offscreen");
}
Expand Down Expand Up @@ -1160,7 +1167,7 @@ int main(int argc, char *argv[])
}
}

if (isMcConf || isAppConf || isCustomConf) {
if (isMcConf || isAppConf || isCustomConf || queryDeviceFwParams) {
bool res = vesc->customConfigRxDone();
if (!res) {
res = Utility::waitSignal(vesc, SIGNAL(customConfigLoadDone()), 4000);
Expand Down Expand Up @@ -1341,6 +1348,33 @@ int main(int argc, char *argv[])
}
}

if (queryDeviceFwParams) {
FW_RX_PARAMS params = vesc->getLastFwRxParams();

QString fwStr;
QString strUuid = Utility::uuid2Str(params.uuid, true);

if (params.major >= 0) {
fwStr = QString("FW: V%1.%2").arg(params.major).arg(params.minor, 2, 10, QLatin1Char('0'));
if (!params.fwName.isEmpty()) {
fwStr += " (" + params.fwName + ")";
}

if (!params.hw.isEmpty()) {
fwStr += ", Hw: " + params.hw;
}

if (!strUuid.isEmpty()) {
fwStr += ", UUID: " + strUuid;
}

fwStr += ", isTestFw: " + QString::number(params.isTestFw);
fwStr += ", hwType: " + params.hwTypeStr();
fwStr += ", hwConfCrc: " + QString::number(params.hwConfCrc);
}
qInfo() << fwStr;
}

if (!firmwarePath.isEmpty()) {
QFile f(firmwarePath);
if (f.open(QIODevice::ReadOnly)) {
Expand Down
8 changes: 8 additions & 0 deletions signatures/version1/cla.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@
"created_at": "2024-09-11T17:30:34Z",
"repoId": 102395117,
"pullRequestNo": 385
},
{
"name": "sdb4",
"id": 122888950,
"comment_id": 2462020379,
"created_at": "2024-11-07T11:41:40Z",
"repoId": 102395117,
"pullRequestNo": 393
}
]
}

0 comments on commit 2b005c6

Please sign in to comment.