Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix motor stop #2970

Merged
merged 1 commit into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1741,10 +1741,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
console.log(`Unknown code detected: ${code}`);
} else {
console.log(`FC reports unsupported message error: ${code}`);
}

if (code === MSPCodes.MSP_SET_REBOOT) {
TABS.onboard_logging.mscRebootFailedCallback();
if (code === MSPCodes.MSP_SET_REBOOT) {
TABS.onboard_logging.mscRebootFailedCallback();
}
}

} else {
Expand Down
18 changes: 6 additions & 12 deletions src/js/tabs/motors.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ motors.initialize = async function (callback) {
// Update filtering defaults based on API version
const FILTER_DEFAULT = FC.getFilterDefaults();

if (GUI.active_tab != 'motors') {
GUI.active_tab = 'motors';
}
GUI.active_tab = 'motors';

await MSP.promise(MSPCodes.MSP_STATUS);
await MSP.promise(MSPCodes.MSP_PID_ADVANCED);
Expand Down Expand Up @@ -884,7 +882,7 @@ motors.initialize = async function (callback) {
];

motorsEnableTestModeElement.on('change', function () {
let enabled = $(this).is(':checked');
let enabled = motorsEnableTestModeElement.is(':checked');
// prevent or disable testing if configHasChanged flag is set.
if (self.configHasChanged) {
if (enabled) {
Expand All @@ -900,17 +898,13 @@ motors.initialize = async function (callback) {
if (motorsEnableTestModeElement.is(':checked')) {
if (!ignoreKeys.includes(e.code)) {
motorsEnableTestModeElement.prop('checked', false).trigger('change');
document.removeEventListener('keydown', evt => disableMotorTest(evt));
}
}
}

if (enabled) {
document.addEventListener('keydown', e => disableMotorTest(e));
// enable Status and Motor data pulling
GUI.interval_add('motor_and_status_pull', get_status, 50, true);
} else {
document.removeEventListener('keydown', e => disableMotorTest(e));
GUI.interval_remove("motor_and_status_pull");
}

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

// data pulling functions used inside interval timer

function get_status() {
function getStatus() {
// status needed for arming flag
MSP.send_message(MSPCodes.MSP_STATUS, false, false, get_motor_data);
}
Expand Down Expand Up @@ -1143,8 +1137,8 @@ motors.initialize = async function (callback) {

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

// get initial motor status values
get_status();
// enable Status and Motor data pulling
GUI.interval_add('motor_and_status_pull', getStatus, 50, true);

setup_motor_output_reordering_dialog(SetupEscDshotDirectionDialogCallback, zeroThrottleValue);

Expand Down