1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 22:35:17 +03:00

Fixed reverse motor direction compatibility with 3.1

This commit is contained in:
Bas Delfos 2017-07-29 11:59:36 +02:00
parent 9d240fb575
commit f30826877f
3 changed files with 126 additions and 6 deletions

View file

@ -557,7 +557,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
case MSPCodes.MSP_MIXER_CONFIG: case MSPCodes.MSP_MIXER_CONFIG:
MIXER_CONFIG.mixer = data.readU8(); MIXER_CONFIG.mixer = data.readU8();
MIXER_CONFIG.reverseMotorDir = data.readU8(); if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
MIXER_CONFIG.reverseMotorDir = data.readU8();
}
break; break;
case MSPCodes.MSP_FEATURE_CONFIG: case MSPCodes.MSP_FEATURE_CONFIG:
@ -1161,7 +1163,9 @@ MspHelper.prototype.crunch = function(code) {
break; break;
case MSPCodes.MSP_SET_MIXER_CONFIG: case MSPCodes.MSP_SET_MIXER_CONFIG:
buffer.push8(MIXER_CONFIG.mixer) buffer.push8(MIXER_CONFIG.mixer)
.push8(MIXER_CONFIG.reverseMotorDir); if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
buffer.push8(MIXER_CONFIG.reverseMotorDir);
}
break; break;
case MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG: case MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG:
buffer.push16(BOARD_ALIGNMENT_CONFIG.roll) buffer.push16(BOARD_ALIGNMENT_CONFIG.roll)

View file

@ -324,7 +324,7 @@
<!-- RECEIVER --> <!-- RECEIVER -->
<!-- FIXME move receiver and RSSI to receiver tab --> <!-- FIXME move receiver and RSSI to receiver tab -->
<div class="receiver"> <div class="receiver">
<div class="gui_box grey" style="margin-bottom:10px;"> <div class="gui_box grey" style="margin-bottom:10px;">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationReceiver"></div> <div class="spacer_box_title" i18n="configurationReceiver"></div>
</div> </div>
@ -411,7 +411,7 @@
</div> </div>
</td> </td>
<td style="width:calc(50%);vertical-align:top;"> <td style="width:calc(50%);vertical-align:top;">
<!-- ROW 3 - RIGHT PANE --> <!-- ROW 3 - RIGHT PANE -->
<!-- 3D --> <!-- 3D -->
@ -528,6 +528,116 @@
</td> </td>
</tr> </tr>
<tr class="oldBatteryConfig">
<td style="width:calc(50%);vertical-align:top;">
<!-- ROW 4 - LEFT PANE - ONLY NEEDED FOR BATTERY/CURRENT PART FOR PRE BF3.2 -->
<!-- -------------------------------------------------------- -->
<!-- Remove this part when we officialy retire BF 3.1.x -->
<div class="rightWrapper current voltage">
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationBatteryVoltage"></div>
</div>
<div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features batteryVoltage">
<!-- table generated here -->
</tbody>
</table>
<div class="select batterymetertype vbatmonitoring">
<label>
<select class="batterymetertype"><!-- list generated here --></select>
<span i18n="configurationBatteryMeterType"></span>
</label>
</div>
<div class="number vbatmonitoring">
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
i18n="configurationBatteryMinimum"></span>
</label>
</div>
<div class="number vbatmonitoring">
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
i18n="configurationBatteryMaximum"></span>
</label>
</div>
<div class="number vbatmonitoring">
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
i18n="configurationBatteryWarning"></span>
</label>
</div>
<div class="number vbatmonitoring vbatCalibration">
<label> <input type="number" name="voltagescale" step="1" min="10" max="255" /> <span
i18n="configurationBatteryScale"></span>
</label>
</div>
<div class="number vbatmonitoring">
<label> <input type="text" name="batteryvoltage" readonly class="disabled" /> <span
i18n="configurationBatteryVoltage"></span>
</label>
</div>
</div>
</div>
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationCurrent"></div>
</div>
<div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features batteryCurrent">
<!-- table generated here -->
</tbody>
</table>
<div class="select currentMonitoring">
<label>
<select class="currentmetertype"><!-- list generated here --></select>
<span i18n="configurationCurrentMeterType"></span>
</label>
</div>
<div class="number currentMonitoring currentCalibration">
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
i18n="configurationCurrentScale"></span>
</label>
</div>
<div class="number currentMonitoring currentCalibration">
<label> <input type="number" name="currentoffset" step="1" min="-1600" max="16000" /> <span
i18n="configurationCurrentOffset"></span>
</label>
</div>
<div class="number currentMonitoring currentOutput">
<label>
<input type="text" name="batterycurrent" readonly class="disabled" /> <span
i18n="configurationBatteryCurrent"></span>
</label>
</div>
<div class="checkbox currentMonitoring currentOutput">
<div class="numberspacer">
<input type="checkbox" name="multiwiicurrentoutput" class="toggle" />
</div>
<label> <span i18n="configurationBatteryMultiwiiCurrent"></span>
</label>
</div>
</div>
</div>
</div>
<!-- -------------------------------------------------------- -->
</td>
</tr>
<tr> <tr>
<td style="width:calc(100%)" colspan="2"> <td style="width:calc(100%)" colspan="2">
<!-- ROW 4 - FULL WIDTH PANE --> <!-- ROW 4 - FULL WIDTH PANE -->

View file

@ -174,12 +174,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
function refreshMixerPreview() { function refreshMixerPreview() {
var mixer = MIXER_CONFIG.mixer var mixer = MIXER_CONFIG.mixer
var reverse = MIXER_CONFIG.reverseMotorDir ? "_reversed" : ""; var reverse = "";
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
MIXER_CONFIG.reverseMotorDir ? "_reversed" : "";
}
$('.mixerPreview img').attr('src', './resources/motor_order/' + mixerList[mixer - 1].image + reverse + '.svg'); $('.mixerPreview img').attr('src', './resources/motor_order/' + mixerList[mixer - 1].image + reverse + '.svg');
}; };
var reverseMotorSwitch_e = $('#reverseMotorSwitch'); var reverseMotorSwitch_e = $('#reverseMotorSwitch');
var reverseMotor_e = $('.reverseMotor');
reverseMotorSwitch_e.change(function() { reverseMotorSwitch_e.change(function() {
MIXER_CONFIG.reverseMotorDir = $(this).prop('checked') ? 1 : 0; MIXER_CONFIG.reverseMotorDir = $(this).prop('checked') ? 1 : 0;
@ -208,6 +213,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
BEEPER_CONFIG.beepers.generateElements(template, destination); BEEPER_CONFIG.beepers.generateElements(template, destination);
} else { } else {
beeper_e.hide(); beeper_e.hide();
reverseMotor_e.hide();
} }
// translate to user-selected language // translate to user-selected language