'use strict;' var Features = function (config) { var self = this; var features = [ {bit: 0, group: 'rxMode', mode: 'group', name: 'RX_PPM'}, {bit: 1, group: 'batteryVoltage', name: 'VBAT'}, {bit: 2, group: 'other', name: 'INFLIGHT_ACC_CAL'}, {bit: 3, group: 'rxMode', mode: 'group', name: 'RX_SERIAL'}, {bit: 4, group: 'esc', name: 'MOTOR_STOP'}, {bit: 5, group: 'other', name: 'SERVO_TILT'}, {bit: 6, group: 'other', name: 'SOFTSERIAL', haveTip: true}, {bit: 7, group: 'gps', name: 'GPS', haveTip: true}, {bit: 9, group: 'other', name: 'SONAR'}, {bit: 10, group: 'other', name: 'TELEMETRY'}, {bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'}, {bit: 12, group: 'other', name: '3D'}, {bit: 13, group: 'rxMode', mode: 'group', name: 'RX_PARALLEL_PWM'}, {bit: 14, group: 'rxMode', mode: 'group', name: 'RX_MSP'}, {bit: 15, group: 'rssi', name: 'RSSI_ADC'}, {bit: 16, group: 'other', name: 'LED_STRIP'}, {bit: 17, group: 'other', name: 'DISPLAY'}, {bit: 19, group: 'other', name: 'BLACKBOX', haveTip: true} ]; if (semver.gte(config.apiVersion, "1.12.0")) { features.push( {bit: 20, group: 'other', name: 'CHANNEL_FORWARDING'} ); } if (semver.gte(config.apiVersion, "1.15.0")) { features.push( {bit: 8, group: 'rxFailsafe', name: 'FAILSAFE', haveTip: true} ); } else { features.push( {bit: 8, group: 'rxFailsafe', name: 'FAILSAFE', haveTip: true} ); } if (semver.gte(config.apiVersion, "1.16.0")) { features.push( {bit: 21, group: 'other', name: 'TRANSPONDER', haveTip: true} ); } if (config.flightControllerVersion !== '') { if (semver.gte(config.flightControllerVersion, "2.8.0")) { features.push( {bit: 22, group: 'other', name: 'AIRMODE'} ); } if (semver.gte(config.flightControllerVersion, "2.8.0") && !semver.gte(config.flightControllerVersion, "3.0.0")) { features.push( {bit: 23, group: 'pidTuning', name: 'SUPEREXPO_RATES'} ); } if (semver.gte(config.flightControllerVersion, "3.0.0")) { features.push( {bit: 18, group: 'other', name: 'OSD', haveTip: true} ); } } self._features = features; self._featureMask = 0; } Features.prototype.getMask = function () { var self = this; return self._featureMask; } Features.prototype.setMask = function (featureMask) { var self = this; self._featureMask = featureMask; } Features.prototype.isEnabled = function (featureName) { var self = this; for (var i = 0; i < self._features.length; i++) { if (self._features[i].name === featureName && bit_check(self._featureMask, self._features[i].bit)) { return true; } } return false; } Features.prototype.generateElements = function (featuresElements) { var self = this; var radioGroups = []; for (var i = 0; i < self._features.length; i++) { var row_e; var feature_tip_html = ''; if (self._features[i].haveTip) { feature_tip_html = '
'; } if (self._features[i].mode === 'group') { row_e = $('