Skip to content

Commit

Permalink
Stop motors on save
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Oct 1, 2024
1 parent f5593ad commit 5813eaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2790,6 +2790,11 @@ MspHelper.prototype.sendSerialConfig = function(callback) {
};

MspHelper.prototype.writeConfiguration = function(reboot, callback) {
// We need some protection when testing motors on motors tab
if (!FC.CONFIG.armingDisabled) {
this.setArmingEnabled(false, false);
}

setTimeout(function() {
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function() {
gui_log(i18n.getMessage('configurationEepromSaved'));
Expand Down
4 changes: 4 additions & 0 deletions src/js/tabs/motors.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ motors.initialize = async function (callback) {
// Send enable extended dshot telemetry command
const buffer = [];

// this should include check for using extended dshot telemetry
buffer.push8(DshotCommand.dshotCommandType_e.DSHOT_CMD_TYPE_BLOCKING);
buffer.push8(255); // Send to all escs
buffer.push8(1); // 1 command
Expand Down Expand Up @@ -994,6 +995,9 @@ motors.initialize = async function (callback) {
}
}

// After saving configuration [in another tab], arming will be disabled
motorsRunning = motorsRunning && !FC.CONFIG.armingDisabled;

if (motorsRunning) {
motorsEnableTestModeElement.prop('checked', true).trigger('change');

Expand Down

0 comments on commit 5813eaf

Please sign in to comment.