mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 13:25:24 +03:00
Merge pull request #556 from basdelfos/reverse-motor-switch
Added switch to reverse motor direction
This commit is contained in:
commit
6021a159a3
5 changed files with 39 additions and 6 deletions
|
@ -661,6 +661,12 @@
|
|||
"configurationMagDeclination": {
|
||||
"message": "Magnetometer Declination [deg]"
|
||||
},
|
||||
"configurationReverseMotorSwitch": {
|
||||
"message": "Motor direction is reversed"
|
||||
},
|
||||
"configurationReverseMotorSwitchHelp": {
|
||||
"message": "Enabling this option will tell Betaflight that motors and props are set to run in the reverse direction."
|
||||
},
|
||||
"configurationAutoDisarmDelay": {
|
||||
"message": "Disarm motors after set delay [seconds] (Requires MOTOR_STOP feature)"
|
||||
},
|
||||
|
|
3
js/fc.js
3
js/fc.js
|
@ -84,7 +84,8 @@ var FC = {
|
|||
|
||||
MIXER_CONFIG = {
|
||||
mixer: 0,
|
||||
};
|
||||
reverseMotorDir: 0,
|
||||
};
|
||||
|
||||
BOARD_ALIGNMENT_CONFIG = {
|
||||
roll: 0,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue