1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 05:15:21 +03:00

Added switch to reverse motor direction

This commit is contained in:
Bas Delfos 2017-07-18 20:25:49 +02:00
parent 138009669b
commit b158ac6f69
5 changed files with 39 additions and 6 deletions

View file

@ -661,6 +661,12 @@
"configurationMagDeclination": {
"message": "Magnetometer Declination [deg]"
},
"configurationReverseMotorSwitch": {
"message": "Reverse motor direction"
},
"configurationReverseMotorSwitchHelp": {
"message": "Enabling this will reverse the motor direction in Betaflight. You must reverse the ESCs as well. CAUTION: Make sure you test this with PROPS OFF!"
},
"configurationAutoDisarmDelay": {
"message": "Disarm motors after set delay [seconds] (Requires MOTOR_STOP feature)"
},

View file

@ -84,6 +84,7 @@ var FC = {
MIXER_CONFIG = {
mixer: 0,
reverseMotorDir: 0,
};
BOARD_ALIGNMENT_CONFIG = {

View file

@ -554,6 +554,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
case MSPCodes.MSP_MIXER_CONFIG:
MIXER_CONFIG.mixer = data.readU8();
MIXER_CONFIG.reverseMotorDir = data.readU8();
break;
case MSPCodes.MSP_FEATURE_CONFIG:
@ -1149,6 +1150,7 @@ MspHelper.prototype.crunch = function(code) {
break;
case MSPCodes.MSP_SET_MIXER_CONFIG:
buffer.push8(MIXER_CONFIG.mixer)
.push8(MIXER_CONFIG.reverseMotorDir);
break;
case MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG:
buffer.push16(BOARD_ALIGNMENT_CONFIG.roll)

View file

@ -24,6 +24,18 @@
</select>
</div>
</div>
<div class="spacer_box">
<div class="checkbox" style="border-top: 1px solid #ddd; padding-top: 5px;">
<div style="float: left; height: 20px; margin-right: 15px; margin-left: 3px;">
<input type="checkbox" id="reverseMotorSwitch" class="toggle" />
</div>
<label for="reverseMotorSwitch">
<span class="freelabel" i18n="configurationReverseMotorSwitch"></span>
<div class="helpicon cf_tip" i18n_title="configurationReverseMotorSwitchHelp"></div>
</label>
</div>
</div>
</div>
</div>
<div class="rightWrapper motorstop">

View file

@ -163,12 +163,24 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
});
}
function refreshMixerPreview() {
var mixer = MIXER_CONFIG.mixer
var reverse = MIXER_CONFIG.reverseMotorDir ? "_reversed" : "";
$('.mixerPreview img').attr('src', './resources/motor_order/' + mixerList[mixer - 1].image + reverse + '.svg');
};
var reverseMotorSwitch_e = $('#reverseMotorSwitch');
reverseMotorSwitch_e.change(function() {
MIXER_CONFIG.reverseMotorDir = $(this).prop('checked') ? 1 : 0;
refreshMixerPreview();
});
reverseMotorSwitch_e.prop('checked', MIXER_CONFIG.reverseMotorDir != 0).change();
mixer_list_e.change(function () {
var val = parseInt($(this).val());
MIXER_CONFIG.mixer = val;
$('.mixerPreview img').attr('src', './resources/motor_order/' + mixerList[val - 1].image + '.svg');
MIXER_CONFIG.mixer = parseInt($(this).val());
refreshMixerPreview();
});
// select current mixer configuration