From 2ae0114fe63364c477c4fa14e0b6bb2dcfab218f Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Wed, 2 Oct 2024 00:43:46 +0200 Subject: [PATCH] Stop motors on save --- src/js/msp/MSPHelper.js | 5 +++++ src/js/tabs/motors.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index 55e428f320a..c85d3f32d0e 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -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')); diff --git a/src/js/tabs/motors.js b/src/js/tabs/motors.js index a9997924717..9bcd2399599 100644 --- a/src/js/tabs/motors.js +++ b/src/js/tabs/motors.js @@ -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 @@ -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');