Added bind button for receivers that support it.

10.7.0-preview
Michael Keller 2020-02-06 15:12:13 +13:00 committed by mikeller
parent 2925646d82
commit c2575935fc
5 changed files with 21 additions and 1 deletions

View File

@ -1952,6 +1952,9 @@
"receiverButtonRefresh": {
"message": "Refresh"
},
"receiverButtonBind": {
"message": "Bind Receiver"
},
"receiverButtonSticks": {
"message": "Control sticks"
},

View File

@ -633,6 +633,7 @@ var FC = {
HAS_FLASH_BOOTLOADER: 3,
SUPPORTS_CUSTOM_DEFAULTS: 4,
HAS_CUSTOM_DEFAULTS: 5,
SUPPORTS_RX_BIND: 6,
},
boardHasVcp: function () {

View File

@ -173,7 +173,10 @@ var MSPCodes = {
MSP_DEBUGMSG: 253, // Not used
MSP_DEBUG: 254,
// MSPv2
// MSPv2 Common
MSP2_COMMON_SERIAL_CONFIG: 0x1009,
MSP2_COMMON_SET_SERIAL_CONFIG: 0x100A,
// MSPv2 Betaflight specific
MSP2_BETAFLIGHT_BIND: 0x3000,
};

View File

@ -325,6 +325,16 @@ TABS.receiver.initialize = function (callback) {
});
});
let showBindButton = false;
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
showBindButton = bit_check(CONFIG.targetCapabilities, FC.TARGET_CAPABILITIES_FLAGS.SUPPORTS_RX_BIND);
$("a.bind").click(function() {
MSP.send_message(MSPCodes.MSP2_BETAFLIGHT_BIND);
});
}
$(".bind_btn").toggle(showBindButton);
// RC Smoothing
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
$('.tab-receiver .rcSmoothing').show();

View File

@ -315,6 +315,9 @@
<div class="btn sticks_btn">
<a class="sticks" href="#" i18n="receiverButtonSticks"></a>
</div>
<div class="btn bind_btn">
<a class="bind" href="#" i18n="receiverButtonBind"></a>
</div>
<div class="btn refresh_btn">
<a class="refresh" href="#" i18n="receiverButtonRefresh"></a>
</div>