diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c63c9adf..c5f6746f 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2129,7 +2129,7 @@ "message": "Note: When Stage 2 is DISABLED, the fallback setting Auto is used instead of the user settings for all flightchannels (Roll, Pitch, Yaw and Throttle)." }, "failsafeDelayItem": { - "message": "Guard time for activation after signal lost [1 = 0.1 sec.]" + "message": "Guard time for activation after signal lost [For deciseconds (ds): 1 = 0.1 sec.]" }, "failsafeDelayHelp": { "message": "Time for stage 1 to wait for recovery" @@ -2138,7 +2138,7 @@ "message": "Throttle value used while landing" }, "failsafeOffDelayItem": { - "message": "Delay for turning off the Motors during Failsafe [1 = 0.1 sec.]" + "message": "Delay for turning off the Motors during Failsafe [For deciseconds (ds):1 = 0.1 sec.]" }, "failsafeOffDelayHelp": { "message": "Time to stay in landing mode untill the motors are turned off and the craft is disarmed" @@ -2897,16 +2897,16 @@ "message": "Fly Time (minutes)" }, "osd_alt_alarm": { - "message": "Altitude (meters)" + "message": "Altitude" }, "osd_dist_alarm": { - "message": "Distance (meters)" + "message": "Distance" }, "osdAlarmDIST_HELP": { "message": "The distance to home indicator will flash when the distance is greater than this value. Zero disables this alarm." }, "osd_neg_alt_alarm": { - "message": "Negative Altitude (meters)" + "message": "Negative Altitude" }, "osdAlarmMAX_NEG_ALTITUDE_HELP": { "message": "The altitude indicator will flash when altitude is negative and its absolute value is greater than this alarm. Useful when taking off from elevated places. Zero disables this alarm." diff --git a/js/model.js b/js/model.js index 273de731..c239acdf 100644 --- a/js/model.js +++ b/js/model.js @@ -44,6 +44,7 @@ const // generate mixer const mixerList = [ + // ** Multirotor { id: 1, name: 'Tricopter', @@ -60,7 +61,7 @@ const mixerList = [ servoMixer: [ new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0), ] - }, // 1 + }, // 1 { id: 3, name: 'Quad X', @@ -76,7 +77,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L ], servoMixer: [] - }, // 3 + }, // 3 { id: 2, name: 'Quad +', @@ -92,7 +93,7 @@ const mixerList = [ new MotorMixRule(1.0, 0.0, -1.0, -1.0), // FRONT ], servoMixer: [] - }, // 2 + }, // 2 { id: 4, name: 'Bicopter', @@ -103,18 +104,7 @@ const mixerList = [ platform: PLATFORM_MULTIROTOR, motorMixer: [], servoMixer: [] - }, // 4 - { - id: 5, - name: 'Gimbal', - model: 'custom', - image: 'custom', - enabled: false, - legacy: true, - platform: PLATFORM_OTHER, - motorMixer: [], - servoMixer: [] - }, // 5 + }, // 4 { id: 6, name: 'Y6', @@ -132,7 +122,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, -0.666667, 1.0), // UNDER_LEFT ], servoMixer: [] - }, // 6 + }, // 6 { id: 7, name: 'Hex +', @@ -150,45 +140,7 @@ const mixerList = [ new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR ], servoMixer: [] - }, // 7 - { - id: 8, - name: 'Flying Wing', - model: 'flying_wing', - image: 'flying_wing', - enabled: true, - legacy: true, - platform: PLATFORM_AIRPLANE, - motorMixer: [ - new MotorMixRule(1.0, 0.0, 0.0, 0.0), - new MotorMixRule(1.0, 0.0, 0.0, 0.0), - ], - servoMixer: [ - new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0), - new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0), - new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0), - new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0), - ] - }, // 8 - { - id: 27, - name: 'Flying Wing with differential thrust', - model: 'flying_wing', - image: 'flying_wing', - enabled: true, - legacy: false, - platform: PLATFORM_AIRPLANE, - motorMixer: [ - new MotorMixRule(1.0, 0.0, 0.0, 0.1), - new MotorMixRule(1.0, 0.0, 0.0, -0.1) - ], - servoMixer: [ - new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0), - new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0), - new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0), - new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0), - ] - }, // 27 + }, // 7 { id: 9, name: 'Y4', @@ -204,7 +156,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, -1.0, 0.0), // FRONT_L CW ], servoMixer: [] - }, // 9 + }, // 9 { id: 10, name: 'Hex X', @@ -222,7 +174,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, 0.0, 1.0), // LEFT ], servoMixer: [] - }, // 10 + }, // 10 { id: 11, name: 'Octo X8', @@ -242,7 +194,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, -1.0, 1.0), // UNDER_FRONT_L ], servoMixer: [] - }, // 11 + }, // 11 { id: 12, name: 'Octo Flat +', @@ -262,7 +214,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, 0.0, -1.0), // LEFT ], servoMixer: [] - }, // 12 + }, // 12 { id: 13, name: 'Octo Flat X', @@ -282,51 +234,7 @@ const mixerList = [ new MotorMixRule(1.0, 1.0, 0.414178, -1.0), // MIDREAR_L ], servoMixer: [] - }, // 13 - { - id: 14, - name: 'Airplane', - model: 'twin_plane', - image: 'airplane', - enabled: true, - legacy: true, - platform: PLATFORM_AIRPLANE, - hasFlaps: true, - motorMixer: [ - new MotorMixRule(1.0, 0.0, 0.0, 0.0), - new MotorMixRule(1.0, 0.0, 0.0, 0.0), - ], - servoMixer: [ - new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0), - new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 100, 0), - /*new ServoMixRule(SERVO_FLAPPERON_1, INPUT_FEATURE_FLAPS, 100, 0),*/ - new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0), - /*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/ - new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0), - ] - }, // 14 - { - id: 15, - name: 'Heli 120', - model: 'custom', - image: 'custom', - enabled: false, - legacy: true, - platform: PLATFORM_HELICOPTER, - motorMixer: [], - servoMixer: [] - }, // 15 - { - id: 16, - name: 'Heli 90', - model: 'custom', - image: 'custom', - enabled: false, - legacy: true, - platform: PLATFORM_HELICOPTER, - motorMixer: [], - servoMixer: [] - }, // 16 + }, // 13 { id: 17, name: 'V-tail Quad', @@ -360,18 +268,7 @@ const mixerList = [ new MotorMixRule(1.0, 0.0, 0.0, 0.0), // LEFT ], servoMixer: [] - }, // 18 - { - id: 19, - name: 'PPM to SERVO', - model: 'custom', - image: 'custom', - enabled: false, - legacy: true, - platform: PLATFORM_OTHER, - motorMixer: [], - servoMixer: [] - }, // 19 + }, // 18 { id: 20, name: 'Dualcopter', @@ -382,7 +279,7 @@ const mixerList = [ platform: PLATFORM_MULTIROTOR, motorMixer: [], servoMixer: [] - }, // 20 + }, // 20 { id: 21, name: 'Singlecopter', @@ -393,7 +290,7 @@ const mixerList = [ platform: PLATFORM_MULTIROTOR, motorMixer: [], servoMixer: [] - }, // 21 + }, // 21 { id: 22, name: 'A-tail Quad', @@ -420,18 +317,7 @@ const mixerList = [ platform: PLATFORM_MULTIROTOR, motorMixer: [], servoMixer: [] - }, // 23 - { - id: 24, - name: 'Custom Airplane', - model: 'twin_plane', - image: 'airplane', - enabled: false, - legacy: true, - platform: PLATFORM_AIRPLANE, - motorMixer: [], - servoMixer: [] - }, // 24 + }, // 23 { id: 25, name: 'Custom Tricopter', @@ -442,7 +328,67 @@ const mixerList = [ platform: PLATFORM_TRICOPTER, motorMixer: [], servoMixer: [] - }, // 25 + }, // 25 + + // ** Fixed Wing ** + { + id: 8, + name: 'Flying Wing', + model: 'flying_wing', + image: 'flying_wing', + enabled: true, + legacy: true, + platform: PLATFORM_AIRPLANE, + motorMixer: [ + new MotorMixRule(1.0, 0.0, 0.0, 0.0), + ], + servoMixer: [ + new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0), + new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0), + new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0), + new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0), + ] + }, // 8 + { + id: 27, + name: 'Flying Wing with differential thrust', + model: 'flying_wing', + image: 'flying_wing', + enabled: true, + legacy: false, + platform: PLATFORM_AIRPLANE, + motorMixer: [ + new MotorMixRule(1.0, 0.0, 0.0, 0.1), + new MotorMixRule(1.0, 0.0, 0.0, -0.1) + ], + servoMixer: [ + new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_ROLL, 50, 0), + new ServoMixRule(SERVO_ELEVON_1, INPUT_STABILIZED_PITCH, 50, 0), + new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_ROLL, -50, 0), + new ServoMixRule(SERVO_ELEVON_2, INPUT_STABILIZED_PITCH, 50, 0), + ] + }, // 27 + { + id: 14, + name: 'Airplane', + model: 'twin_plane', + image: 'airplane', + enabled: true, + legacy: true, + platform: PLATFORM_AIRPLANE, + hasFlaps: true, + motorMixer: [ + new MotorMixRule(1.0, 0.0, 0.0, 0.0), + ], + servoMixer: [ + new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0), + new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 100, 0), + /*new ServoMixRule(SERVO_FLAPPERON_1, INPUT_FEATURE_FLAPS, 100, 0),*/ + new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0), + /*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/ + new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0), + ] + }, // 14 { id: 26, name: 'Airplane with differential thrust', @@ -464,10 +410,10 @@ const mixerList = [ /*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),*/ new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0), ] - }, + }, // 26 { id: 28, - name: 'Airplane V-tail (individual aileron servos)', + name: 'Airplane V-tail', model: 'vtail_plane', image: 'airplane_vtail', enabled: true, @@ -487,7 +433,31 @@ const mixerList = [ new ServoMixRule(4, INPUT_STABILIZED_PITCH, -50, 0), new ServoMixRule(4, INPUT_STABILIZED_YAW, -50, 0) ] - }, + }, // 28 + { + id: 34, + name: 'Airplane V-tail with differential thrust', + model: 'vtail_plane', + image: 'airplane_vtail', + enabled: true, + legacy: false, + platform: PLATFORM_AIRPLANE, + hasFlaps: true, + motorMixer: [ + new MotorMixRule(1.0, 0.0, 0.0, 0.3), + new MotorMixRule(1.0, 0.0, 0.0, -0.3) + ], + servoMixer: [ + new ServoMixRule(1, INPUT_STABILIZED_ROLL, 100, 0), + /*new ServoMixRule(1, INPUT_FEATURE_FLAPS, 100, 0),*/ + new ServoMixRule(2, INPUT_STABILIZED_ROLL, 100, 0), + /*new ServoMixRule(2, INPUT_FEATURE_FLAPS, 100, 0),*/ + new ServoMixRule(3, INPUT_STABILIZED_PITCH, 50, 0), + new ServoMixRule(3, INPUT_STABILIZED_YAW, -50, 0), + new ServoMixRule(4, INPUT_STABILIZED_PITCH, -50, 0), + new ServoMixRule(4, INPUT_STABILIZED_YAW, -50, 0) + ] + }, // 34 { id: 29, name: 'Airplane V-tail (single aileron servo)', @@ -506,7 +476,7 @@ const mixerList = [ new ServoMixRule(3, INPUT_STABILIZED_PITCH, -50, 0), new ServoMixRule(3, INPUT_STABILIZED_YAW, -50, 0), ] - }, + }, //29 { id: 30, name: 'Airplane without rudder', @@ -526,7 +496,44 @@ const mixerList = [ new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0), /*new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, 100, 0),*/ ] - }, + }, // 30 + { + id: 24, + name: 'Custom Airplane', + model: 'twin_plane', + image: 'airplane', + enabled: false, + legacy: true, + platform: PLATFORM_AIRPLANE, + motorMixer: [], + servoMixer: [] + }, // 24 + + // ** Helicopter ** + { + id: 15, + name: 'Heli 120', + model: 'custom', + image: 'custom', + enabled: false, + legacy: true, + platform: PLATFORM_HELICOPTER, + motorMixer: [], + servoMixer: [] + }, // 15 + { + id: 16, + name: 'Heli 90', + model: 'custom', + image: 'custom', + enabled: false, + legacy: true, + platform: PLATFORM_HELICOPTER, + motorMixer: [], + servoMixer: [] + }, // 16 + + // ** Other platforms ** { id: 31, name: 'Rover', @@ -556,8 +563,8 @@ const mixerList = [ servoMixer: [ new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0), ] - } - , + }, + // ** Misc ** { id: 33, name: 'Other', @@ -572,7 +579,29 @@ const mixerList = [ servoMixer: [ new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0), ] - } + }, + { + id: 5, + name: 'Gimbal', + model: 'custom', + image: 'custom', + enabled: false, + legacy: true, + platform: PLATFORM_OTHER, + motorMixer: [], + servoMixer: [] + }, // 5 + { + id: 19, + name: 'PPM to SERVO', + model: 'custom', + image: 'custom', + enabled: false, + legacy: true, + platform: PLATFORM_OTHER, + motorMixer: [], + servoMixer: [] + }, // 19 ]; const platformList = [ diff --git a/js/motorMixRule.js b/js/motorMixRule.js index 7be8e8d3..16b241e1 100644 --- a/js/motorMixRule.js +++ b/js/motorMixRule.js @@ -7,9 +7,9 @@ var MotorMixRule = function (throttle, roll, pitch, yaw) { self.fromMsp = function (mspThrottle, mspRoll, mspPitch, mspYaw) { throttle = mspThrottle / 1000; - roll = (mspRoll / 1000) - 2; - pitch = (mspPitch / 1000) - 2; - yaw = (mspYaw / 1000) - 2; + roll = Math.round(((mspRoll / 1000) - 2) * 1000) / 1000; + pitch = Math.round(((mspPitch / 1000) - 2) * 1000) / 1000; + yaw = Math.round(((mspYaw / 1000) - 2) * 1000) / 1000; }; self.isUsed = function () { diff --git a/js/servoMixerRuleCollection.js b/js/servoMixerRuleCollection.js index e23de9e5..2fa3e56f 100644 --- a/js/servoMixerRuleCollection.js +++ b/js/servoMixerRuleCollection.js @@ -99,5 +99,20 @@ let ServoMixerRuleCollection = function () { }); } + self.getNextUnusedIndex = function() { + let nextTarget = 0; + + for (let ruleIndex in data) { + if (data.hasOwnProperty(ruleIndex)) { + let target = data[ruleIndex].getTarget(); + if (target > nextTarget) { + nextTarget = target; + } + } + } + + return nextTarget+1; + } + return self; }; \ No newline at end of file diff --git a/js/settings.js b/js/settings.js index cb98a8ec..bd749d3a 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,5 +1,7 @@ 'use strict'; +const GulpClient = require("gulp"); + var Settings = (function () { let self = {}; @@ -38,6 +40,8 @@ var Settings = (function () { } parent.show(); + input.prop('title', 'CLI: ' + input.data('setting')); + if (input.prop('tagName') == 'SELECT' || s.setting.table) { if (input.attr('type') == 'checkbox') { input.prop('checked', s.value > 0); @@ -79,9 +83,9 @@ var Settings = (function () { input.val(s.value.toFixed(2)); } else { var multiplier = parseFloat(input.data('setting-multiplier') || 1); - input.attr('type', 'number'); - input.val((s.value / multiplier).toFixed(Math.log10(multiplier))); + input.val((s.value / multiplier).toFixed(Math.log10(multiplier))); + input.attr('type', 'number'); if (typeof s.setting.min !== 'undefined' && s.setting.min !== null) { input.attr('min', (s.setting.min / multiplier).toFixed(Math.log10(multiplier))); } @@ -146,22 +150,39 @@ var Settings = (function () { //display names for the units const unitDisplayDames = { + // Misc 'us' : "uS", - 'deg' : '°', - 'cdeg' : 'centi°', - 'cmss' : 'cm/s/s', - 'cm' : 'cm', - 'cms' : 'cm/s', - 'm' : 'm', - 'ms' : 'ms', - 'mps' : 'm/s', - 'kmh' : 'Km/h', - 'sec' : 's', - 'kt' : 'Kt', - 'ft' : 'ft', - 'mph' : 'mph', 'cw' : 'cW', - 'percent' : '%' + 'percent' : '%', + 'cmss' : 'cm/s/s', + // Time + 'msec' : 'ms', + 'dsec' : 'ds', + 'sec' : 's', + // Angles + 'deg' : '°', + 'decideg' : 'deci°', + // Temperature + 'decidegc' : 'deci°C', + 'degc' : '°C', + 'degf' : '°F', + // Speed + 'cms' : 'cm/s', + 'v-cms' : 'cm/s', + 'ms' : 'm/s', + 'kmh' : 'Km/h', + 'mph' : 'mph', + 'hftmin' : 'x100 ft/min', + 'fts' : 'ft/s', + 'kt' : 'Kt', + // Distance + 'cm' : 'cm', + 'm' : 'm', + 'km' : 'Km', + 'm-lrg' : 'm', // Metres, but converted to larger units + 'ft' : 'ft', + 'mi' : 'mi', + 'nm' : 'NM' } @@ -179,51 +200,97 @@ var Settings = (function () { 'm' : 100, 'ft' : 30.48 }, - 'cms' : { + 'm' : { + 'm' : 1, + 'ft' : 0.3048 + }, + 'm-lrg' : { + 'km' : 1000, + 'mi' : 1609.344, + 'nm' : 1852 + }, + 'cms' : { // Horizontal speed 'kmh' : 27.77777777777778, 'kt': 51.44444444444457, 'mph' : 44.704, - 'mps' : 100 + 'ms' : 100 }, - 'ms' : { + 'v-cms' : { // Vertical speed + 'ms' : 100, + 'hftmin' : 50.8, + 'fts' : 30.48 + }, + 'msec' : { 'sec' : 1000 }, - 'cdeg' : { + 'dsec' : { + 'sec' : 10 + }, + 'decideg' : { 'deg' : 10 }, + 'decidegc' : { + 'degc' : 10, + 'degf' : 'FAHREN' + }, }; //this holds which units get converted in which unit systems const conversionTable = { 0: { //imperial 'cm' : 'ft', + 'm' : 'ft', + 'm-lrg' : 'mi', 'cms' : 'mph', - 'cdeg' : 'deg', - 'ms' : 'sec' + 'v-cms' : 'fts', + 'msec' : 'sec', + 'dsec' : 'sec', + 'decideg' : 'deg', + 'decidegc' : 'degf', }, - 1: {//metric + 1: { //metric 'cm': 'm', + 'm' : 'm', + 'm-lrg' : 'km', 'cms' : 'kmh', - 'ms' : 'sec', - 'cdeg' : 'deg' + 'v-cms' : 'ms', + 'msec' : 'sec', + 'dsec' : 'sec', + 'decideg' : 'deg', + 'decidegc' : 'degc', }, 2: { //metric with MPH 'cm': 'm', + 'm' : 'm', + 'm-lrg' : 'km', 'cms' : 'mph', - 'cdeg' : 'deg', - 'ms' : 'sec' + 'v-cms' : 'ms', + 'decideg' : 'deg', + 'msec' : 'sec', + 'dsec' : 'sec', + 'decidegc' : 'degc', }, 3:{ //UK 'cm' : 'ft', + 'm' : 'ft', + 'm-lrg' : 'mi', 'cms' : 'mph', - 'cdeg' : 'deg', - 'ms' : 'sec' + 'v-cms' : 'fts', + 'decideg' : 'deg', + 'msec' : 'sec', + 'dsec' : 'sec', + 'decidegc' : 'degc', }, 4: { //General aviation 'cm' : 'ft', + 'm' : 'ft', + 'm-lrg' : 'nm', 'cms': 'kt', - 'cdeg' : 'deg', - 'ms' : 'sec' + 'v-cms' : 'hftmin', + 'decideg' : 'deg', + 'msec' : 'sec', + 'dsec' : 'sec', + 'decidegc' : 'degc', }, default:{}//show base units }; @@ -249,18 +316,31 @@ var Settings = (function () { // Update the step, min, and max; as we have the multiplier here. if (element.attr('type') == 'number') { element.attr('step', ((multiplier != 1) ? '0.01' : '1')); - element.attr('min', (element.attr('min') / multiplier).toFixed(2)); - element.attr('max', (element.attr('max') / multiplier).toFixed(2)); + if (multiplier != 'FAHREN') { + element.attr('min', (element.attr('min') / multiplier).toFixed(2)); + element.attr('max', (element.attr('max') / multiplier).toFixed(2)); + } } // Update the input with a new formatted unit - const convertedValue = Number((oldValue / multiplier).toFixed(2)); - const newValue = Number.isInteger(convertedValue) ? Math.round(convertedValue) : convertedValue; + let newValue = ""; + if (multiplier == 'FAHREN') { + element.attr('min', toFahrenheit(element.attr('min')).toFixed(2)); + element.attr('max', toFahrenheit(element.attr('max')).toFixed(2)); + newValue = toFahrenheit(oldValue).toFixed(2); + } else { + const convertedValue = Number((oldValue / multiplier).toFixed(2)); + newValue = Number.isInteger(convertedValue) ? Math.round(convertedValue) : convertedValue; + } element.val(newValue); element.data('setting-multiplier', multiplier); // Now wrap the input in a display that shows the unit element.wrap(`
`); + + function toFahrenheit(decidegC) { + return (decidegC / 10) * 1.8 + 32; + }; } self.saveInput = function(input) { @@ -281,8 +361,13 @@ var Settings = (function () { } else if(setting.type == 'string') { value = input.val(); } else { - var multiplier = parseFloat(input.data('setting-multiplier') || 1); - value = parseFloat(input.val()) * multiplier; + var multiplier = input.data('setting-multiplier') || 1; + if (multiplier == 'FAHREN') { + value = Math.round(((parseFloat(input.val())-32) / 1.8) * 10); + } else { + multiplier = parseFloat(multiplier); + value = Math.round(parseFloat(input.val()) * multiplier); + } } return mspHelper.setSetting(settingName, value); }; diff --git a/main.css b/main.css index ff15d7c8..704f7fe6 100644 --- a/main.css +++ b/main.css @@ -2221,11 +2221,19 @@ ol li { position: relative; } +.unit_wrapper input { + margin-right: 0 !important; +} + +.unit_wrapper ~ label, select ~ label, input ~ label { + margin-left: 10px; +} + /* Position the unit to the right of the wrapper */ .unit_wrapper::after { position: absolute; top: 2px; - right: .7em; + right: .5em; transition: all .05s ease-in-out; } @@ -2233,13 +2241,13 @@ ol li { for arrow buttons will appear to the right of number inputs */ .unit_wrapper:hover::after, .unit_wrapper:focus-within::after { - right: 1.3em; + right: 1.0em; } /* Handle Firefox (arrows always shown) */ @supports (-moz-appearance:none) { .unit_wrapper::after { - right: 1.3em; + right: 1.0em; } } diff --git a/src/css/tabs/configuration.css b/src/css/tabs/configuration.css index 9ef596ba..57e58712 100644 --- a/src/css/tabs/configuration.css +++ b/src/css/tabs/configuration.css @@ -28,12 +28,12 @@ text-align: left; border: 1px solid silver; border-radius: 3px; - margin-right: 11px; font-size: 12px; font-weight: normal; } .config-section .number input, +.config-section .checkbox input, .tab-configuration .number input { width: 106px; } @@ -221,7 +221,7 @@ hr { .config-section label { position: absolute; - left: 118px; + left: 108px; } .config-section .radio label { diff --git a/src/css/tabs/failsafe.css b/src/css/tabs/failsafe.css index ea96ec14..cd0e83ce 100644 --- a/src/css/tabs/failsafe.css +++ b/src/css/tabs/failsafe.css @@ -26,7 +26,6 @@ text-align: left; border: 1px solid silver; border-radius: 3px; - margin-right: 11px; font-size: 12px; font-weight: normal; } @@ -253,10 +252,12 @@ height: 90px; } -.tab-failsafe .minimumDistance { - width: 100px !important; - padding-left: 3px; - margin-right: 11px; +.tab-failsafe input { + width: 75px !important; +} + +.tab-failsafe select { + width: 79px; } @media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) { diff --git a/src/css/tabs/firmware_flasher.css b/src/css/tabs/firmware_flasher.css index a9d6c98c..ec488163 100644 --- a/src/css/tabs/firmware_flasher.css +++ b/src/css/tabs/firmware_flasher.css @@ -271,7 +271,6 @@ text-align: left; border: 1px solid silver; border-radius: 3px; - margin-right: 11px; margin-bottom: 5px; font-size: 12px; font-weight: normal; diff --git a/src/css/tabs/osd.css b/src/css/tabs/osd.css index 225b4fb2..ff80f79a 100644 --- a/src/css/tabs/osd.css +++ b/src/css/tabs/osd.css @@ -477,21 +477,19 @@ button { } .tab-osd .settings input { - width: 55px; + width: 75px; padding-left: 3px; height: 18px; line-height: 20px; text-align: left; border: 1px solid silver; border-radius: 3px; - margin-right: 11px; font-size: 11px; font-weight: normal; } .tab-osd .settings select { width: 75px; - margin-right: 11px; } .tab-osd .settings .switchery { diff --git a/src/css/tabs/pid_tuning.css b/src/css/tabs/pid_tuning.css index 5674006a..98e9c937 100644 --- a/src/css/tabs/pid_tuning.css +++ b/src/css/tabs/pid_tuning.css @@ -302,7 +302,6 @@ text-align: left; border: 1px solid silver; border-radius: 3px; - margin-right: 11px; font-weight: normal; } diff --git a/src/css/tabs/transponder.css b/src/css/tabs/transponder.css index 764c6874..b4e7381c 100644 --- a/src/css/tabs/transponder.css +++ b/src/css/tabs/transponder.css @@ -12,7 +12,6 @@ text-align: left; border: 1px solid silver; border-radius: 3px; - margin-right: 11px; font-size: 12px; font-weight: normal; } diff --git a/tabs/advanced_tuning.html b/tabs/advanced_tuning.html index c6cd47f2..bc5ab18e 100644 --- a/tabs/advanced_tuning.html +++ b/tabs/advanced_tuning.html @@ -149,7 +149,7 @@