Added ability to read buildid which is necessary in order to grab the proper firmware files for the given hardware
This commit is contained in:
@@ -46,6 +46,7 @@ UDSFirmwareUploaderWindow::UDSFirmwareUploaderWindow(const QVector<CANFrame> *fr
|
|||||||
connect(ui->btnLoadFile, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleLoadFile);
|
connect(ui->btnLoadFile, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleLoadFile);
|
||||||
connect(ui->btnStartStop, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleStartStop);
|
connect(ui->btnStartStop, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleStartStop);
|
||||||
connect(ui->btnAbort, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleAbort);
|
connect(ui->btnAbort, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleAbort);
|
||||||
|
connect(ui->btnReadBuildID, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleReadBuildID);
|
||||||
connect(ui->btnBrowseTeslaDir, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleBrowseTeslaDir);
|
connect(ui->btnBrowseTeslaDir, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleBrowseTeslaDir);
|
||||||
connect(ui->btnReloadNodes, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleReloadNodes);
|
connect(ui->btnReloadNodes, &QPushButton::clicked, this, &UDSFirmwareUploaderWindow::handleReloadNodes);
|
||||||
connect(udsHandler, &UDS_HANDLER::newUDSMessage, this, &UDSFirmwareUploaderWindow::gotUDSReply);
|
connect(udsHandler, &UDS_HANDLER::newUDSMessage, this, &UDSFirmwareUploaderWindow::gotUDSReply);
|
||||||
@@ -83,6 +84,7 @@ void UDSFirmwareUploaderWindow::setState(UPLOAD_STATE newState)
|
|||||||
ui->btnStartStop->setEnabled(true);
|
ui->btnStartStop->setEnabled(true);
|
||||||
ui->btnAbort->setEnabled(false);
|
ui->btnAbort->setEnabled(false);
|
||||||
ui->btnLoadFile->setEnabled(true);
|
ui->btnLoadFile->setEnabled(true);
|
||||||
|
ui->btnReadBuildID->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +156,7 @@ void UDSFirmwareUploaderWindow::startUpload()
|
|||||||
ui->btnStartStop->setEnabled(false);
|
ui->btnStartStop->setEnabled(false);
|
||||||
ui->btnAbort->setEnabled(true);
|
ui->btnAbort->setEnabled(true);
|
||||||
ui->btnLoadFile->setEnabled(false);
|
ui->btnLoadFile->setEnabled(false);
|
||||||
|
ui->btnReadBuildID->setEnabled(false);
|
||||||
|
|
||||||
udsHandler->setReception(true);
|
udsHandler->setReception(true);
|
||||||
udsHandler->addFilter(busId, responseId, 0x7FF);
|
udsHandler->addFilter(busId, responseId, 0x7FF);
|
||||||
@@ -332,6 +335,41 @@ void UDSFirmwareUploaderWindow::sendTesterPresent()
|
|||||||
udsHandler->sendUDSFrame(msg);
|
udsHandler->sendUDSFrame(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDSFirmwareUploaderWindow::handleReadBuildID()
|
||||||
|
{
|
||||||
|
if (currentState != STATE_IDLE && currentState != STATE_COMPLETE && currentState != STATE_ERROR)
|
||||||
|
return;
|
||||||
|
|
||||||
|
busId = ui->spinBus->value();
|
||||||
|
targetId = Utility::ParseStringToNum(ui->txtTargetID->text());
|
||||||
|
responseId = Utility::ParseStringToNum(ui->txtResponseID->text());
|
||||||
|
|
||||||
|
ui->btnReadBuildID->setEnabled(false);
|
||||||
|
|
||||||
|
udsHandler->setReception(true);
|
||||||
|
udsHandler->addFilter(busId, responseId, 0x7FF);
|
||||||
|
|
||||||
|
logMessage(QString("Reading build ID from 0x%1 (response 0x%2, bus %3)...")
|
||||||
|
.arg(targetId, 0, 16).arg(responseId, 0, 16).arg(busId));
|
||||||
|
|
||||||
|
sendReadBuildID();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDSFirmwareUploaderWindow::sendReadBuildID()
|
||||||
|
{
|
||||||
|
UDS_MESSAGE msg;
|
||||||
|
msg.bus = busId;
|
||||||
|
msg.setFrameId(targetId);
|
||||||
|
msg.service = UDS_SERVICES::READ_BY_ID;
|
||||||
|
msg.subFuncLen = 2;
|
||||||
|
msg.subFunc = 0xF180;
|
||||||
|
|
||||||
|
udsHandler->setFlowCtrl(true); //we need to generate flow control messages for this read request.
|
||||||
|
udsHandler->sendUDSFrame(msg);
|
||||||
|
setState(STATE_WAIT_BUILD_ID_RESP);
|
||||||
|
timeoutTimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
void UDSFirmwareUploaderWindow::handleNRC(int nrc)
|
void UDSFirmwareUploaderWindow::handleNRC(int nrc)
|
||||||
{
|
{
|
||||||
QString desc = udsHandler->getNegativeResponseLong(nrc);
|
QString desc = udsHandler->getNegativeResponseLong(nrc);
|
||||||
@@ -455,6 +493,28 @@ void UDSFirmwareUploaderWindow::gotUDSReply(UDS_MESSAGE msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case STATE_WAIT_BUILD_ID_RESP:
|
||||||
|
{
|
||||||
|
// READ_BY_ID (0x22) positive response (0x62): service byte stripped by UDS handler.
|
||||||
|
// msg.payload() = [0xF1, 0x80, ..., buildId at indices 6-9]
|
||||||
|
// This corresponds to bytes 6-10 of the raw ISOTP assembled frame.
|
||||||
|
if (dataLen >= 10)
|
||||||
|
{
|
||||||
|
quint32 buildId = (data[6] << 24) + (data[7] << 16) + (data[8] << 8) + data[9];
|
||||||
|
QString buildIdStr = QString::number(buildId);
|
||||||
|
logMessage("Build ID: " + buildIdStr);
|
||||||
|
ui->lblBuildID->setText(buildIdStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logMessage(QString("Build ID response too short (%1 bytes in payload)").arg(dataLen));
|
||||||
|
}
|
||||||
|
udsHandler->clearAllFilters();
|
||||||
|
udsHandler->setReception(false);
|
||||||
|
setState(STATE_IDLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ enum UPLOAD_STATE
|
|||||||
STATE_WAIT_EXIT_RESP,
|
STATE_WAIT_EXIT_RESP,
|
||||||
STATE_SEND_ECU_RESET,
|
STATE_SEND_ECU_RESET,
|
||||||
STATE_WAIT_RESET_RESP,
|
STATE_WAIT_RESET_RESP,
|
||||||
|
STATE_WAIT_BUILD_ID_RESP,
|
||||||
STATE_COMPLETE,
|
STATE_COMPLETE,
|
||||||
STATE_ERROR
|
STATE_ERROR
|
||||||
};
|
};
|
||||||
@@ -60,6 +61,7 @@ private slots:
|
|||||||
void handleLoadFile();
|
void handleLoadFile();
|
||||||
void handleStartStop();
|
void handleStartStop();
|
||||||
void handleAbort();
|
void handleAbort();
|
||||||
|
void handleReadBuildID();
|
||||||
void handleBrowseTeslaDir();
|
void handleBrowseTeslaDir();
|
||||||
void handleReloadNodes();
|
void handleReloadNodes();
|
||||||
void handleNodeChanged(int index);
|
void handleNodeChanged(int index);
|
||||||
@@ -83,6 +85,7 @@ private:
|
|||||||
void sendTransferExit();
|
void sendTransferExit();
|
||||||
void sendECUReset();
|
void sendECUReset();
|
||||||
void sendTesterPresent();
|
void sendTesterPresent();
|
||||||
|
void sendReadBuildID();
|
||||||
void handleNRC(int nrc);
|
void handleNRC(int nrc);
|
||||||
void advanceState();
|
void advanceState();
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>624</width>
|
<width>624</width>
|
||||||
<height>520</height>
|
<height>527</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -44,44 +44,83 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="btnBrowseTeslaDir">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="btnReloadNodes">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reload</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="labelNode">
|
<widget class="QLabel" name="labelNode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Target ECU:</string>
|
<string>Target ECU:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QComboBox" name="cmbTeslaNode"/>
|
<widget class="QComboBox" name="cmbTeslaNode"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="labelRespID">
|
<widget class="QLabel" name="labelRespID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Target Response ID:</string>
|
<string>Target Response ID:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QLineEdit" name="txtResponseID">
|
<widget class="QLineEdit" name="txtResponseID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0x7E8</string>
|
<string>0x7E8</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="labelTargetID">
|
<widget class="QLabel" name="labelTargetID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Target Request ID:</string>
|
<string>Target Request ID:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QLineEdit" name="txtTargetID">
|
<widget class="QLineEdit" name="txtTargetID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0x7E0</string>
|
<string>0x7E0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="labelBuildID">
|
||||||
|
<property name="text">
|
||||||
|
<string>Device Build ID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnReadBuildID">
|
||||||
|
<property name="text">
|
||||||
|
<string>Read Build ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lblBuildID">
|
||||||
|
<property name="text">
|
||||||
|
<string>(not read)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="labelSession">
|
<widget class="QLabel" name="labelSession">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -110,20 +149,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
|
||||||
<widget class="QLabel" name="labelAddr">
|
|
||||||
<property name="text">
|
|
||||||
<string>Flash Address:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="1">
|
|
||||||
<widget class="QLineEdit" name="txtFlashAddr">
|
|
||||||
<property name="text">
|
|
||||||
<string>0x08000000</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1">
|
<item row="9" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
@@ -151,17 +176,17 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="10" column="0">
|
||||||
<widget class="QPushButton" name="btnReloadNodes">
|
<widget class="QLabel" name="labelAddr">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reload</string>
|
<string>Flash Address:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="QPushButton" name="btnBrowseTeslaDir">
|
<widget class="QLineEdit" name="txtFlashAddr">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse...</string>
|
<string>0x08000000</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user