Browse Source

GPS: add stub settings for nav_setting in the other GPS drivers

only Ublox supports nav_setting so far
master
Andrew Tridgell 13 years ago
parent
commit
33a2ad7e07
  1. 4
      libraries/AP_GPS/AP_GPS_406.cpp
  2. 2
      libraries/AP_GPS/AP_GPS_406.h
  3. 5
      libraries/AP_GPS/AP_GPS_Auto.cpp
  4. 3
      libraries/AP_GPS/AP_GPS_Auto.h
  5. 2
      libraries/AP_GPS/AP_GPS_HIL.cpp
  6. 2
      libraries/AP_GPS/AP_GPS_HIL.h
  7. 2
      libraries/AP_GPS/AP_GPS_IMU.cpp
  8. 2
      libraries/AP_GPS/AP_GPS_IMU.h
  9. 2
      libraries/AP_GPS/AP_GPS_MTK.cpp
  10. 2
      libraries/AP_GPS/AP_GPS_MTK.h
  11. 2
      libraries/AP_GPS/AP_GPS_MTK16.cpp
  12. 2
      libraries/AP_GPS/AP_GPS_MTK16.h
  13. 2
      libraries/AP_GPS/AP_GPS_NMEA.cpp
  14. 2
      libraries/AP_GPS/AP_GPS_NMEA.h
  15. 2
      libraries/AP_GPS/AP_GPS_None.h
  16. 2
      libraries/AP_GPS/AP_GPS_SIRF.cpp
  17. 2
      libraries/AP_GPS/AP_GPS_SIRF.h
  18. 2
      libraries/AP_GPS/AP_GPS_Shim.h
  19. 2
      libraries/AP_GPS/GPS.cpp
  20. 16
      libraries/AP_GPS/GPS.h

4
libraries/AP_GPS/AP_GPS_406.cpp

@ -25,12 +25,12 @@ AP_GPS_406::AP_GPS_406(Stream *s) : AP_GPS_SIRF(s) @@ -25,12 +25,12 @@ AP_GPS_406::AP_GPS_406(Stream *s) : AP_GPS_SIRF(s)
}
// Public Methods ////////////////////////////////////////////////////////////////////
void AP_GPS_406::init(void)
void AP_GPS_406::init(enum GPS_Engine_Setting nav_setting)
{
_change_to_sirf_protocol(); // Changes to SIRF protocol and sets baud rate
_configure_gps(); // Function to configure GPS, to output only the desired msg's
AP_GPS_SIRF::init(); // let the superclass do anything it might need here
AP_GPS_SIRF::init(nav_setting); // let the superclass do anything it might need here
idleTimeout = 1200;
}

2
libraries/AP_GPS/AP_GPS_406.h

@ -21,7 +21,7 @@ class AP_GPS_406 : public AP_GPS_SIRF @@ -21,7 +21,7 @@ class AP_GPS_406 : public AP_GPS_SIRF
public:
// Methods
AP_GPS_406(Stream *port);
virtual void init(void);
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
private:
void _change_to_sirf_protocol(void);

5
libraries/AP_GPS/AP_GPS_Auto.cpp

@ -34,10 +34,11 @@ AP_GPS_Auto::AP_GPS_Auto(FastSerial *s, GPS **gps) : @@ -34,10 +34,11 @@ AP_GPS_Auto::AP_GPS_Auto(FastSerial *s, GPS **gps) :
// Do nothing at init time - it may be too early to try detecting the GPS
//
void
AP_GPS_Auto::init(void)
AP_GPS_Auto::init(enum GPS_Engine_Setting nav_setting)
{
idleTimeout = 1200;
if (callback == NULL) callback = delay;
_nav_setting = nav_setting;
}
// Called the first time that a client tries to kick the GPS to update.
@ -70,7 +71,7 @@ AP_GPS_Auto::read(void) @@ -70,7 +71,7 @@ AP_GPS_Auto::read(void)
if (NULL != (gps = _detect())) {
// configure the detected GPS and give it a chance to listen to its device
gps->init();
gps->init(_nav_setting);
then = millis();
while ((millis() - then) < 1200) {
// if we get a successful update from the GPS, we are done

3
libraries/AP_GPS/AP_GPS_Auto.h

@ -24,7 +24,7 @@ public: @@ -24,7 +24,7 @@ public:
AP_GPS_Auto(FastSerial *s, GPS **gps);
/// Dummy init routine, does nothing
virtual void init(void);
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
/// Detect and initialise the attached GPS unit. Updates the
/// pointer passed into the constructor when a GPS is detected.
@ -47,5 +47,6 @@ private: @@ -47,5 +47,6 @@ private:
static const prog_char _ublox_set_binary[];
static const prog_char _sirf_set_binary[];
enum GPS_Engine_Setting _nav_setting;
};
#endif

2
libraries/AP_GPS/AP_GPS_HIL.cpp

@ -24,7 +24,7 @@ AP_GPS_HIL::AP_GPS_HIL(Stream *s) : GPS(s) @@ -24,7 +24,7 @@ AP_GPS_HIL::AP_GPS_HIL(Stream *s) : GPS(s)
}
// Public Methods //////////////////////////////////////////////////////////////
void AP_GPS_HIL::init(void)
void AP_GPS_HIL::init(enum GPS_Engine_Setting nav_setting)
{
idleTimeout = 1200;
}

2
libraries/AP_GPS/AP_GPS_HIL.h

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
class AP_GPS_HIL : public GPS {
public:
AP_GPS_HIL(Stream *s);
virtual void init(void);
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
virtual bool read(void);
/**

2
libraries/AP_GPS/AP_GPS_IMU.cpp

@ -43,7 +43,7 @@ AP_GPS_IMU::AP_GPS_IMU(Stream *s) : GPS(s) @@ -43,7 +43,7 @@ AP_GPS_IMU::AP_GPS_IMU(Stream *s) : GPS(s)
// Public Methods //////////////////////////////////////////////////////////////
void
AP_GPS_IMU::init(void)
AP_GPS_IMU::init(enum GPS_Engine_Setting nav_setting)
{
// we expect the stream to already be open at the corret bitrate
idleTimeout = 1200;

2
libraries/AP_GPS/AP_GPS_IMU.h

@ -11,7 +11,7 @@ public: @@ -11,7 +11,7 @@ public:
// Methods
AP_GPS_IMU(Stream *s);
virtual void init(void);
virtual void init(enum GPS_Engine_Setting nav_setting);
virtual bool read(void);
// Properties

2
libraries/AP_GPS/AP_GPS_MTK.cpp

@ -21,7 +21,7 @@ AP_GPS_MTK::AP_GPS_MTK(Stream *s) : GPS(s) @@ -21,7 +21,7 @@ AP_GPS_MTK::AP_GPS_MTK(Stream *s) : GPS(s)
// Public Methods //////////////////////////////////////////////////////////////
void
AP_GPS_MTK::init(void)
AP_GPS_MTK::init(enum GPS_Engine_Setting nav_setting)
{
_port->flush();
// initialize serial port for binary protocol use

2
libraries/AP_GPS/AP_GPS_MTK.h

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
class AP_GPS_MTK : public GPS {
public:
AP_GPS_MTK(Stream *s);
virtual void init(void);
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
virtual bool read(void);
private:

2
libraries/AP_GPS/AP_GPS_MTK16.cpp

@ -26,7 +26,7 @@ AP_GPS_MTK16::AP_GPS_MTK16(Stream *s) : GPS(s) @@ -26,7 +26,7 @@ AP_GPS_MTK16::AP_GPS_MTK16(Stream *s) : GPS(s)
// Public Methods //////////////////////////////////////////////////////////////
void
AP_GPS_MTK16::init(void)
AP_GPS_MTK16::init(enum GPS_Engine_Setting nav_setting)
{
_port->flush();

2
libraries/AP_GPS/AP_GPS_MTK16.h

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
class AP_GPS_MTK16 : public GPS {
public:
AP_GPS_MTK16(Stream *s);
virtual void init(void);
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
virtual bool read(void);
private:

2
libraries/AP_GPS/AP_GPS_NMEA.cpp

@ -97,7 +97,7 @@ AP_GPS_NMEA::AP_GPS_NMEA(Stream *s) : @@ -97,7 +97,7 @@ AP_GPS_NMEA::AP_GPS_NMEA(Stream *s) :
}
// Public Methods //////////////////////////////////////////////////////////////
void AP_GPS_NMEA::init(void)
void AP_GPS_NMEA::init(enum GPS_Engine_Setting nav_setting)
{
BetterStream *bs = (BetterStream *)_port;

2
libraries/AP_GPS/AP_GPS_NMEA.h

@ -58,7 +58,7 @@ public: @@ -58,7 +58,7 @@ public:
/// Perform a (re)initialisation of the GPS; sends the
/// protocol configuration messages.
///
virtual void init();
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
/// Checks the serial receive buffer for characters,
/// attempts to parse NMEA data and updates internal state

2
libraries/AP_GPS/AP_GPS_None.h

@ -9,7 +9,7 @@ class AP_GPS_None : public GPS @@ -9,7 +9,7 @@ class AP_GPS_None : public GPS
{
public:
AP_GPS_None(Stream *s) : GPS(s) {}
virtual void init(void) {};
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE) {};
virtual bool read(void) {
return false;
};

2
libraries/AP_GPS/AP_GPS_SIRF.cpp

@ -30,7 +30,7 @@ AP_GPS_SIRF::AP_GPS_SIRF(Stream *s) : GPS(s) @@ -30,7 +30,7 @@ AP_GPS_SIRF::AP_GPS_SIRF(Stream *s) : GPS(s)
// Public Methods //////////////////////////////////////////////////////////////
void
AP_GPS_SIRF::init(void)
AP_GPS_SIRF::init(enum GPS_Engine_Setting nav_setting)
{
_port->flush();

2
libraries/AP_GPS/AP_GPS_SIRF.h

@ -19,7 +19,7 @@ class AP_GPS_SIRF : public GPS { @@ -19,7 +19,7 @@ class AP_GPS_SIRF : public GPS {
public:
AP_GPS_SIRF(Stream *s);
virtual void init();
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE);
virtual bool read();
private:

2
libraries/AP_GPS/AP_GPS_Shim.h

@ -19,7 +19,7 @@ class AP_GPS_Shim : public GPS @@ -19,7 +19,7 @@ class AP_GPS_Shim : public GPS
public:
AP_GPS_Shim() : GPS(NULL) {}
virtual void init(void) {};
virtual void init(enum GPS_Engine_Setting nav_setting = GPS_ENGINE_NONE) {};
virtual bool read(void) {
bool updated = _updated;
_updated = false;

2
libraries/AP_GPS/GPS.cpp

@ -35,7 +35,7 @@ GPS::update(void) @@ -35,7 +35,7 @@ GPS::update(void)
Debug("gps read timeout %lu %lu", (unsigned long)tnow, (unsigned long)_idleTimer);
_status = NO_GPS;
init();
init(_nav_setting);
// reset the idle timer
_idleTimer = tnow;
}

16
libraries/AP_GPS/GPS.h

@ -36,6 +36,18 @@ public: @@ -36,6 +36,18 @@ public:
GPS_OK = 2 ///< Receiving valid messages and locked
};
// GPS navigation engine settings. Not all GPS receivers support
// this
enum GPS_Engine_Setting {
GPS_ENGINE_NONE = -1,
GPS_ENGINE_PEDESTRIAN = 3,
GPS_ENGINE_AUTOMOTIVE = 4,
GPS_ENGINE_SEA = 5,
GPS_ENGINE_AIRBORNE_1G = 6,
GPS_ENGINE_AIRBORNE_2G = 7,
GPS_ENGINE_AIRBORNE_4G = 8
};
/// Query GPS status
///
/// The 'valid message' status indicates that a recognised message was
@ -72,7 +84,7 @@ public: @@ -72,7 +84,7 @@ public:
///
/// Must be implemented by the GPS driver.
///
virtual void init(void) = 0;
virtual void init(enum GPS_Engine_Setting engine_setting = GPS_ENGINE_NONE) = 0;
// Properties
uint32_t time; ///< GPS time (milliseconds from epoch)
@ -166,6 +178,8 @@ protected: @@ -166,6 +178,8 @@ protected:
/// Time epoch code for the gps in use
GPS_Time_Epoch _epoch;
enum GPS_Engine_Setting _nav_setting;
private:

Loading…
Cancel
Save