Welcome to mirror list, hosted at ThFree Co, Russian Federation.

peripherals.js « js - github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2c340fb59449a27964369cd10bab6f1ab0d72efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'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:
                return defaultName;
        }
    } 
    
    return defaultName;
    
}