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

motor direction tools: gui_log the direction clicked #3634

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/components/EscDshotDirection/EscDshotDirectionMotorDriver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import EscDshotCommandQueue from './EscDshotCommandQueue.js';
import DshotCommand from '../../js/utils/DshotCommand.js';
import MSPCodes from '../../js/msp/MSPCodes.js';
import { gui_log } from "../../js/gui_log";

class EscDshotDirectionMotorDriver
{
Expand Down Expand Up @@ -122,6 +123,23 @@ class EscDshotDirectionMotorDriver
buffer.push8(direction);
buffer.push8(DshotCommand.dshotCommands_e.DSHOT_CMD_SAVE_SETTINGS);
this._EscDshotCommandQueue.pushCommand(MSPCodes.MSP2_SEND_DSHOT_COMMAND, buffer);

let logString = "";
if (motorIndex === DshotCommand.ALL_MOTORS) {
if (direction === DshotCommand.dshotCommands_e.DSHOT_CMD_SPIN_DIRECTION_1) {
logString += i18n.getMessage('motorsText').concat(': ', i18n.getMessage('escDshotDirectionDialog-Open')).concat(' ',i18n.getMessage('escDshotDirectionDialog-CommandNormal'));
} else {
logString += i18n.getMessage('motorsText').concat(': ', i18n.getMessage('escDshotDirectionDialog-Open')).concat(' ',i18n.getMessage('escDshotDirectionDialog-CommandReverse'));
}
} else {
const motorNumber = motorIndex+1;
if (direction === DshotCommand.dshotCommands_e.DSHOT_CMD_SPIN_DIRECTION_1) {
logString += i18n.getMessage(`motorNumber${motorNumber}`).concat(': ', i18n.getMessage('escDshotDirectionDialog-Open')).concat(' ',i18n.getMessage('escDshotDirectionDialog-CommandNormal'));
} else {
logString += i18n.getMessage(`motorNumber${motorNumber}`).concat(': ', i18n.getMessage('escDshotDirectionDialog-Open')).concat(' ',i18n.getMessage('escDshotDirectionDialog-CommandReverse'));
}
}
nerdCopter marked this conversation as resolved.
Show resolved Hide resolved
gui_log(logString);
}

_spinMotor(motorIndex, value)
Expand Down