From 86043faf4958a071ed97841fa14cd728d81e0c5c Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Wed, 15 Nov 2023 09:13:53 -0600 Subject: [PATCH] motor direction tools: gui_log the direction clicked (#3634) * motor direction tools: gui_log the direction clicked * motor direction tools: gui_log the direction clicked ; fix syntax * motor direction tools: gui_log the direction clicked ; deduplicate/simplify --------- Co-authored-by: Mark Haslinghuis --- .../EscDshotDirectionMotorDriver.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/EscDshotDirection/EscDshotDirectionMotorDriver.js b/src/components/EscDshotDirection/EscDshotDirectionMotorDriver.js index f18994f5de..ef2387dde7 100644 --- a/src/components/EscDshotDirection/EscDshotDirectionMotorDriver.js +++ b/src/components/EscDshotDirection/EscDshotDirectionMotorDriver.js @@ -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 { @@ -122,6 +123,21 @@ 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) { + logString += i18n.getMessage('motorsText'); + } else { + const motorNumber = motorIndex+1; + logString += i18n.getMessage(`motorNumber${motorNumber}`); + } + logString += ': '; + if (direction === DshotCommand.dshotCommands_e.DSHOT_CMD_SPIN_DIRECTION_1) { + logString += i18n.getMessage('escDshotDirectionDialog-CommandNormal'); + } else { + logString += i18n.getMessage('escDshotDirectionDialog-CommandReverse'); + } + gui_log(logString); } _spinMotor(motorIndex, value)