Serial.print("Memory used: "); Serial.println(2048 - freeMemory());This is executed after a sentence is decoded, so I'm not sure what it's measuring. And it turns out that string literals use RAM. For a pleasant surprise, I would suggest replacing all the string literals with F("string literal"), at least the ones that are printed. Boy, this is a topic in itself.
It really gets down to whether you need the information from the device, or just the bytes. If you are comparing values or calculating a distance, you need the numbers. This is the NeoGPS et al niche.If you are just logging or displaying the bytes, perhaps in a different order, you only need... bytes. A much simpler problem.
> ...by calling the parse function from the ISR...Hey! That's exactly the async mode I mentioned in the README. I usually work in the Cosa environment, and it's very easy to hook `decode` to the ISR. You have to be careful because the fix data is volatile when it's populated by an ISR.
> ...with interrupts re-enabled. You sir, are a square peg.
Well, I certainly appreciate your taking the time to check it out and offer some feedback.
After ditching the library, I'm getting the same numbers.
(Serial << F("dt = ")) << gps.fix().dateTime << '\n'; // outputs PROGMEM "dt = ", which (Serial) << gps.fix().dateTime << '\n'; // returns Serial. Now we have Serial << gps.fix().dateTime << '\n'; // Evaluate again... (Serial << gps.fix().dateTime) << '\n'; // outputs formatted dateTime, which (Serial) << '\n'; // returns Serial. Next we have Serial << '\n'; // which outputs the newline (Serial); // returns Serial. Return value not used.
Expecting GPS-aware applications to keep track of all this stuff would be just nuts. The best way to cope is to have a dedicated service layer that specializes in knowing about GPS idiosyncracies, hides all that ugliness, and presents a simple Time-Position-Velocity-reporting interface (TPV) to the application layer above.
I just came across an interesting post about the awful state of the NMEA "standard"... from five years ago! It's called Why GPSes suck, and what to do about it.