1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Update gps.c

This commit is contained in:
Ferdia McKeogh 2016-02-16 17:28:13 +00:00
parent 66f7e52fad
commit df2ba31c1d

View file

@ -1058,6 +1058,18 @@ static bool gpsNewFrameUBLOX(uint8_t data)
return parsed; return parsed;
} }
static void gpsHandlePassthrough(uint8_t data)
{
gpsNewData(data);
#ifdef DISPLAY
if (feature(FEATURE_DISPLAY)) {
updateDisplay();
}
#endif
}
void gpsEnablePassthrough(serialPort_t *gpsPassthroughPort) void gpsEnablePassthrough(serialPort_t *gpsPassthroughPort)
{ {
waitForSerialPortToFinishTransmitting(gpsPort); waitForSerialPortToFinishTransmitting(gpsPort);
@ -1066,34 +1078,13 @@ void gpsEnablePassthrough(serialPort_t *gpsPassthroughPort)
if(!(gpsPort->mode & MODE_TX)) if(!(gpsPort->mode & MODE_TX))
serialSetMode(gpsPort, gpsPort->mode | MODE_TX); serialSetMode(gpsPort, gpsPort->mode | MODE_TX);
LED0_OFF;
LED1_OFF;
#ifdef DISPLAY #ifdef DISPLAY
if (feature(FEATURE_DISPLAY)) { if (feature(FEATURE_DISPLAY)) {
displayShowFixedPage(PAGE_GPS); displayShowFixedPage(PAGE_GPS);
} }
#endif #endif
char c;
while(1) { serialPassthrough(gpsPort, gpsPassthroughPort, &gpsHandlePassthrough, NULL);
if (serialRxBytesWaiting(gpsPort)) {
LED0_ON;
c = serialRead(gpsPort);
gpsNewData(c);
serialWrite(gpsPassthroughPort, c);
LED0_OFF;
}
if (serialRxBytesWaiting(gpsPassthroughPort)) {
LED1_ON;
serialWrite(gpsPort, serialRead(gpsPassthroughPort));
LED1_OFF;
}
#ifdef DISPLAY
if (feature(FEATURE_DISPLAY)) {
updateDisplay();
}
#endif
}
} }
void updateGpsIndicator(uint32_t currentTime) void updateGpsIndicator(uint32_t currentTime)