woheller69 / gpscockpit

Android GPS dashboard and head-up display
GNU Affero General Public License v3.0
189 stars 10 forks source link

Statistiscs data (average values) are claculated and displayed only randomly #17

Closed Elmi77 closed 1 year ago

Elmi77 commented 1 year ago

Also when there is a GPS-fix, the statistics data (such as average speed, driven distance,...) are calculated and displayed only very rarely. I could not find out what causes this, for me it looks more or less random. When this error occurs, speed, latitude, longitude, compas and elapsed time are updated properly, but all other values are missing. It does not make a difference if I press the START-button or not.

Sorry for the poor quality of the image, it was made during driving in order to show the speed is working: https://i.ibb.co/grs8Y4c/IMG-20221109-130526-DRO-1.jpg

woheller69 commented 1 year ago

What is your Device, OS, OS version?

I recently noticed on one of my devices that it does not correctly handle configuration changes, like change in orientation or when dark mode is switched on / off.

Please try this version, this fixed the problem on my device and is currently in test.

app-release.apk.zip

Elmi77 commented 1 year ago

The device itself is a Android-based car-radio which does not change the orientation of the display. So the app started in landscape orientation from the very beginning - could this be a reason?

I'll check for the exact version and try the ZIP-file as soon as possible!

woheller69 commented 1 year ago

Can you switch the debug option on? This will show a counter which is increased with every new GPS location. Is it reset to zero, or does the counter stay at 0?

Elmi77 commented 1 year ago

The device runs on android 8.0.0

When turning the debug-option on, the counter stays at 0 (while speed, lat, lon and orientation are updated properly)

woheller69 commented 1 year ago

Counting should start when START button is pressed and the indicator on the button turns blue

woheller69 commented 1 year ago

Have you tried the zip?

Elmi77 commented 1 year ago

When I toggle the "Start"-button, the counter increases regularly. However, the other values are still not updated.

The ZIP-archive does not seem to make a difference, so for the last tests I already have been back at the version from F-Droid.

woheller69 commented 1 year ago

what is the accuracy the GPS achieves? Displayed at the right of the coordinates. Values are only calculated if accuracy is better than 15m.

Elmi77 commented 1 year ago

Unfortunately the 15-m-threshold isn't the reason too. Please refer to this picture: https://i.ibb.co/zRhNvmV/gpscockpit.png

Even below of this value nothing is calculated and no height is shown.

Edit: just to play around with this a bit, is there a way to edit the threshold at what calculating of these values starts?

woheller69 commented 1 year ago

Attached is a version with 45m min accuracy. Maybe that works, but it will probably count a lot of noise. Changes in distance are counted if they are larger than 2x GPS accuracy Changes in altitude are only counted if they are larger than 3x GPS accuracy

app-release.apk.zip

woheller69 commented 1 year ago

did it work?

Elmi77 commented 1 year ago

Sorry, have not tried it yet, hopefully I will find some time during next few days!

Elmi77 commented 1 year ago

Bad news: still the same, no matter if I press "Start" or not, no statistics data are collected.

What came into my mind: that car-radio has no network connection, neither via mobile network nor via Wifi - could this be a problem?

woheller69 commented 1 year ago

no

woheller69 commented 1 year ago

it seems your device does not provide altitude. At the top left current altitude should be shown.

And this is the reason. As long as there is no altitude values are being reset.

if (mOldGpsLocation==null || mNmeaOldAltitude==null) {  //if this is the first position only store it and reset travel distance
    if (mGpsLocation!=null) mOldGpsLocation = mGpsLocation;
    if (mNmeaAltitude!=null) mNmeaOldAltitude = mNmeaAltitude;
Elmi77 commented 1 year ago

The altitude is directly related to the statistics data in my case - the few times, everything worked correctly, even the altitude was shown. So, yes, it seems this could be a reason.

Elmi77 commented 1 year ago

OK, any updates that fix this issue?

woheller69 commented 1 year ago

an update of your bad GPS would fix it...

Elmi77 commented 1 year ago

I tried it with different devices and different GPS-apps meanhile: it seems, a 3D fix is not always guaranteed. Means all these apps provide a lat/lon position information quite regularly but not always the height. So as this happens with other devices too, I don't think this is a problem of the GPS of this specific device. On the other hand there is no such thing like a "GPS-update" for Android...

woheller69 commented 1 year ago

You can play with this version. For the purpose of measuring distance its sets altitude=0 regardless if there is a value or not. So it should not block anymore and at least count horizontal movement. But I doubt this will work great. If GPS reception is that bad that a 3D fix is not possible (which needs 4 satellites) horizontal accuracy will also be very limited. I cannot test that - have no device that does not get 3D fix... app-release.apk.zip

Elmi77 commented 1 year ago

Thanks, I'll try it and let you know! :-)

Elmi77 commented 1 year ago

The behaviour is inverted now: it works properly when there is no 3D fix, but in the rare cases when there is one, no statistics data are collected.

woheller69 commented 1 year ago

Collecting of distance and average speed should also work with 3D fix. Altitude will never be measured it is always assumed 0.

Elmi77 commented 1 year ago

OK, what I noticed is the following:

Altitude shows a value >0 (about 550 m in my case) -> collecting of data does not work, right as before

Altitude shows a value of 0 at some point -> collecting of data works properly

woheller69 commented 1 year ago

just tested it. Works well with 3D fix. Accuracy must be better than 15m to start counting