Skip to content

Commit

Permalink
Allow FW updating from QML
Browse files Browse the repository at this point in the history
  • Loading branch information
r3n33 committed Aug 14, 2024
1 parent 76abc76 commit 5dec4e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions vescinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ bool VescInterface::fwEraseBootloader(bool fwdCan)
return true;
}

bool VescInterface::fwUpload(QByteArray &newFirmware, bool isBootloader, bool fwdCan, bool isLzo)
bool VescInterface::fwUpload(QByteArray &newFirmware, bool isBootloader, bool fwdCan, bool isLzo, bool autoDisconnect)
{
mIsLastFwBootloader = isBootloader;
mFwUploadProgress = 0.0;
Expand Down Expand Up @@ -1687,7 +1687,7 @@ bool VescInterface::fwUpload(QByteArray &newFirmware, bool isBootloader, bool fw
if (!isBootloader) {
mCommands->jumpToBootloader(fwdCan, mLastFwParams.hwType, mLastFwParams.hw);
Utility::sleepWithEventLoop(500);
disconnectPort();
if (autoDisconnect) disconnectPort();
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion vescinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class VescInterface : public QObject
// Firmware Updates
bool fwEraseNewApp(bool fwdCan, quint32 fwSize);
bool fwEraseBootloader(bool fwdCan);
bool fwUpload(QByteArray &newFirmware, bool isBootloader = false, bool fwdCan = false, bool isLzo = true);
bool fwUpload(QByteArray &newFirmware, bool isBootloader = false, bool fwdCan = false, bool isLzo = true, bool autoDisconnect = true);
Q_INVOKABLE bool fwUpdate(QByteArray newFirmware) { return fwUpload(newFirmware, false, false, true, false); }
Q_INVOKABLE void fwUploadCancel();
Q_INVOKABLE double getFwUploadProgress();
Q_INVOKABLE QString getFwUploadStatus();
Expand Down

0 comments on commit 5dec4e7

Please sign in to comment.