1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 06:15:13 +03:00

Added configuration for Dshot beacon activation conditions.

This commit is contained in:
mikeller 2018-06-11 00:55:21 +12:00
parent 7be361ae20
commit 26361bebad
7 changed files with 91 additions and 34 deletions

View file

@ -968,10 +968,10 @@
"message": "This is the value that is sent to the ESCs when the craft is disarmed. Set this to a value that has the motors stopped (1000 for most ESCs)." "message": "This is the value that is sent to the ESCs when the craft is disarmed. Set this to a value that has the motors stopped (1000 for most ESCs)."
}, },
"configurationDshotBeeper": { "configurationDshotBeeper": {
"message": "DSHOT Beacon Configuration" "message": "Dshot Beacon Configuration"
}, },
"configurationUseDshotBeeper": { "configurationUseDshotBeeper": {
"message": "Use DSHOT beacon (use motors to sound beeps when disarmed)" "message": "Use Dshot beacon (use motors to sound beeps when disarmed)"
}, },
"configurationDshotBeaconTone": { "configurationDshotBeaconTone": {
"message": "Beacon Tone" "message": "Beacon Tone"
@ -1004,13 +1004,10 @@
"message": "Warning beeps when battery is getting low (repeats)" "message": "Warning beeps when battery is getting low (repeats)"
}, },
"beeperGPS_STATUS": { "beeperGPS_STATUS": {
"message": "" "message": "Use the number of beeps to indicate how many GPS satellites were found"
}, },
"beeperRX_SET": { "beeperRX_SET": {
"message": "Beeps when aux channel is set for beep or beep sequence how many satellites has found if GPS enabled" "message": "Beeps when aux channel is set for beep"
},
"beeperDISARM_REPEAT": {
"message": "Beeps sounded while stick held in disarm position"
}, },
"beeperACC_CALIBRATION": { "beeperACC_CALIBRATION": {
"message": "Accelerometer inflight calibration completed confirmation" "message": "Accelerometer inflight calibration completed confirmation"
@ -1024,18 +1021,30 @@
"beeperMULTI_BEEPS": { "beeperMULTI_BEEPS": {
"message": "" "message": ""
}, },
"beeperDISARM_REPEAT": {
"message": "Beeps sounded while stick held in disarm position"
},
"beeperARMED": { "beeperARMED": {
"message": "Warning beeps when board is armed (repeats until board is disarmed or throttle is increased)" "message": "Warning beeps when board is armed with motors off when idle (repeats until board is disarmed or throttle is increased)"
}, },
"beeperSYSTEM_INIT": { "beeperSYSTEM_INIT": {
"message": "Initialisation beeps when board is powered on" "message": "Initialisation beeps when board is powered on"
}, },
"beeperUSB": { "beeperUSB": {
"message": "Beep when flight controller is powered from USB. Turn this off when you don't want the beeper on the workbench" "message": "Beep when flight controller is powered from USB. Turn this off if you don't want the beeper to be on when on the workbench"
}, },
"beeperBLACKBOX_ERASE": { "beeperBLACKBOX_ERASE": {
"message": "Beep when blackbox erase completes" "message": "Beep when blackbox erase completes"
}, },
"beeperCRASH_FLIP": {
"message": "Beep when crash flip mode is active"
},
"beeperCAM_CONNECTION_OPEN": {
"message": "Beep when the 5 key camera control is entered"
},
"beeperCAM_CONNECTION_CLOSE": {
"message": "Beep when the 5 key camera control is exited"
},
"configuration3d": { "configuration3d": {
"message": "3D ESC/Motor Features" "message": "3D ESC/Motor Features"
}, },

View file

@ -1,6 +1,6 @@
'use strict;' 'use strict;'
var Beepers = function (config) { var Beepers = function (config, supportedConditions) {
var self = this; var self = this;
var beepers = [ var beepers = [
@ -12,7 +12,7 @@ var Beepers = function (config) {
{bit: 5, name: 'ARMING_GPS_FIX', visible: true}, {bit: 5, name: 'ARMING_GPS_FIX', visible: true},
{bit: 6, name: 'BAT_CRIT_LOW', visible: true}, {bit: 6, name: 'BAT_CRIT_LOW', visible: true},
{bit: 7, name: 'BAT_LOW', visible: true}, {bit: 7, name: 'BAT_LOW', visible: true},
{bit: 8, name: 'GPS_STATUS', visible: false}, // do not show {bit: 8, name: 'GPS_STATUS', visible: true},
{bit: 9, name: 'RX_SET', visible: true}, {bit: 9, name: 'RX_SET', visible: true},
{bit: 10, name: 'ACC_CALIBRATION', visible: true}, {bit: 10, name: 'ACC_CALIBRATION', visible: true},
{bit: 11, name: 'ACC_CALIBRATION_FAIL', visible: true}, {bit: 11, name: 'ACC_CALIBRATION_FAIL', visible: true},
@ -25,7 +25,27 @@ var Beepers = function (config) {
{bit: 18, name: 'BLACKBOX_ERASE', visible: true}, {bit: 18, name: 'BLACKBOX_ERASE', visible: true},
]; ];
self._beepers = beepers; if (semver.gte(config.apiVersion, "1.37.0")) {
beepers.push(
{bit: 19, name: 'CRASH_FLIP', visible: true},
{bit: 20, name: 'CAM_CONNECTION_OPEN', visible: true},
{bit: 21, name: 'CAM_CONNECTION_CLOSE', visible: true},
);
}
if (supportedConditions) {
self._beepers = [];
beepers.forEach(function (beeper) {
if (supportedConditions.some(function (supportedCondition) {
return supportedCondition === beeper.name;
})) {
self._beepers.push(beeper);
}
});
} else {
self._beepers = beepers.slice();
}
self._beeperMask = 0; self._beeperMask = 0;
}; };

View file

@ -105,6 +105,7 @@ var FC = {
BEEPER_CONFIG = { BEEPER_CONFIG = {
beepers: 0, beepers: 0,
dshotBeaconTone: 0, dshotBeaconTone: 0,
dshotBeaconConditions: 0,
}; };
MIXER_CONFIG = { MIXER_CONFIG = {

View file

@ -605,6 +605,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
if (semver.gte(CONFIG.apiVersion, "1.37.0")) { if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
BEEPER_CONFIG.dshotBeaconTone = data.readU8(); BEEPER_CONFIG.dshotBeaconTone = data.readU8();
} }
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
BEEPER_CONFIG.dshotBeaconConditions.setMask(data.readU32());
}
break; break;
case MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG: case MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG:
@ -1217,7 +1220,10 @@ MspHelper.prototype.crunch = function(code) {
var beeperMask = BEEPER_CONFIG.beepers.getMask(); var beeperMask = BEEPER_CONFIG.beepers.getMask();
buffer.push32(beeperMask); buffer.push32(beeperMask);
if (semver.gte(CONFIG.apiVersion, "1.37.0")) { if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
buffer.push8(BEEPER_CONFIG.dshotBeaconTone ); buffer.push8(BEEPER_CONFIG.dshotBeaconTone);
}
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
buffer.push32(BEEPER_CONFIG.dshotBeaconConditions.getMask());
} }
break; break;
case MSPCodes.MSP_SET_MIXER_CONFIG: case MSPCodes.MSP_SET_MIXER_CONFIG:

View file

@ -332,6 +332,7 @@ function onConnect() {
if (CONFIG.flightControllerVersion !== '') { if (CONFIG.flightControllerVersion !== '') {
FEATURE_CONFIG.features = new Features(CONFIG); FEATURE_CONFIG.features = new Features(CONFIG);
BEEPER_CONFIG.beepers = new Beepers(CONFIG); BEEPER_CONFIG.beepers = new Beepers(CONFIG);
BEEPER_CONFIG.dshotBeaconConditions = new Beepers(CONFIG, [ "RX_LOST", "RX_SET" ]);
$('#tabs ul.mode-connected').show(); $('#tabs ul.mode-connected').show();

View file

@ -240,6 +240,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
var dshotBeacon_e = $('.tab-configuration .dshotbeacon'); var dshotBeacon_e = $('.tab-configuration .dshotbeacon');
var dshotBeeperSwitch = $('#dshotBeeperSwitch'); var dshotBeeperSwitch = $('#dshotBeeperSwitch');
var dshotBeeperBeaconTone = $('select.dshotBeeperBeaconTone'); var dshotBeeperBeaconTone = $('select.dshotBeeperBeaconTone');
var dshotBeaconCondition_e = $('tbody.dshotBeaconConditions');
var dshotBeaconSwitch_e = $('tr.dshotBeaconSwitch');
if (semver.gte(CONFIG.apiVersion, "1.37.0")) { if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
for (var i = 1; i <= 5; i++) { for (var i = 1; i <= 5; i++) {
@ -250,27 +252,40 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
dshotBeeper_e.hide(); dshotBeeper_e.hide();
} }
dshotBeeperSwitch.change(function() {
if ($(this).is(':checked')) {
dshotBeacon_e.show();
if (dshotBeeperBeaconTone.val() == 0) {
dshotBeeperBeaconTone.val(1).change();
}
} else {
dshotBeeperBeaconTone.val(0).change();
dshotBeacon_e.hide();
}
});
dshotBeeperBeaconTone.change(function() { dshotBeeperBeaconTone.change(function() {
BEEPER_CONFIG.dshotBeaconTone = dshotBeeperBeaconTone.val(); BEEPER_CONFIG.dshotBeaconTone = dshotBeeperBeaconTone.val();
}); });
dshotBeeperBeaconTone.val(BEEPER_CONFIG.dshotBeaconTone); dshotBeeperBeaconTone.val(BEEPER_CONFIG.dshotBeaconTone);
dshotBeeperSwitch.prop('checked', BEEPER_CONFIG.dshotBeaconTone !== 0).change();
var template = $('.beepers .beeper-template');
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
dshotBeaconSwitch_e.hide();
BEEPER_CONFIG.dshotBeaconConditions.generateElements(template, dshotBeaconCondition_e);
$('input.condition', dshotBeaconCondition_e).change(function () {
var element = $(this);
BEEPER_CONFIG.dshotBeaconConditions.updateData(element);
});
} else {
dshotBeaconCondition_e.hide();
dshotBeeperSwitch.change(function() {
if ($(this).is(':checked')) {
dshotBeacon_e.show();
if (dshotBeeperBeaconTone.val() == 0) {
dshotBeeperBeaconTone.val(1).change();
}
} else {
dshotBeeperBeaconTone.val(0).change();
dshotBeacon_e.hide();
}
});
dshotBeeperSwitch.prop('checked', BEEPER_CONFIG.dshotBeaconTone !== 0).change();
}
// Analog Beeper // Analog Beeper
var template = $('.beepers .beeper-template');
var destination = $('.beepers .beeper-configuration'); var destination = $('.beepers .beeper-configuration');
var beeper_e = $('.tab-configuration .beepers'); var beeper_e = $('.tab-configuration .beepers');
@ -890,7 +905,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
}); });
$('input.beeper', beeper_e).change(function () { $('input.condition', beeper_e).change(function () {
var element = $(this); var element = $(this);
BEEPER_CONFIG.beepers.updateData(element); BEEPER_CONFIG.beepers.updateData(element);
}); });

View file

@ -676,12 +676,12 @@
</tr> </tr>
<tr class="dshotbeeper"> <tr class="dshotbeeper">
<td style="width:calc(50%)" colspan="2"> <td style="width:calc(100%)" colspan="2">
<!-- ROW 5 - HALF WIDTH PANE --> <!-- ROW 5 - FULL WIDTH PANE -->
<!-- DSHOT BEEPER --> <!-- DSHOT BEEPER -->
<div class="dshotBeeper" style="width: calc(50%);"> <div class="dshotBeeper" style="width: calc(100%);">
<div class="gui_box grey" style="margin-top:10px;"> <div class="gui_box grey" style="margin-top:10px;">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationDshotBeeper"></div> <div class="spacer_box_title" i18n="configurationDshotBeeper"></div>
@ -689,7 +689,7 @@
<div class="spacer_box"> <div class="spacer_box">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tbody class="dshot-beeper-configuration" id="noline"> <tbody class="dshot-beeper-configuration" id="noline">
<tr> <tr class="dshotBeaconSwitch">
<td> <td>
<div class="number"> <div class="number">
<div style="float: left; height: 20px; margin-right: 34px;"> <div style="float: left; height: 20px; margin-right: 34px;">
@ -718,6 +718,11 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table cellpadding="0" cellspacing="0">
<tbody class="dshotBeaconConditions" id="noline">
<!-- table generated here -->
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
@ -739,13 +744,13 @@
<tbody class="beeper-configuration" id="noline"> <tbody class="beeper-configuration" id="noline">
<tr class="beeper-template" style="display:none"> <tr class="beeper-template" style="display:none">
<td> <td>
<input class="beeper toggle" id="" name="" title="" type="checkbox" /> <input class="condition toggle" id="" name="" title="" type="checkbox" />
</td> </td>
<td> <td>
<label for=""></label> <label for=""></label>
</td> </td>
<td> <td>
<span i18n=""></span> <span></span>
</td> </td>
</tr> </tr>
<!-- table generated here --> <!-- table generated here -->