1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 04:45:20 +03:00
betaflight-configurator/js/peripherals.js
Miguel Angel Mulero Martinez 6054e69445 Adjust peripherals mode name in failsafe tab
The failsafe tab does not adjust the real name of the MODE for
peripherals. Only the MODES tab do it.
2017-10-04 13:08:21 +02:00

32 lines
No EOL
995 B
JavaScript

'use strict';
// return true if user has choose a special peripheral
function isPeripheralSelected(peripheralName) {
for (var portIndex = 0; portIndex < SERIAL_CONFIG.ports.length; portIndex++) {
var serialPort = SERIAL_CONFIG.ports[portIndex];
if (serialPort.functions.indexOf(peripheralName) >= 0) {
return true;
}
}
return false;
}
// Adjust the real name for a modeId. Useful if it belongs to a peripheral
function adjustBoxNameIfPeripheralWithModeID(modeId, defaultName) {
if (isPeripheralSelected("RUNCAM_SPLIT_CONTROL")) {
switch (modeId) {
case 32: // BOXCAMERA1
return chrome.i18n.getMessage('modeCameraWifi');
case 33: // BOXCAMERA2
return chrome.i18n.getMessage('modeCameraPower');
case 34: // BOXCAMERA3
return chrome.i18n.getMessage('modeCameraChangeMode');
default:
return defaultName;
}
}
return defaultName;
}