Skip to content

Commit 1c77543

Browse files
authored
Merge pull request #2970 from haslinghuis/fix-motor-stop
2 parents 8054aa7 + f572559 commit 1c77543

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/js/msp/MSPHelper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,10 +1741,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
17411741
console.log(`Unknown code detected: ${code}`);
17421742
} else {
17431743
console.log(`FC reports unsupported message error: ${code}`);
1744-
}
17451744

1746-
if (code === MSPCodes.MSP_SET_REBOOT) {
1747-
TABS.onboard_logging.mscRebootFailedCallback();
1745+
if (code === MSPCodes.MSP_SET_REBOOT) {
1746+
TABS.onboard_logging.mscRebootFailedCallback();
1747+
}
17481748
}
17491749

17501750
} else {

src/js/tabs/motors.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ motors.initialize = async function (callback) {
5555
// Update filtering defaults based on API version
5656
const FILTER_DEFAULT = FC.getFilterDefaults();
5757

58-
if (GUI.active_tab != 'motors') {
59-
GUI.active_tab = 'motors';
60-
}
58+
GUI.active_tab = 'motors';
6159

6260
await MSP.promise(MSPCodes.MSP_STATUS);
6361
await MSP.promise(MSPCodes.MSP_PID_ADVANCED);
@@ -884,7 +882,7 @@ motors.initialize = async function (callback) {
884882
];
885883

886884
motorsEnableTestModeElement.on('change', function () {
887-
let enabled = $(this).is(':checked');
885+
let enabled = motorsEnableTestModeElement.is(':checked');
888886
// prevent or disable testing if configHasChanged flag is set.
889887
if (self.configHasChanged) {
890888
if (enabled) {
@@ -900,17 +898,13 @@ motors.initialize = async function (callback) {
900898
if (motorsEnableTestModeElement.is(':checked')) {
901899
if (!ignoreKeys.includes(e.code)) {
902900
motorsEnableTestModeElement.prop('checked', false).trigger('change');
901+
document.removeEventListener('keydown', evt => disableMotorTest(evt));
903902
}
904903
}
905904
}
906905

907906
if (enabled) {
908907
document.addEventListener('keydown', e => disableMotorTest(e));
909-
// enable Status and Motor data pulling
910-
GUI.interval_add('motor_and_status_pull', get_status, 50, true);
911-
} else {
912-
document.removeEventListener('keydown', e => disableMotorTest(e));
913-
GUI.interval_remove("motor_and_status_pull");
914908
}
915909

916910
setContentButtons(enabled);
@@ -1002,7 +996,7 @@ motors.initialize = async function (callback) {
1002996

1003997
// data pulling functions used inside interval timer
1004998

1005-
function get_status() {
999+
function getStatus() {
10061000
// status needed for arming flag
10071001
MSP.send_message(MSPCodes.MSP_STATUS, false, false, get_motor_data);
10081002
}
@@ -1143,8 +1137,8 @@ motors.initialize = async function (callback) {
11431137

11441138
$('a.stop').on('click', () => motorsEnableTestModeElement.prop('checked', false).trigger('change'));
11451139

1146-
// get initial motor status values
1147-
get_status();
1140+
// enable Status and Motor data pulling
1141+
GUI.interval_add('motor_and_status_pull', getStatus, 50, true);
11481142

11491143
setup_motor_output_reordering_dialog(SetupEscDshotDirectionDialogCallback, zeroThrottleValue);
11501144

0 commit comments

Comments
 (0)