Rename ExpressLRS "passphrase" to "binding phrase" (#3257)
parent
52c53deb33
commit
80686eb8ef
|
@ -2174,8 +2174,8 @@
|
||||||
"receiverButtonBindMessage": {
|
"receiverButtonBindMessage": {
|
||||||
"message": "Bind request sent to the flight controller."
|
"message": "Bind request sent to the flight controller."
|
||||||
},
|
},
|
||||||
"receiverButtonPassphrase": {
|
"receiverButtonBindingPhrase": {
|
||||||
"message": "Passphrase"
|
"message": "Binding phrase"
|
||||||
},
|
},
|
||||||
"receiverButtonSticks": {
|
"receiverButtonSticks": {
|
||||||
"message": "Control sticks"
|
"message": "Control sticks"
|
||||||
|
|
|
@ -625,7 +625,7 @@
|
||||||
float: left;
|
float: left;
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
}
|
}
|
||||||
.elrsPassphrase {
|
.elrsBindingPhrase {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.elrsUid {
|
.elrsUid {
|
||||||
|
|
|
@ -24,7 +24,7 @@ const receiver = {
|
||||||
rateChartHeight: 117,
|
rateChartHeight: 117,
|
||||||
analyticsChanges: {},
|
analyticsChanges: {},
|
||||||
needReboot: false,
|
needReboot: false,
|
||||||
elrsPassphraseEnabled: false,
|
elrsBindingPhraseEnabled: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
receiver.initialize = function (callback) {
|
receiver.initialize = function (callback) {
|
||||||
|
@ -32,20 +32,20 @@ receiver.initialize = function (callback) {
|
||||||
|
|
||||||
GUI.active_tab = 'receiver';
|
GUI.active_tab = 'receiver';
|
||||||
|
|
||||||
function lookup_elrs_passphrase(uidString) {
|
function lookupElrsBindingPhrase(uidString) {
|
||||||
const passphraseMap = getConfig('passphrase_map').passphrase_map || {};
|
const bindingPhraseMap = getConfig('binding_phrase_map').binding_phrase_map || {};
|
||||||
|
|
||||||
return passphraseMap[uidString] ?? 0;
|
return bindingPhraseMap[uidString] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_elrs_passphrase(uidString, passphrase) {
|
function saveElrsBindingPhrase(uidString, bindingPhrase) {
|
||||||
const passphraseMap = getConfig('passphrase_map').passphrase_map ?? {};
|
const bindingPhraseMap = getConfig('binding_phrase_map').binding_phrase_map ?? {};
|
||||||
|
|
||||||
passphraseMap[uidString] = passphrase;
|
bindingPhraseMap[uidString] = bindingPhrase;
|
||||||
setConfig({'passphrase_map': passphraseMap});
|
setConfig({'binding_phrase_map': bindingPhraseMap});
|
||||||
}
|
}
|
||||||
|
|
||||||
function elrs_passphrase_to_bytes(text) {
|
function elrsBindingPhraseToBytes(text) {
|
||||||
let uidBytes = [0,0,0,0,0,0];
|
let uidBytes = [0,0,0,0,0,0];
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
|
@ -337,30 +337,30 @@ receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI') && FC.RX_CONFIG.rxSpiProtocol == 19 && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI') && FC.RX_CONFIG.rxSpiProtocol == 19 && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||||
tab.elrsPassphraseEnabled = true;
|
tab.elrsBindingPhraseEnabled = true;
|
||||||
|
|
||||||
const elrsUid = $('span.elrsUid');
|
const elrsUid = $('span.elrsUid');
|
||||||
const elrsUidString = FC.RX_CONFIG.elrsUid.join(',');
|
const elrsUidString = FC.RX_CONFIG.elrsUid.join(',');
|
||||||
|
|
||||||
elrsUid.text(elrsUidString);
|
elrsUid.text(elrsUidString);
|
||||||
|
|
||||||
const elrsPassphrase = $('input.elrsPassphrase');
|
const elrsBindingPhrase = $('input.elrsBindingPhrase');
|
||||||
|
|
||||||
const passphraseString = lookup_elrs_passphrase(elrsUidString);
|
const bindingPhraseString = lookupElrsBindingPhrase(elrsUidString);
|
||||||
if (passphraseString) {
|
if (bindingPhraseString) {
|
||||||
elrsPassphrase.val(passphraseString);
|
elrsBindingPhrase.val(bindingPhraseString);
|
||||||
}
|
}
|
||||||
elrsPassphrase.on('keyup', function() {
|
elrsBindingPhrase.on('keyup', function() {
|
||||||
const passphrase = elrsPassphrase.val();
|
const bindingPhrase = elrsBindingPhrase.val();
|
||||||
if (passphrase) {
|
if (bindingPhrase) {
|
||||||
elrsUid.text(elrs_passphrase_to_bytes(passphrase));
|
elrsUid.text(elrsBindingPhraseToBytes(bindingPhrase));
|
||||||
} else {
|
} else {
|
||||||
elrsUid.text("0.0.0.0.0.0");
|
elrsUid.text("0.0.0.0.0.0");
|
||||||
}
|
}
|
||||||
updateSaveButton(true);
|
updateSaveButton(true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
tab.elrsPassphraseEnabled = false;
|
tab.elrsBindingPhraseEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
|
@ -405,9 +405,9 @@ receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkShowElrsPassphrase() {
|
function checkShowElrsBindingPhrase() {
|
||||||
$('#elrsContainer').toggle(tab.elrsPassphraseEnabled);
|
$('#elrsContainer').toggle(tab.elrsBindingPhraseEnabled);
|
||||||
$('input.elrsUid').toggle(tab.elrsPassphraseEnabled);
|
$('input.elrsUid').toggle(tab.elrsBindingPhraseEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(featuresElement).filter('select').change(function () {
|
$(featuresElement).filter('select').change(function () {
|
||||||
|
@ -417,14 +417,14 @@ receiver.initialize = function (callback) {
|
||||||
if (element.attr('name') === 'rxMode') {
|
if (element.attr('name') === 'rxMode') {
|
||||||
checkShowSerialRxBox();
|
checkShowSerialRxBox();
|
||||||
checkShowSpiRxBox();
|
checkShowSpiRxBox();
|
||||||
checkShowElrsPassphrase();
|
checkShowElrsBindingPhrase();
|
||||||
updateSaveButton(true);
|
updateSaveButton(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
checkShowSerialRxBox();
|
checkShowSerialRxBox();
|
||||||
checkShowSpiRxBox();
|
checkShowSpiRxBox();
|
||||||
checkShowElrsPassphrase();
|
checkShowElrsBindingPhrase();
|
||||||
updateSaveButton();
|
updateSaveButton();
|
||||||
|
|
||||||
$('a.refresh').click(function () {
|
$('a.refresh').click(function () {
|
||||||
|
@ -466,14 +466,14 @@ receiver.initialize = function (callback) {
|
||||||
FC.RX_CONFIG.rcSmoothingAutoFactor = parseInt($('input[name="rcSmoothingAutoFactor-number"]').val());
|
FC.RX_CONFIG.rcSmoothingAutoFactor = parseInt($('input[name="rcSmoothingAutoFactor-number"]').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tab.elrsPassphraseEnabled) {
|
if (tab.elrsBindingPhraseEnabled) {
|
||||||
const elrsUidChars = $('span.elrsUid')[0].innerText.split(',').map(uidChar => parseInt(uidChar, 10));
|
const elrsUidChars = $('span.elrsUid')[0].innerText.split(',').map(uidChar => parseInt(uidChar, 10));
|
||||||
if (elrsUidChars.length === 6) {
|
if (elrsUidChars.length === 6) {
|
||||||
FC.RX_CONFIG.elrsUid = elrsUidChars;
|
FC.RX_CONFIG.elrsUid = elrsUidChars;
|
||||||
|
|
||||||
const elrsUid = $('span.elrsUid')[0].innerText;
|
const elrsUid = $('span.elrsUid')[0].innerText;
|
||||||
const elrsPassphrase = $('input.elrsPassphrase').val();
|
const elrsBindingPhrase = $('input.elrsBindingPhrase').val();
|
||||||
save_elrs_passphrase(elrsUid, elrsPassphrase);
|
saveElrsBindingPhrase(elrsUid, elrsBindingPhrase);
|
||||||
} else {
|
} else {
|
||||||
FC.RX_CONFIG.elrsUid = [0, 0, 0, 0, 0, 0];
|
FC.RX_CONFIG.elrsUid = [0, 0, 0, 0, 0, 0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="elrsContainer" class="elrsContainer spacer_box">
|
<div id="elrsContainer" class="elrsContainer spacer_box">
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<input type="text" class="elrsPassphrase">
|
<input type="text" class="elrsBindingPhrase">
|
||||||
<span i18n="receiverButtonPassphrase"></span>
|
<span i18n="receiverButtonBindingPhrase"></span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="elrsUid"></span>
|
<span class="elrsUid"></span>
|
||||||
|
|
Loading…
Reference in New Issue