diff --git a/commands.cpp b/commands.cpp index c4735f70f..57008f9e3 100755 --- a/commands.cpp +++ b/commands.cpp @@ -1432,6 +1432,15 @@ void Commands::reboot() emitData(vb); } +void Commands::shutdown() +{ + VByteArray vb; + vb.vbAppendInt8(COMM_SHUTDOWN); + vb.vbAppendInt8(0); + vb.vbAppendInt8(0); + emitData(vb); +} + void Commands::sendAlive() { VByteArray vb; diff --git a/commands.h b/commands.h index a0612e716..fe2ace664 100644 --- a/commands.h +++ b/commands.h @@ -192,6 +192,7 @@ public slots: void setAppConfNoStore(); void detectMotorParam(double current, double min_rpm, double low_duty); void reboot(); + void shutdown(); void sendAlive(); void getDecodedPpm(); void getDecodedAdc(); diff --git a/mainwindow.cpp b/mainwindow.cpp index e0185e396..71826e024 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -161,6 +161,7 @@ MainWindow::MainWindow(QWidget *parent) : ui->actionClearConfigurationBackups->setIcon(Utility::getIcon("icons/Delete-96.png")); ui->actionBackupConfiguration->setIcon(Utility::getIcon("icons/Save as-96.png")); ui->actionReboot->setIcon(Utility::getIcon("icons/Refresh-96.png")); + ui->actionShutdown->setIcon(Utility::getIcon("icons/Shutdown-96.png")); ui->actionExit->setIcon(Utility::getIcon("icons/Shutdown-96.png")); ui->pageLabel->setPixmap(Utility::getIcon("logo.png")); ui->actionReconnect->setIcon(Utility::getIcon("icons/Connected-96.png")); @@ -1050,6 +1051,11 @@ void MainWindow::on_actionReboot_triggered() mVesc->commands()->reboot(); } +void MainWindow::on_actionShutdown_triggered() +{ + mVesc->commands()->shutdown(); +} + void MainWindow::on_stopButton_clicked() { mVesc->commands()->setCurrent(0); diff --git a/mainwindow.h b/mainwindow.h index 78895b52f..4ec0e03b9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -99,6 +99,7 @@ private slots: void on_actionReconnect_triggered(); void on_actionDisconnect_triggered(); void on_actionReboot_triggered(); + void on_actionShutdown_triggered(); void on_stopButton_clicked(); void on_fullBrakeButton_clicked(); void on_actionReadMcconf_triggered(); diff --git a/mainwindow.ui b/mainwindow.ui index e55a480cc..a5a7e6fbc 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -670,6 +670,7 @@ + @@ -756,7 +757,15 @@ Reboot - Reboot + Reboot via CPU reset + + + + + Shutdown + + + Shutdown (for controllers with auto-shutdown support only) diff --git a/mobile/Terminal.qml b/mobile/Terminal.qml index fc9e210a0..25dba5ed5 100644 --- a/mobile/Terminal.qml +++ b/mobile/Terminal.qml @@ -113,6 +113,13 @@ Item { } } } + MenuItem { + text: "Reboot" + onTriggered: { + mCommands.shutdown() + } + } + } } }