dschablowsky / FordPassWidget

15 stars 6 forks source link

Incorrect Milage #7

Open parryg opened 3 years ago

parryg commented 3 years ago

Hi,

I've been using this since first release and have updated today but the mileage information is displaying incorrectly.

Please see screenshots showing what it should be and what the widget shows. Any ideas?

image

image

dschablowsky commented 3 years ago

Hi,

can you tell me the milage your ford app shows you? And additionally set debug = true and clearFileManagerOnNextRun = true. Run the script inside of scriptable and tell me please the milage in the console. It should be somewhere under vehicleStatus -> odometer -> value

dschablowsky commented 3 years ago

I´ve looked into it and it looks like the widget shows the km values (97km ~61mi). After changing uniteOfLength from km to mi everything is calculated correct at my side. Now it is important to know the data the widget fetches from the ford server and the milage that is shown in your FordPass App (see my previous comment).

What changes have to done to the script code?

parryg commented 3 years ago

Hi,

The Ford app currently shows 99mi on the odometer and 256mi until empty.

I've just checked on the console and it has 159mi on the odometer and 412mi until empty. Oddly enough it's already set to 'mi' on the code.

Only basic changes, nothing that should affect calculations or anything. I've changed to 'mi' in 2 places of the code.

parryg commented 3 years ago

I've just fixed it, it was this line below, I changed it back to km and now it correctly calculates the milage.

let lengthMultiplicator = uniteOfLength == 'km' ? 1 : 0.621371