Merge pull request #8 from disq/gps_passthrough
GPS passthrough cli command
This commit is contained in:
commit
ab6df2e317
11
src/cli.c
11
src/cli.c
|
@ -9,6 +9,7 @@ static void cliDefaults(char *cmdline);
|
||||||
static void cliDump(char *cmdLine);
|
static void cliDump(char *cmdLine);
|
||||||
static void cliExit(char *cmdline);
|
static void cliExit(char *cmdline);
|
||||||
static void cliFeature(char *cmdline);
|
static void cliFeature(char *cmdline);
|
||||||
|
static void cliGpsPassthrough(char *cmdline);
|
||||||
static void cliHelp(char *cmdline);
|
static void cliHelp(char *cmdline);
|
||||||
static void cliMap(char *cmdline);
|
static void cliMap(char *cmdline);
|
||||||
static void cliMixer(char *cmdline);
|
static void cliMixer(char *cmdline);
|
||||||
|
@ -77,6 +78,7 @@ const clicmd_t cmdTable[] = {
|
||||||
{ "dump", "print configurable settings in a pastable form", cliDump },
|
{ "dump", "print configurable settings in a pastable form", cliDump },
|
||||||
{ "exit", "", cliExit },
|
{ "exit", "", cliExit },
|
||||||
{ "feature", "list or -val or val", cliFeature },
|
{ "feature", "list or -val or val", cliFeature },
|
||||||
|
{ "gpspassthrough", "passthrough gps to serial", cliGpsPassthrough },
|
||||||
{ "help", "", cliHelp },
|
{ "help", "", cliHelp },
|
||||||
{ "map", "mapping of rc channel order", cliMap },
|
{ "map", "mapping of rc channel order", cliMap },
|
||||||
{ "mixer", "mixer name or list", cliMixer },
|
{ "mixer", "mixer name or list", cliMixer },
|
||||||
|
@ -665,6 +667,15 @@ static void cliFeature(char *cmdline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cliGpsPassthrough(char *cmdline)
|
||||||
|
{
|
||||||
|
cliPrint("Enabling GPS passthrough...");
|
||||||
|
|
||||||
|
if (gpsSetPassthrough() == -1) {
|
||||||
|
cliPrint("Error: Enable and plug in GPS first\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void cliHelp(char *cmdline)
|
static void cliHelp(char *cmdline)
|
||||||
{
|
{
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
26
src/gps.c
26
src/gps.c
|
@ -537,6 +537,32 @@ void gpsSetPIDs(void)
|
||||||
navPID_PARAM.Imax = POSHOLD_RATE_IMAX * 100;
|
navPID_PARAM.Imax = POSHOLD_RATE_IMAX * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t gpsSetPassthrough(void)
|
||||||
|
{
|
||||||
|
if (gpsData.state != GPS_RECEIVINGDATA)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// get rid of callback
|
||||||
|
core.gpsport->callback = NULL;
|
||||||
|
|
||||||
|
LED0_OFF;
|
||||||
|
LED1_OFF;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
if (serialTotalBytesWaiting(core.gpsport)) {
|
||||||
|
LED0_ON;
|
||||||
|
serialWrite(core.mainport, serialRead(core.gpsport));
|
||||||
|
LED0_OFF;
|
||||||
|
}
|
||||||
|
if (serialTotalBytesWaiting(core.mainport)) {
|
||||||
|
LED1_ON;
|
||||||
|
serialWrite(core.gpsport, serialRead(core.mainport));
|
||||||
|
LED1_OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// OK here is the onboard GPS code
|
// OK here is the onboard GPS code
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
1
src/mw.h
1
src/mw.h
|
@ -458,6 +458,7 @@ void cliProcess(void);
|
||||||
void gpsInit(uint8_t baudrate);
|
void gpsInit(uint8_t baudrate);
|
||||||
void gpsThread(void);
|
void gpsThread(void);
|
||||||
void gpsSetPIDs(void);
|
void gpsSetPIDs(void);
|
||||||
|
int8_t gpsSetPassthrough(void);
|
||||||
void GPS_reset_home_position(void);
|
void GPS_reset_home_position(void);
|
||||||
void GPS_reset_nav(void);
|
void GPS_reset_nav(void);
|
||||||
void GPS_set_next_wp(int32_t* lat, int32_t* lon);
|
void GPS_set_next_wp(int32_t* lat, int32_t* lon);
|
||||||
|
|
Loading…
Reference in New Issue