diff --git a/locales/en/messages.json b/locales/en/messages.json index 6a456b71..c04cf13d 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -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" }, diff --git a/src/js/Beepers.js b/src/js/Beepers.js index cbd9f6d9..3b147c5d 100644 --- a/src/js/Beepers.js +++ b/src/js/Beepers.js @@ -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; }; diff --git a/src/js/fc.js b/src/js/fc.js index 710d807c..7b56f2d5 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -105,6 +105,7 @@ var FC = { BEEPER_CONFIG = { beepers: 0, dshotBeaconTone: 0, + dshotBeaconConditions: 0, }; MIXER_CONFIG = { diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index b0b2caef..6a7cd692 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -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: diff --git a/src/js/serial_backend.js b/src/js/serial_backend.js index e06208c7..37e27375 100755 --- a/src/js/serial_backend.js +++ b/src/js/serial_backend.js @@ -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(); diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index 69a79feb..6ca6cc23 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -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); }); diff --git a/src/tabs/configuration.html b/src/tabs/configuration.html index 5ed47faa..b494e114 100644 --- a/src/tabs/configuration.html +++ b/src/tabs/configuration.html @@ -676,12 +676,12 @@ - - + + -
+
@@ -689,7 +689,7 @@
- +
@@ -718,6 +718,11 @@
+ + + + +
@@ -739,13 +744,13 @@ - + - +