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

logic and whitespace fixes in gps passthrough

This commit is contained in:
dongie 2013-11-02 22:51:56 +09:00
parent 05a61e9cda
commit bff260c7c6
2 changed files with 6 additions and 8 deletions

View file

@ -669,11 +669,10 @@ static void cliFeature(char *cmdline)
static void cliGpsPassthrough(char *cmdline) static void cliGpsPassthrough(char *cmdline)
{ {
cliPrint("Enabling GPS passthrough..."); if (gpsSetPassthrough() == -1)
if (gpsSetPassthrough() == -1) {
cliPrint("Error: Enable and plug in GPS first\r\n"); cliPrint("Error: Enable and plug in GPS first\r\n");
} else
cliPrint("Enabling GPS passthrough...\r\n");
} }
static void cliHelp(char *cmdline) static void cliHelp(char *cmdline)

View file

@ -542,7 +542,7 @@ int8_t gpsSetPassthrough(void)
if (gpsData.state != GPS_RECEIVINGDATA) if (gpsData.state != GPS_RECEIVINGDATA)
return -1; return -1;
// get rid of callback // get rid of callback
core.gpsport->callback = NULL; core.gpsport->callback = NULL;
LED0_OFF; LED0_OFF;
@ -553,16 +553,15 @@ int8_t gpsSetPassthrough(void)
LED0_ON; LED0_ON;
serialWrite(core.mainport, serialRead(core.gpsport)); serialWrite(core.mainport, serialRead(core.gpsport));
LED0_OFF; LED0_OFF;
} }
if (serialTotalBytesWaiting(core.mainport)) { if (serialTotalBytesWaiting(core.mainport)) {
LED1_ON; LED1_ON;
serialWrite(core.gpsport, serialRead(core.mainport)); serialWrite(core.gpsport, serialRead(core.mainport));
LED1_OFF; LED1_OFF;
}
} }
}
} }
// OK here is the onboard GPS code // OK here is the onboard GPS code
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////