GPS Code refactoring?

I’ve been putting time into the GPS code. I note that there is a lot of code that will never be used if the user does not have a specific type of GPS. I use an NMEA U980 GPX, so there is a good chunk of space wasted with the UBLOX protocol. I would like to separate this out so the user can select only the GPS they have/need. Is there any interest in patches to slim things down in a more granular fashion than simply defining the constrained flash option?

You can disable other protocols at build time, but personally I’d like to split the “gps” driver into separate dedicated drivers for ublox, nmea, etc.

1 Like

This is a quick solution.

Dagar provides quick solution.

I did not see the switches to disable the other items at build time.

Most of the classes come from GPSHelper, but it has a lot of device-specific parts dealing with very specific implementations.

The underlying concept is really time/location. Would it be better to focus on a uniform interface that provides only that? Otherwise, the GPS code is peppered with interdependencies specific to different supported GPS hardware. I’d love to feed test code with some logged GPS messages, but right now, there are so many hooks backwards that I see no easy way to just compile and test a message parser.

Any ideas?

At the moment it’s a single define, if CONSTRAINED_FLASH then we disable everything everything except ublox.

I’m suggesting we expand that to be kconfig flags per protocol.

The longer term idea about splitting into dedicated drivers per protocol is really about making it as simple as possible to implement an uncompromising solution. The core of what each type of GNSS receiver does is obviously pretty similar, but each case has various extras or special config that doesn’t fit cleanly. Rather than fighting for better abstractions or a lowest common denominator I think we simply need to accept it and stop making things harder than they need to be.

Ok, we are looking at the same thing then. I have submitted a PR for the latest batch of bugfixes I did on the NMEA parser.

I flew the patched code around a little today and it’s nice to have GPS-aided hover even if it swirls around like it is going down a toilet. I will work on optimizing the parser, then see what I can do to make each module selectable.

Any ideas why there is a separate GNSS driver?