diff --git a/package.json b/package.json index 014c86f9..804d6932 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ }, "scripts": { "lint": "npm run lint:eslint && npm run lint:prettier", - "lint:eslint": "npx eslint src lib servers --ext .js,.vue --fix", - "lint:prettier": "npx prettier --config .prettierrc src/**/*.{js,vue} lib/**/*.js servers/**/*.js --write", + "lint:eslint": "npx eslint src lib servers test --ext .js,.vue --fix", + "lint:prettier": "npx prettier --config .prettierrc src/**/*.{js,vue} lib/**/*.js servers/**/*.js test/**/*.js --write", "test": "npm run test:unit", "test:unit": "npx jest", "test:coverage": "npx jest --coverage", diff --git a/src/components/dashboards/scania/ScaniaDashboard.vue b/src/components/dashboards/scania/ScaniaDashboard.vue index 2146aa6a..278021cc 100644 --- a/src/components/dashboards/scania/ScaniaDashboard.vue +++ b/src/components/dashboards/scania/ScaniaDashboard.vue @@ -2,10 +2,8 @@
{{ - $truckShifterTypeLetter( - telemetry.truck.transmission, - telemetry.truck.brand - ) + $truckShifterTypeLetter(telemetry.truck.transmission) }}
diff --git a/src/components/dashboards/scania/symbols/ScaniaIndicatorSymbols.vue b/src/components/dashboards/scania/symbols/ScaniaIndicatorSymbols.vue index c16b4074..55b708d0 100644 --- a/src/components/dashboards/scania/symbols/ScaniaIndicatorSymbols.vue +++ b/src/components/dashboards/scania/symbols/ScaniaIndicatorSymbols.vue @@ -2,13 +2,13 @@
@@ -44,7 +44,7 @@
diff --git a/src/components/dashboards/shared/Cadran.vue b/src/components/dashboards/shared/Cadran.vue index f9ac9263..291e3221 100644 --- a/src/components/dashboards/shared/Cadran.vue +++ b/src/components/dashboards/shared/Cadran.vue @@ -41,16 +41,12 @@ export default { }, methods: { angle() { - const minValue = this.min; - const maxValue = this.max; - const minAngle = this.minAngle; - const maxAngle = this.maxAngle; let value = this.value; - value = Math.min(value, maxValue); - value = Math.max(value, minValue); - const offset = (value - minValue) / (maxValue - minValue); + value = Math.min(value, this.max); + value = Math.max(value, this.min); + const offset = (value - this.min) / (this.max - this.min); - return (maxAngle - minAngle) * offset + minAngle; + return (this.maxAngle - this.minAngle) * offset + this.minAngle; } } }; diff --git a/src/mixins/TelemetryMixin.vue b/src/mixins/TelemetryMixin.vue index ecaa5e4c..db1d97ee 100644 --- a/src/mixins/TelemetryMixin.vue +++ b/src/mixins/TelemetryMixin.vue @@ -1,6 +1,6 @@ diff --git a/src/utils/telemetry/_common.utils.js b/src/utils/telemetry/_common.utils.js index c1bef308..f1d96642 100644 --- a/src/utils/telemetry/_common.utils.js +++ b/src/utils/telemetry/_common.utils.js @@ -32,17 +32,25 @@ export const $scale = (currentSkin) => { export const $hasWarnings = () => { return ( - telemetryStore.telemetry.truck.brakes.airPressure.warning.enabled || - telemetryStore.telemetry.truck.fuel.warning.enabled || - telemetryStore.telemetry.truck.adBlue.warning.enabled || - telemetryStore.telemetry.truck.engine.oilPressure.warning.enabled || - telemetryStore.telemetry.truck.engine.waterTemperature.warning.enabled || - telemetryStore.telemetry.truck.engine.batteryVoltage.warning.enabled + (telemetryStore.telemetry.truck.brakes.airPressure.warning.enabled || + telemetryStore.telemetry.truck.fuel.warning.enabled || + telemetryStore.telemetry.truck.adBlue.warning.enabled || + telemetryStore.telemetry.truck.engine.oilPressure.warning.enabled || + telemetryStore.telemetry.truck.engine.waterTemperature.warning.enabled || + telemetryStore.telemetry.truck.engine.batteryVoltage.warning.enabled) && + telemetryStore.telemetry.truck.electric.enabled ); }; export const $hasErrors = () => { - return telemetryStore.telemetry.truck.brakes.airPressure.emergency.enabled; + return ( + telemetryStore.telemetry.truck.brakes.airPressure.emergency.enabled && + telemetryStore.telemetry.truck.electric.enabled + ); +}; + +export const $hasEngineWarning = () => { + return telemetryStore.telemetry.truck.engine.damage >= 0.5; // >= 50% }; export const $dateTimeLocalized = (time, dFormat, tFormat) => { diff --git a/src/utils/telemetry/_grear.utils.js b/src/utils/telemetry/_grear.utils.js index 05fc33b7..932eef12 100644 --- a/src/utils/telemetry/_grear.utils.js +++ b/src/utils/telemetry/_grear.utils.js @@ -31,39 +31,27 @@ export const $trukGear = (transmission, brand, withShifterType = true) => { strGear = gear - crawlingGear; } - if (withShifterType) { - if ( - transmission.shifterType === 'automatic' || - transmission.shifterType === 'arcade' - ) - strGear = 'A' + (gear - crawlingGear); + if ( + (transmission.shifterType === 'automatic' || + transmission.shifterType === 'arcade') && + withShifterType + ) + strGear = 'A' + (gear - crawlingGear); - if (gear <= crawlingGear) strGear = 'C' + Math.abs(gear); + if (gear <= crawlingGear) strGear = 'C' + Math.abs(gear); - if (gear === 0) strGear = 'N'; + if (gear === 0) strGear = 'N'; - if (gear < 0) strGear = 'R' + Math.abs(transmission.gear.displayed); - } + if (gear < 0) strGear = 'R' + Math.abs(transmission.gear.displayed); return strGear; }; -export const $truckShifterTypeLetter = (transmission, brand) => { - const gear = $gearInfo(transmission, brand).gear; - const crawlingGear = $gearInfo(transmission, brand).crawlingGear; - let shifterType = 'D'; - +export const $truckShifterTypeLetter = (transmission) => { if ( transmission.shifterType === 'automatic' || transmission.shifterType === 'arcade' ) - shifterType = 'A'; - - if (gear <= crawlingGear) shifterType = 'C'; - - if (gear === 0) shifterType = 'N'; - - if (gear < 0) shifterType = 'R'; - - return shifterType; + return 'A'; + else return 'M'; }; diff --git a/src/utils/telemetry/_helper.utils.js b/src/utils/telemetry/_helper.utils.js index f3217f8d..2126cb2e 100644 --- a/src/utils/telemetry/_helper.utils.js +++ b/src/utils/telemetry/_helper.utils.js @@ -2,6 +2,6 @@ import { store as telemetryStore } from '@/store/telemetry.store'; export const $gameTime = () => telemetryStore.telemetry.game.time.unix; -export const $truckElectricOn = () => { - return telemetryStore.telemetry.truck.electric.enabled; -}; +//export const $truckElectricOn = () => { +// return telemetryStore.telemetry.truck.electric.enabled; +//}; diff --git a/src/utils/telemetry/_navigation.utils.js b/src/utils/telemetry/_navigation.utils.js index 68de2618..c1368d22 100644 --- a/src/utils/telemetry/_navigation.utils.js +++ b/src/utils/telemetry/_navigation.utils.js @@ -1,6 +1,6 @@ import { store as telemetryStore } from '@/store/telemetry.store'; import { diffDateTimeLocalized } from '@/utils/_app'; -import { $gameTime } from '@/utils/telemetry/_common.utils'; +import { $gameTime } from '@/utils/telemetry/_helper.utils'; export const $etaDueDate = () => { const currentGameTime = $gameTime();