Skip to content

Commit

Permalink
motor direction tools: gui_log the direction clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter committed Nov 14, 2023
1 parent 5b2be8a commit 45f4646
Showing 1 changed file with 18 additions and 0 deletions.
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 {
let 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'));
}
}
gui_log(logString);
}

_spinMotor(motorIndex, value)
Expand Down

0 comments on commit 45f4646

Please sign in to comment.