Skip to content

Commit

Permalink
Add option to configure the set of used GNSS systems
Browse files Browse the repository at this point in the history
Functionality not implemented yet, see issue PX4#68 for details
  • Loading branch information
jbeyerstedt committed Jan 6, 2021
1 parent 9282d3d commit 37f4a72
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/ashtech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ int GPSDriverAshtech::waitForReply(NMEACommand command, const unsigned timeout)
return _command_state == NMEACommandState::received ? 0 : -1;
}

int GPSDriverAshtech::configure(unsigned &baudrate, OutputMode output_mode)
int GPSDriverAshtech::configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems)
{
_output_mode = output_mode;
_correction_output_activated = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ashtech.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GPSDriverAshtech : public GPSBaseStationSupport

virtual ~GPSDriverAshtech();

int configure(unsigned &baudrate, OutputMode output_mode) override;
int configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems) override;

int receive(unsigned timeout) override;

Expand Down
2 changes: 1 addition & 1 deletion src/emlid_reach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ GPSDriverEmlidReach::GPSDriverEmlidReach(GPSCallbackPtr callback, void *callback


int
GPSDriverEmlidReach::configure(unsigned &baudrate, OutputMode output_mode)
GPSDriverEmlidReach::configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems)
{
// TODO RTK
if (output_mode != OutputMode::GPS) {
Expand Down
2 changes: 1 addition & 1 deletion src/emlid_reach.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class GPSDriverEmlidReach : public GPSHelper
virtual ~GPSDriverEmlidReach() = default;

int receive(unsigned timeout) override;
int configure(unsigned &baudrate, OutputMode output_mode) override;
int configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems) override;

private:

Expand Down
2 changes: 1 addition & 1 deletion src/femtomes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ int GPSDriverFemto::writeAckedCommandFemto(const char *command, const char *repl
return -1;
}

int GPSDriverFemto::configure(unsigned &baudrate, OutputMode output_mode)
int GPSDriverFemto::configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems)
{

if (output_mode != OutputMode::GPS) {
Expand Down
2 changes: 1 addition & 1 deletion src/femtomes.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class GPSDriverFemto : public GPSHelper
virtual ~GPSDriverFemto() = default;

int receive(unsigned timeout) override;
int configure(unsigned &baudrate, OutputMode output_mode) override;
int configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems) override;

private:

Expand Down
21 changes: 20 additions & 1 deletion src/gps_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ class GPSHelper
SPI
};

/**
* Bitmask for GPS_1_GNSS and GPS_2_GNSS
* No bits set should keep the receiver's default config
*/
enum class GNSSSystemsMask : int32_t {
ENABLE_GPS = 1 << 0,
ENABLE_SBAS = 1 << 1,
ENABLE_GALILEO = 1 << 2,
ENABLE_BEIDOU = 1 << 3,
ENABLE_GLONASS = 1 << 4
};


GPSHelper(GPSCallbackPtr callback, void *callback_user);
virtual ~GPSHelper() = default;
Expand All @@ -169,9 +181,11 @@ class GPSHelper
* configure the device
* @param baud Input and output parameter: if set to 0, the baudrate will be automatically detected and set to
* the detected baudrate. If not 0, a fixed baudrate is used.
* @param output_mode Output protocol
* @param gnssSystems Bit set of GNSS systems to enable, 0 for no change of config
* @return 0 on success, <0 otherwise
*/
virtual int configure(unsigned &baud, OutputMode output_mode) = 0;
virtual int configure(unsigned &baud, OutputMode output_mode, GNSSSystemsMask gnssSystems) = 0;

/**
* receive & handle new data from the device
Expand Down Expand Up @@ -278,3 +292,8 @@ class GPSHelper

uint64_t _interval_rate_start{0};
};

inline bool operator&(GPSHelper::GNSSSystemsMask a, GPSHelper::GNSSSystemsMask b)
{
return static_cast<int32_t>(a) & static_cast<int32_t>(b);
}
2 changes: 1 addition & 1 deletion src/mtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ GPSDriverMTK::GPSDriverMTK(GPSCallbackPtr callback, void *callback_user, sensor_
}

int
GPSDriverMTK::configure(unsigned &baudrate, OutputMode output_mode)
GPSDriverMTK::configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems)
{
if (output_mode != OutputMode::GPS) {
GPS_WARN("MTK: Unsupported Output Mode %i", (int)output_mode);
Expand Down
2 changes: 1 addition & 1 deletion src/mtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class GPSDriverMTK : public GPSHelper
virtual ~GPSDriverMTK() = default;

int receive(unsigned timeout) override;
int configure(unsigned &baudrate, OutputMode output_mode) override;
int configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems) override;

private:
/**
Expand Down
2 changes: 1 addition & 1 deletion src/sbf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ GPSDriverSBF::~GPSDriverSBF()
}

int
GPSDriverSBF::configure(unsigned &baudrate, OutputMode output_mode)
GPSDriverSBF::configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems)
{
_configured = false;

Expand Down
2 changes: 1 addition & 1 deletion src/sbf.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class GPSDriverSBF : public GPSBaseStationSupport
virtual ~GPSDriverSBF() override;

int receive(unsigned timeout) override;
int configure(unsigned &baudrate, OutputMode output_mode) override;
int configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems) override;
int reset(GPSRestartType restart_type) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/ubx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ GPSDriverUBX::~GPSDriverUBX()
}

int
GPSDriverUBX::configure(unsigned &baudrate, OutputMode output_mode)
GPSDriverUBX::configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems)
{
_configured = false;
_output_mode = output_mode;
Expand Down
2 changes: 1 addition & 1 deletion src/ubx.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ class GPSDriverUBX : public GPSBaseStationSupport

virtual ~GPSDriverUBX();

int configure(unsigned &baudrate, OutputMode output_mode) override;
int configure(unsigned &baudrate, OutputMode output_mode, GNSSSystemsMask gnssSystems) override;
int receive(unsigned timeout) override;
int reset(GPSRestartType restart_type) override;

Expand Down

0 comments on commit 37f4a72

Please sign in to comment.