mendhak/gpslogger

Timer does not reset when switching profiles

Closed this issue · 7 comments

Hi,

I've noticed a change of behavior after upgrading to v119 recently.
Before, after a change to a different profile, the app would instantly try to get a GPS fix and then either save that or discard it based on distance, etc.
Starting with v119 however, it seems like it only does so after waiting until the time_before_logging of the previously used profile has passed.

In case of the attached logfile, I've generated a point with a profile that has a 30 minute interval between measurements and then switched to a profile that measures every 60 seconds. That second profile then didn't try to query GPS until the 30 minutes were up.
debuglog.txt

When changing profile it's necessary to stop and start logging again otherwise the 'alarm' duration is still 'time_before_logging' from the previous profile.

I've tested to make sure on some older versions and it was still the same behavior. In case you are automating this profile switch then you probably need to also send stop and start commands too

I did a few more tests because what you're describing doesn't match with what I've experienced up to v118. I use Tasker to toggle between different profiles, but I've never sent start commands, only switchprofile. If possible I'd like to avoid having to stop and restart recording, as that would skip the distance check to the last recorded point and result in "duplicate" points almost every time I switch profiles.

I've now tested both v118 and v120 both with Tasker and when switching profiles manually in GPSLogger.

With GPSLogger v118:
Switching profiles with Tasker: GPSLogger instantly tries to record a point after switching profiles (debuglog_tasker_118.txt)
Switching profiles manually: The timer doesn't reset and GPSLogger only tries to record a point once that time is up (debuglog_manual_118.txt)

With GPSLogger v120:
Switching profiles with Tasker: The timer doesn't reset and GPSLogger only tries to record a point once that time is up (debuglog_tasker_120.txt)
Switching profiles manually: The timer doesn't reset and GPSLogger only tries to record a point once that time is up (debuglog_manual_120.txt)

These were all recorded before I realized that I was still using the old Tasker commands (before September 2018) and not the ones that are currently on the FAQ page. I tried v120 with the current ones though and it didn't change the behavior.

Thanks to your troubleshooting I can see what you're running into. I just tried it myself, with Llama Automate, and I see the behavior. I didn't test switching profile via Tasker last time, only tested it manually, so it's been consistent for me.

I think what you've encountered is an unintentional behavior, despite it working for you for a long time, it was never designed to work like that.

I've been combing through a comparison of v118 and v120 to see what might have changed. I'll try my best right now to find if there's a simple obvious tweak somewhere that caused it but I can't guarantee I'll find it or if it'll continue working this way in the future.

Thanks to the power of git bisect I have found the commit which caused it. f93cb74

I need to investigate this a bit, thanks to the power of my useless git commit message I don't know why I introduced this change ahahahah 🤡

This might have been simpler than I thought (unfortunately realized after a lot of debugging but getting nowhere). On switching profile I'm just issuing a 'startLogging' again, if the session has already started.

I've got an APK here if you want to test.
https://github.com/mendhak/gpslogger/releases/tag/v121-rc1

I tested by killing GPSLogger and starting it again - logging resumed. That was the main aim of the change.
I then tested, while running, I got Llama to switch profiles, and it kicked off the logging again.

I can confirm that my Tasker setup works again with that APK. Thanks a lot. 👍

v121 is now in F-Droid and the releases.