mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 11:29:53 +03:00
Continue to implement feature
- Tidied up units label to work with more tabs - Added more fields in the PID Tuning to use the highlighting - Converted the Rates tab over to use data-i18n more. Will make sure all of the PIDs pages use it fully.
This commit is contained in:
parent
e7c7f2d342
commit
15282d8994
5 changed files with 83 additions and 27 deletions
|
@ -162,6 +162,10 @@ var Settings = (function () {
|
|||
// Angles
|
||||
'deg' : '°',
|
||||
'decideg' : 'deci°',
|
||||
'decideg-lrg' : 'deci°', // Decidegrees, but always converted to degrees by default
|
||||
// Rotational speed
|
||||
'degps' : '° per second',
|
||||
'decadegps' : 'deca° per second',
|
||||
// Temperature
|
||||
'decidegc' : 'deci°C',
|
||||
'degc' : '°C',
|
||||
|
@ -229,6 +233,12 @@ var Settings = (function () {
|
|||
'decideg' : {
|
||||
'deg' : 10
|
||||
},
|
||||
'decideg-lrg' : {
|
||||
'deg' : 10
|
||||
},
|
||||
'decadegps' : {
|
||||
'degps' : 0.1
|
||||
},
|
||||
'decidegc' : {
|
||||
'degc' : 10,
|
||||
'degf' : 'FAHREN'
|
||||
|
@ -245,7 +255,9 @@ var Settings = (function () {
|
|||
'v-cms' : 'fts',
|
||||
'msec' : 'sec',
|
||||
'dsec' : 'sec',
|
||||
'decadegps' : 'degps',
|
||||
'decideg' : 'deg',
|
||||
'decideg-lrg' : 'deg',
|
||||
'decidegc' : 'degf',
|
||||
},
|
||||
1: { //metric
|
||||
|
@ -256,7 +268,9 @@ var Settings = (function () {
|
|||
'v-cms' : 'ms',
|
||||
'msec' : 'sec',
|
||||
'dsec' : 'sec',
|
||||
'decadegps' : 'degps',
|
||||
'decideg' : 'deg',
|
||||
'decideg-lrg' : 'deg',
|
||||
'decidegc' : 'degc',
|
||||
},
|
||||
2: { //metric with MPH
|
||||
|
@ -265,7 +279,9 @@ var Settings = (function () {
|
|||
'm-lrg' : 'km',
|
||||
'cms' : 'mph',
|
||||
'v-cms' : 'ms',
|
||||
'decadegps' : 'degps',
|
||||
'decideg' : 'deg',
|
||||
'decideg-lrg' : 'deg',
|
||||
'msec' : 'sec',
|
||||
'dsec' : 'sec',
|
||||
'decidegc' : 'degc',
|
||||
|
@ -276,7 +292,9 @@ var Settings = (function () {
|
|||
'm-lrg' : 'mi',
|
||||
'cms' : 'mph',
|
||||
'v-cms' : 'fts',
|
||||
'decadegps' : 'degpd',
|
||||
'decideg' : 'deg',
|
||||
'decideg-lrg' : 'deg',
|
||||
'msec' : 'sec',
|
||||
'dsec' : 'sec',
|
||||
'decidegc' : 'degc',
|
||||
|
@ -287,18 +305,25 @@ var Settings = (function () {
|
|||
'm-lrg' : 'nm',
|
||||
'cms': 'kt',
|
||||
'v-cms' : 'hftmin',
|
||||
'decadegps' : 'degps',
|
||||
'decideg' : 'deg',
|
||||
'decideg-lrg' : 'deg',
|
||||
'msec' : 'sec',
|
||||
'dsec' : 'sec',
|
||||
'decidegc' : 'degc',
|
||||
},
|
||||
default:{}//show base units
|
||||
default: { //show base units
|
||||
'decadegps' : 'degps',
|
||||
'decideg-lrg' : 'deg',
|
||||
}
|
||||
};
|
||||
|
||||
//this returns the factor in which to multiply to convert a unit
|
||||
const getUnitMultiplier = () => {
|
||||
if (conversionTable[uiUnitValue]){
|
||||
const fromUnits = conversionTable[uiUnitValue];
|
||||
let uiUnits = (uiUnitValue != -1) ? uiUnitValue : 'default';
|
||||
|
||||
if (conversionTable[uiUnits]){
|
||||
const fromUnits = conversionTable[uiUnits];
|
||||
if (fromUnits[inputUnit]){
|
||||
const multiplier = unitRatioTable[inputUnit][fromUnits[inputUnit]];
|
||||
return {'multiplier':multiplier, 'unitName':fromUnits[inputUnit]};
|
||||
|
@ -315,10 +340,16 @@ 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'));
|
||||
let decimalPlaces = 0;
|
||||
if (multiplier > 1) {
|
||||
element.attr('step', '0.01');
|
||||
decimalPlaces = 2;
|
||||
} else {
|
||||
element.attr('step', (multiplier < 1) ? (multiplier * 100).toFixed(0) : '1');
|
||||
}
|
||||
if (multiplier != 'FAHREN') {
|
||||
element.attr('min', (element.attr('min') / multiplier).toFixed(2));
|
||||
element.attr('max', (element.attr('max') / multiplier).toFixed(2));
|
||||
element.attr('min', (element.attr('min') / multiplier).toFixed(decimalPlaces));
|
||||
element.attr('max', (element.attr('max') / multiplier).toFixed(decimalPlaces));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue