Fix #29 by adjusting interrupt code's serial handling.

This commit is contained in:
Tony DiCola 2014-08-07 11:45:27 -07:00
parent 91295fa8e2
commit deef2c00ff
1 changed files with 13 additions and 17 deletions

View File

@ -140,18 +140,14 @@ void setup() {
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
char c;
while (mySerial.available())
{
c = GPS.read();
char c = GPS.read();
// if you want to debug, this is a good time to do it!
#ifdef UDR0
#ifdef UDR0
if (GPSECHO)
if (c) UDR0 = c;
// writing direct to UDR0 is much much faster than Serial.print
// but only one character can be written at a time.
#endif
}
#endif
}
void useInterrupt(boolean v) {
@ -170,10 +166,10 @@ void useInterrupt(boolean v) {
}
void loop() {
char c;
while (mySerial.available())
{
c = GPS.read();
if (! usingInterrupt) {
// read data from the GPS in the 'main loop'
char c = GPS.read();
// if you want to debug, this is a good time to do it!
if (GPSECHO)
if (c) Serial.print(c);
}