Yes, with the first 3 includes uncommented, the build log (for an UNO, v1.0.5 IDE) says:
Estimated used SRAM memory: 2,323 bytes (of a 2048 byte maximum)
Too big! If I use the F macro for all the double-quoted strings in the print statements, it says
Estimated used SRAM memory: 2,187 bytes (of a 2048 byte maximum)
That saved 136 bytes of RAM. If I use NeoGPS and NeoSWSerial (see below), it says
Estimated used SRAM memory: 1,723 bytes (of a 2048 byte maximum)
That saved 464 more bytes of RAM (a total of 600). So, it can fit. It's a little tight, but it should work. Disabling fix pieces you don't use in GPSfix_cfg.h could save a little more.
Cheers,
/dev
Your sketch modified to use NeoGPS:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <NeoSWSerial.h>
NeoSWSerial gps_port(7, 6);
#include "NMEAGPS.h"
static NMEAGPS gps; // This parses the GPS characters
// If using software SPI (the default case):
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
/* Uncomment this block to use hardware SPI
#define OLED_DC 6
#define OLED_CS 7
#define OLED_RESET 8
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
*/
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
uint32_t timer;
void setup(){
// Trying to send data to the screen **********************
display.begin(SSD1306_SWITCHCAPVCC);
display.display();
delay(0);
display.clearDisplay();
// text display tests
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println();
delay(0);
display.clearDisplay();
// *******************************************************
// connect at 115200 so we can read the GPS fast enough and echo without dropping chars
Serial.begin(115200);
Serial.println( F("NeoGPS library test!") );
gps_port.begin(9600);
// request RMC and GGA only
gps.send_P( &gps_port, (const prog_char *) F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") );
timer = millis();
}
void loop() // run over and over again
{
while (gps_port.available()) {
if (gps.decode( gps_port.read() ) == NMEAGPS::DECODE_COMPLETED) {
if (gps.nmeaMessage == NMEAGPS::NMEA_GGA) {
// If your device emits a GGA then an RMC each second,
// change the above GGA to RMC. Or if you don't get all
// the attributes (e.g., alt, heading, speed and satellites)
// try changing the above test. NMEAorder.ino can be
// used to determine which one is last (should be used above).
// BTW, this is the safest place to do any time-consuming work,
// like updating the display. Doing it elsewhere will cause GPS
// characters to be lost, and some fix data won't be available/valid.
// And if you take too long here, you could still lose characters.
const gps_fix & fix = gps.fix();
Serial.print( F("\nTime: ") );
if (fix.valid.time) {
Serial.print(fix.dateTime.hours-4, DEC); Serial.print(':');
Serial.print(fix.dateTime.minutes, DEC);
}
Serial.print( F("\nDate: ") );
if (fix.valid.date) {
Serial.print(fix.dateTime.month, DEC); Serial.print('/');
Serial.print(fix.dateTime.date, DEC); Serial.print('/');
Serial.print(fix.dateTime.full_year(), DEC);
}
Serial.print( F("\nFix: ") );
Serial.print( fix.status );
Serial.print( F(" quality: ") );
if (fix.valid.hdop)
Serial.print( fix.hdop/1000 );
Serial.print( F("\nLAT/LON (in degrees): ") );
if (fix.valid.location) {
Serial.print(fix.latitude(), 4);
Serial.print( F(", ") );
Serial.print(fix.longitude(), 4);
}
Serial.print( F("\nMPH: ") );
if (fix.valid.speed) {
// convert integer (nautical miles/hr * 1000) to
// integer (miles/hr) and integer (miles/hr * 1000)
uint32_t mph_E6 = fix.speed_mkn() * 1151UL;
uint16_t mph = (mph_E6 / 1000000UL);
uint16_t mph_frac = (mph_E6 - mph*1000000UL)/1000U;
// Print integer mph and mph_frac so it looks like a floating-point number
Serial.print( mph );
Serial.print( '.' );
if (mph_frac < 100)
Serial.print( '0' );
if (mph_frac < 10)
Serial.print( '0' );
Serial.print( mph_frac );
}
Serial.print( F("\nHeading: ") );
if (fix.valid.heading)
Serial.print( fix.heading_cd()/100 );
Serial.print( F("\nAltitude: ") );
if (fix.valid.altitude)
Serial.print( fix.altitude_cm()/100 );
Serial.print( F("\nSatellites: ") );
if (fix.valid.satellites)
Serial.print( fix.satellites );
Serial.println();
timer = millis(); // reset the timer
}
}
}
// Until we get sentences, print a dot every 2 seconds or so
if (millis() - timer > 2000) {
timer = millis(); // reset the timer
Serial.print( '.' );
}
}
Also, I had to uncomment this line in NMEA_cfg.h:
#define NMEAGPS_ACCUMULATE_FIX
That allows NeoGPS to merge the GGA and the RMC sentence fields together, avoiding the need for a second copy of the GPS fix structure.