FrogPilot features - Panda flashing button in "Device" panel
This commit is contained in:
parent
693a2a083e
commit
7e71422936
@ -470,6 +470,30 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
|
|||||||
});
|
});
|
||||||
addItem(deleteDrivingDataBtn);
|
addItem(deleteDrivingDataBtn);
|
||||||
|
|
||||||
|
// Panda flashing button
|
||||||
|
auto flashPandaBtn = new ButtonControl(tr("Flash Panda"), tr("FLASH"), tr("Use this button to troubleshoot and update the Panda device's firmware."));
|
||||||
|
connect(flashPandaBtn, &ButtonControl::clicked, [=]() {
|
||||||
|
if (ConfirmationDialog::confirm(tr("Are you sure you want to flash the Panda?"), tr("Flash"), this)) {
|
||||||
|
std::thread([=]() {
|
||||||
|
QProcess process;
|
||||||
|
flashPandaBtn->setValue(tr("Flashing..."));
|
||||||
|
|
||||||
|
process.setWorkingDirectory("/data/openpilot/panda/board");
|
||||||
|
process.start("/bin/sh", QStringList{"-c", "./recover.py"});
|
||||||
|
process.waitForFinished();
|
||||||
|
process.start("/bin/sh", QStringList{"-c", "./flash.py"});
|
||||||
|
process.waitForFinished();
|
||||||
|
|
||||||
|
process.setWorkingDirectory("/data/openpilot/panda/tests");
|
||||||
|
process.start("/bin/sh", QStringList{"-c", "python reflash_internal_panda.py"});
|
||||||
|
process.waitForFinished();
|
||||||
|
|
||||||
|
Hardware::reboot();
|
||||||
|
}).detach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addItem(flashPandaBtn);
|
||||||
|
|
||||||
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
|
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
|
||||||
for (auto btn : findChildren<ButtonControl *>()) {
|
for (auto btn : findChildren<ButtonControl *>()) {
|
||||||
btn->setEnabled(offroad);
|
btn->setEnabled(offroad);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user