Merge pull request #1048 from mikeller/add_dshot_beacon_condition

Added configuration for Dshot beacon activation conditions.
10.3.x-maintenance
Michael Keller 2018-06-11 01:21:25 +12:00 committed by GitHub
commit 9cd01586b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)."
},
"configurationDshotBeeper": {
"message": "DSHOT Beacon Configuration"
"message": "Dshot Beacon Configuration"
},
"configurationUseDshotBeeper": {
"message": "Use DSHOT beacon (use motors to sound beeps when disarmed)"
"message": "Use Dshot beacon (use motors to sound beeps when disarmed)"
},
"configurationDshotBeaconTone": {
"message": "Beacon Tone"
@ -1004,13 +1004,10 @@
"message": "Warning beeps when battery is getting low (repeats)"
},
"beeperGPS_STATUS": {
"message": ""
"message": "Use the number of beeps to indicate how many GPS satellites were found"
},
"beeperRX_SET": {
"message": "Beeps when aux channel is set for beep or beep sequence how many satellites has found if GPS enabled"
},
"beeperDISARM_REPEAT": {
"message": "Beeps sounded while stick held in disarm position"
"message": "Beeps when aux channel is set for beep"
},
"beeperACC_CALIBRATION": {
"message": "Accelerometer inflight calibration completed confirmation"
@ -1024,18 +1021,30 @@
"beeperMULTI_BEEPS": {
"message": ""
},
"beeperDISARM_REPEAT": {
"message": "Beeps sounded while stick held in disarm position"
},
"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": {
"message": "Initialisation beeps when board is powered on"
},
"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": {
"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": {
"message": "3D ESC/Motor Features"
},

View File

@ -1,6 +1,6 @@
'use strict;'
var Beepers = function (config) {
var Beepers = function (config, supportedConditions) {
var self = this;
var beepers = [
@ -12,7 +12,7 @@ var Beepers = function (config) {
{bit: 5, name: 'ARMING_GPS_FIX', visible: true},
{bit: 6, name: 'BAT_CRIT_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: 10, name: 'ACC_CALIBRATION', 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},
];
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;
};

View File

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

View File

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

View File

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

View File

@ -240,6 +240,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
var dshotBeacon_e = $('.tab-configuration .dshotbeacon');
var dshotBeeperSwitch = $('#dshotBeeperSwitch');
var dshotBeeperBeaconTone = $('select.dshotBeeperBeaconTone');
var dshotBeaconCondition_e = $('tbody.dshotBeaconConditions');
var dshotBeaconSwitch_e = $('tr.dshotBeaconSwitch');
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
for (var i = 1; i <= 5; i++) {
@ -250,27 +252,40 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
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() {
BEEPER_CONFIG.dshotBeaconTone = dshotBeeperBeaconTone.val();
});
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
var template = $('.beepers .beeper-template');
var destination = $('.beepers .beeper-configuration');
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);
BEEPER_CONFIG.beepers.updateData(element);
});

View File

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