diff options
-rw-r--r-- | modern/src/common/components/PositionValue.jsx | 3 | ||||
-rw-r--r-- | modern/src/common/util/converter.js | 14 | ||||
-rw-r--r-- | modern/src/common/util/formatter.js | 11 |
3 files changed, 2 insertions, 26 deletions
diff --git a/modern/src/common/components/PositionValue.jsx b/modern/src/common/components/PositionValue.jsx index 9c49b7e7..58841939 100644 --- a/modern/src/common/components/PositionValue.jsx +++ b/modern/src/common/components/PositionValue.jsx @@ -53,9 +53,8 @@ const PositionValue = ({ position, property, attribute }) => { case 'longitude': return formatCoordinate('longitude', value, coordinateFormat); case 'speed': - return value != null ? formatSpeed(value, speedUnit, t) : ''; case 'obdSpeed': - return value != null ? formatSpeed(value, speedUnit, t, 'kmh') : ''; + return value != null ? formatSpeed(value, speedUnit, t) : ''; case 'course': return formatCourse(value); case 'altitude': diff --git a/modern/src/common/util/converter.js b/modern/src/common/util/converter.js index 6890763b..cb21566b 100644 --- a/modern/src/common/util/converter.js +++ b/modern/src/common/util/converter.js @@ -10,18 +10,6 @@ const speedConverter = (unit) => { } }; -const speedConverterKph = (unit) => { - switch (unit) { - case 'kmh': - return 1; - case 'mph': - return 0.62137; - case 'kn': - default: - return 0.539957; - } -}; - export const speedUnitString = (unit, t) => { switch (unit) { case 'kmh': @@ -36,8 +24,6 @@ export const speedUnitString = (unit, t) => { export const speedFromKnots = (value, unit) => value * speedConverter(unit); -export const speedFromKph = (value, unit) => value * speedConverterKph(unit); - export const speedToKnots = (value, unit) => value / speedConverter(unit); const distanceConverter = (unit) => { diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js index 332cb07e..aeacc145 100644 --- a/modern/src/common/util/formatter.js +++ b/modern/src/common/util/formatter.js @@ -8,7 +8,6 @@ import { distanceFromMeters, distanceUnitString, speedFromKnots, - speedFromKph, speedUnitString, volumeFromLiters, volumeUnitString, @@ -63,15 +62,7 @@ export const formatDistance = (value, unit, t) => `${distanceFromMeters(value, u export const formatAltitude = (value, unit, t) => `${altitudeFromMeters(value, unit).toFixed(2)} ${altitudeUnitString(unit, t)}`; -export const formatSpeed = (value, unit, t, convertFrom='kn') => { - switch (convertFrom){ - case 'kmh': - return `${speedFromKph(value, unit).toFixed(2)} ${speedUnitString(unit, t)}`; - case 'kn': - default: - return `${speedFromKnots(value, unit).toFixed(2)} ${speedUnitString(unit, t)}`; - } -}; +export const formatSpeed = (value, unit, t) => `${speedFromKnots(value, unit).toFixed(2)} ${speedUnitString(unit, t)}`; export const formatVolume = (value, unit, t) => `${volumeFromLiters(value, unit).toFixed(2)} ${volumeUnitString(unit, t)}`; |