mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-20 14:55:15 +03:00
Merge pull request #1933 from mikeller/support_disabled_motor_protocol
Added support for disabling the motor output protocol.
This commit is contained in:
commit
efe82eccc7
9 changed files with 125 additions and 67 deletions
|
@ -7,7 +7,7 @@ var Features = function (config) {
|
|||
{bit: 0, group: 'rxMode', mode: 'select', name: 'RX_PPM'},
|
||||
{bit: 2, group: 'other', name: 'INFLIGHT_ACC_CAL'},
|
||||
{bit: 3, group: 'rxMode', mode: 'select', name: 'RX_SERIAL'},
|
||||
{bit: 4, group: 'esc', name: 'MOTOR_STOP'},
|
||||
{bit: 4, group: 'escMotorStop', name: 'MOTOR_STOP'},
|
||||
{bit: 5, group: 'other', name: 'SERVO_TILT', haveTip: true},
|
||||
{bit: 6, group: 'other', name: 'SOFTSERIAL', haveTip: true},
|
||||
{bit: 7, group: 'gps', name: 'GPS', haveTip: true},
|
||||
|
|
|
@ -105,6 +105,7 @@ var FC = {
|
|||
mcuTypeId: 255,
|
||||
configurationState: 0,
|
||||
sampleRateHz: 0,
|
||||
configurationProblems: 0,
|
||||
};
|
||||
|
||||
BF_CONFIG = {
|
||||
|
@ -638,7 +639,11 @@ var FC = {
|
|||
SUPPORTS_CUSTOM_DEFAULTS: 4,
|
||||
HAS_CUSTOM_DEFAULTS: 5,
|
||||
SUPPORTS_RX_BIND: 6,
|
||||
ACC_NEEDS_CALIBRATION: 7,
|
||||
},
|
||||
|
||||
CONFIGURATION_PROBLEM_FLAGS: {
|
||||
ACC_NEEDS_CALIBRATION: 0,
|
||||
MOTOR_PROTOCOL_DISABLED: 1,
|
||||
},
|
||||
|
||||
boardHasVcp: function () {
|
||||
|
|
|
@ -767,7 +767,6 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
CONFIG.boardType = 0;
|
||||
}
|
||||
|
||||
CONFIG.targetName = "";
|
||||
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
|
||||
CONFIG.targetCapabilities = data.readU8();
|
||||
|
||||
|
@ -777,11 +776,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
} else {
|
||||
CONFIG.targetCapabilities = 0;
|
||||
CONFIG.targetName = "";
|
||||
}
|
||||
|
||||
CONFIG.boardName = "";
|
||||
CONFIG.manufacturerId = "";
|
||||
CONFIG.signature = [];
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
let length = data.readU8();
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
@ -796,22 +793,29 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
for (let i = 0; i < self.SIGNATURE_LENGTH; i++) {
|
||||
CONFIG.signature.push(data.readU8());
|
||||
}
|
||||
} else {
|
||||
CONFIG.boardName = "";
|
||||
CONFIG.manufacturerId = "";
|
||||
CONFIG.signature = [];
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
CONFIG.mcuTypeId = data.readU8();
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
CONFIG.configurationState = data.readU8();
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||
CONFIG.sampleRateHz = data.readU16();
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
CONFIG.mcuTypeId = 255;
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
CONFIG.configurationState = data.readU8();
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||
CONFIG.sampleRateHz = data.readU16();
|
||||
CONFIG.configurationProblems = data.readU32();
|
||||
} else {
|
||||
CONFIG.configurationProblems = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_NAME:
|
||||
|
|
|
@ -353,20 +353,32 @@ function processBoardInfo() {
|
|||
}
|
||||
|
||||
function checkReportProblems() {
|
||||
const PROBLEM_ANALYTICS_EVENT = 'ProblemFound';
|
||||
const problemItemTemplate = $('#dialogReportProblems-listItemTemplate');
|
||||
|
||||
function checkReportProblem(problemName, problemDialogList) {
|
||||
if (bit_check(CONFIG.configurationProblems, FC.CONFIGURATION_PROBLEM_FLAGS[problemName])) {
|
||||
problemItemTemplate.clone().html(i18n.getMessage(`reportProblemsDialog${problemName}`)).appendTo(problemDialogList);
|
||||
|
||||
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, PROBLEM_ANALYTICS_EVENT, problemName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
|
||||
let needsProblemReportingDialog = false;
|
||||
const problemDialogList = $('#dialogReportProblems-list');
|
||||
problemDialogList.empty();
|
||||
const problemItemTemplate = $('.dialogReportProblems-listItem');
|
||||
const PROBLEM_ANALYTICS_EVENT = 'ProblemFound';
|
||||
|
||||
if (have_sensor(CONFIG.activeSensors, 'acc') && bit_check(CONFIG.targetCapabilities, FC.TARGET_CAPABILITIES_FLAGS.ACC_NEEDS_CALIBRATION)) {
|
||||
needsProblemReportingDialog = true;
|
||||
problemDialogList.append(problemItemTemplate.clone().html(i18n.getMessage('reportProblemsDialogAccCalibrationNeeded')));
|
||||
|
||||
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, PROBLEM_ANALYTICS_EVENT, 'AccNotCalibrated');
|
||||
if (have_sensor(CONFIG.activeSensors, 'acc')) {
|
||||
needsProblemReportingDialog = checkReportProblem('ACC_NEEDS_CALIBRATION', problemDialogList) || needsProblemReportingDialog;
|
||||
}
|
||||
|
||||
needsProblemReportingDialog = checkReportProblem('MOTOR_PROTOCOL_DISABLED', problemDialogList) || needsProblemReportingDialog;
|
||||
|
||||
if (needsProblemReportingDialog) {
|
||||
const problemDialog = $('#dialogReportProblems')[0];
|
||||
$('#dialogReportProblems-closebtn').click(function() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
TABS.configuration = {
|
||||
DSHOT_PROTOCOL_MIN_VALUE: 5,
|
||||
SHOW_OLD_BATTERY_CONFIG: false,
|
||||
analyticsChanges: {},
|
||||
};
|
||||
|
@ -457,7 +456,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
// ESC protocols
|
||||
var escprotocols = [
|
||||
const escProtocols = [
|
||||
'PWM',
|
||||
'ONESHOT125',
|
||||
'ONESHOT42',
|
||||
|
@ -465,25 +464,31 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
];
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||
escprotocols.push('BRUSHED');
|
||||
escProtocols.push('BRUSHED');
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.31.0")) {
|
||||
escprotocols.push('DSHOT150');
|
||||
escprotocols.push('DSHOT300');
|
||||
escprotocols.push('DSHOT600');
|
||||
escProtocols.push('DSHOT150');
|
||||
escProtocols.push('DSHOT300');
|
||||
escProtocols.push('DSHOT600');
|
||||
|
||||
if (semver.lt(CONFIG.apiVersion, "1.42.0")) {
|
||||
escprotocols.push('DSHOT1200');
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
escprotocols.push('PROSHOT1000');
|
||||
escProtocols.push('DSHOT1200');
|
||||
}
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
escProtocols.push('PROSHOT1000');
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||
escProtocols.push('DISABLED');
|
||||
}
|
||||
|
||||
var esc_protocol_e = $('select.escprotocol');
|
||||
|
||||
for (var i = 0; i < escprotocols.length; i++) {
|
||||
esc_protocol_e.append('<option value="' + (i + 1) + '">'+ escprotocols[i] + '</option>');
|
||||
for (let j = 0; j < escProtocols.length; j++) {
|
||||
esc_protocol_e.append(`<option value="${j + 1}">${escProtocols[j]}</option>`);
|
||||
}
|
||||
|
||||
$("input[id='unsyncedPWMSwitch']").change(function() {
|
||||
|
@ -516,47 +521,67 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles);
|
||||
}
|
||||
|
||||
function hideRpmFeatures() {
|
||||
let rpmFeaturesVisible = $("input[id='dshotBidir']").is(':checked') || $("input[name='ESC_SENSOR']").is(':checked');
|
||||
$('div.motorPoles').toggle(rpmFeaturesVisible);
|
||||
}
|
||||
|
||||
$('#escProtocolTooltip').toggle(semver.lt(CONFIG.apiVersion, "1.42.0"));
|
||||
$('#escProtocolTooltipNoDSHOT1200').toggle(semver.gte(CONFIG.apiVersion, "1.42.0"));
|
||||
|
||||
function updateVisibility() {
|
||||
// Hide unused settings
|
||||
const protocolName = $('select.escprotocol option:selected').text();
|
||||
const protocolConfigured = protocolName !== 'DISABLED';
|
||||
let digitalProtocol = false;
|
||||
switch (protocolName) {
|
||||
case 'DSHOT150':
|
||||
case 'DSHOT300':
|
||||
case 'DSHOT600':
|
||||
case 'DSHOT1200':
|
||||
case 'PROSHOT1000':
|
||||
digitalProtocol = true;
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
const rpmFeaturesVisible = digitalProtocol && ($("input[id='dshotBidir']").is(':checked') || $("input[name='ESC_SENSOR']").is(':checked'));
|
||||
|
||||
$('div.minthrottle').toggle(protocolConfigured && !digitalProtocol);
|
||||
$('div.maxthrottle').toggle(protocolConfigured && !digitalProtocol);
|
||||
$('div.mincommand').toggle(protocolConfigured && !digitalProtocol);
|
||||
$('div.checkboxPwm').toggle(protocolConfigured && !digitalProtocol);
|
||||
$('div.unsyncedpwmfreq').toggle(protocolConfigured && !digitalProtocol);
|
||||
|
||||
$('div.digitalIdlePercent').toggle(protocolConfigured && digitalProtocol);
|
||||
$('.escSensor').toggle(protocolConfigured && digitalProtocol);
|
||||
|
||||
$('div.checkboxDshotBidir').toggle(protocolConfigured && semver.gte(CONFIG.apiVersion, "1.42.0") && digitalProtocol);
|
||||
$('div.motorPoles').toggle(protocolConfigured && rpmFeaturesVisible && semver.gte(CONFIG.apiVersion, "1.42.0"));
|
||||
|
||||
$('.escMotorStop').toggle(protocolConfigured);
|
||||
|
||||
$('#escProtocolDisabled').toggle(!protocolConfigured);
|
||||
|
||||
//trigger change unsyncedPWMSwitch to show/hide Motor PWM freq input
|
||||
$("input[id='unsyncedPWMSwitch']").change();
|
||||
}
|
||||
|
||||
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
||||
esc_protocol_e.change(function () {
|
||||
var escProtocolValue = parseInt($(this).val()) - 1;
|
||||
const escProtocolValue = parseInt($(this).val()) - 1;
|
||||
|
||||
var newValue;
|
||||
let newValue = undefined;
|
||||
if (escProtocolValue !== PID_ADVANCED_CONFIG.fast_pwm_protocol) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
}
|
||||
self.analyticsChanges['EscProtocol'] = newValue;
|
||||
|
||||
//hide not used setting for DSHOT protocol
|
||||
let digitalProtocol = (escProtocolValue >= self.DSHOT_PROTOCOL_MIN_VALUE);
|
||||
|
||||
$('div.minthrottle').toggle(!digitalProtocol);
|
||||
$('div.maxthrottle').toggle(!digitalProtocol);
|
||||
$('div.mincommand').toggle(!digitalProtocol);
|
||||
$('div.checkboxPwm').toggle(!digitalProtocol);
|
||||
$('div.unsyncedpwmfreq').toggle(!digitalProtocol);
|
||||
|
||||
$('div.digitalIdlePercent').toggle(digitalProtocol);
|
||||
$('.escSensor').toggle(digitalProtocol);
|
||||
|
||||
$('div.checkboxDshotBidir').toggle(semver.gte(CONFIG.apiVersion, "1.42.0") && digitalProtocol);
|
||||
$('div.motorPoles').toggle(semver.gte(CONFIG.apiVersion, "1.42.0"));
|
||||
//trigger change dshotBidir and ESC_SENSOR to show/hide Motor Poles tab
|
||||
$("input[id='dshotBidir']").change(hideRpmFeatures).change();
|
||||
$("input[name='ESC_SENSOR']").change(hideRpmFeatures);
|
||||
|
||||
//trigger change unsyncedPWMSwitch to show/hide Motor PWM freq input
|
||||
$("input[id='unsyncedPWMSwitch']").change();
|
||||
|
||||
updateVisibility();
|
||||
}).change();
|
||||
|
||||
//trigger change dshotBidir and ESC_SENSOR to show/hide Motor Poles tab
|
||||
$("input[id='dshotBidir']").change(updateVisibility).change();
|
||||
$("input[name='ESC_SENSOR']").change(updateVisibility).change();
|
||||
|
||||
// Gyro and PID update
|
||||
const gyroUse32kHzElement = $('input[id="gyroUse32kHz"]');
|
||||
const gyroTextElement = $('input.gyroFrequency');
|
||||
|
@ -706,7 +731,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
i18n.getMessage('gpsSbasEuropeanEGNOS'),
|
||||
i18n.getMessage('gpsSbasNorthAmericanWAAS'),
|
||||
i18n.getMessage('gpsSbasJapaneseMSAS'),
|
||||
i18n.getMessage('gpsSbasIndianGAGAN')
|
||||
i18n.getMessage('gpsSbasIndianGAGAN'),
|
||||
];
|
||||
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||
gpsSbas.push(i18n.getMessage('gpsSbasNone'));
|
||||
|
|
|
@ -240,7 +240,7 @@ TABS.setup.initialize = function (callback) {
|
|||
'DSHOT_BBANG']);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||
disarmFlagElements = disarmFlagElements.concat(['NO_ACC_CAL']);
|
||||
disarmFlagElements = disarmFlagElements.concat(['NO_ACC_CAL', 'MOTOR_PROTO']);
|
||||
}
|
||||
|
||||
// Always the latest element
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue