Fix #29 by adjusting interrupt code's serial handling.
This commit is contained in:
parent
91295fa8e2
commit
deef2c00ff
|
|
@ -140,18 +140,14 @@ void setup() {
|
||||||
|
|
||||||
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
|
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
|
||||||
SIGNAL(TIMER0_COMPA_vect) {
|
SIGNAL(TIMER0_COMPA_vect) {
|
||||||
char c;
|
char c = GPS.read();
|
||||||
while (mySerial.available())
|
// if you want to debug, this is a good time to do it!
|
||||||
{
|
#ifdef UDR0
|
||||||
c = GPS.read();
|
if (GPSECHO)
|
||||||
// if you want to debug, this is a good time to do it!
|
if (c) UDR0 = c;
|
||||||
#ifdef UDR0
|
// writing direct to UDR0 is much much faster than Serial.print
|
||||||
if (GPSECHO)
|
// but only one character can be written at a time.
|
||||||
if (c) UDR0 = c;
|
#endif
|
||||||
// writing direct to UDR0 is much much faster than Serial.print
|
|
||||||
// but only one character can be written at a time.
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void useInterrupt(boolean v) {
|
void useInterrupt(boolean v) {
|
||||||
|
|
@ -170,12 +166,12 @@ void useInterrupt(boolean v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
char c;
|
if (! usingInterrupt) {
|
||||||
while (mySerial.available())
|
// read data from the GPS in the 'main loop'
|
||||||
{
|
char c = GPS.read();
|
||||||
c = GPS.read();
|
// if you want to debug, this is a good time to do it!
|
||||||
if (GPSECHO)
|
if (GPSECHO)
|
||||||
if (c) Serial.print(c);
|
if (c) Serial.print(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a sentence is received, we can check the checksum, parse it...
|
// if a sentence is received, we can check the checksum, parse it...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue