1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 19:40:22 +03:00
inav-configurator/js/peripherals.js
Darren Lines e75204c96d Update peripherals.js
OK, the original part was done at 4am, because I couldn't sleep. It works now.
2022-08-13 11:57:34 +01:00

37 lines
No EOL
1 KiB
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_DEVICE_CONTROL")) {
switch (modeId) {
case 39: // BOXCAMERA1
return "CAMERA WI-FI";
case 40: // BOXCAMERA2
return "CAMERA POWER";
case 41: // BOXCAMERA3
return "CAMERA CHANGE MODE";
default:
break;
}
}
if (modeId === 11) {
if (FC.isAirplane()) {
return "NAV LOITER";
}
}
return defaultName;
}