Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingthingsintothings committed Mar 22, 2024
1 parent fa592e2 commit 171dc84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/drivers/gnss/septentrio/septentrio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <matrix/math.hpp>
#include <mathlib/mathlib.h>
#include <px4_platform_common/time.h>
#include <px4_platform_common/defines.h>
#include <drivers/drv_hrt.h>
#include <uORB/topics/gps_inject_data.h>
#include <termios.h>
Expand Down Expand Up @@ -1103,26 +1104,28 @@ int SeptentrioGPS::write(const uint8_t* buf, size_t buf_length)
return ::write(_serial_fd, buf, buf_length);
}

void SeptentrioGPS::initialize_communication_dump()
int SeptentrioGPS::initialize_communication_dump()
{
param_t handle = param_find("SSN_DUMP_COMM");
int32_t param_dump_comm;

if (handle == PARAM_INVALID || param_get(handle, &param_dump_comm) != 0) {
return;
return PX4_ERROR;
}

// Check whether dumping is disabled.
if (param_dump_comm < 1 || param_dump_comm > 2) {
return;
return PX4_ERROR;
}

_dump_from_device = new gps_dump_s();
_dump_to_device = new gps_dump_s();

if (!_dump_from_device || !_dump_to_device) {
PX4_ERR("failed to allocated dump data");
return;
_dump_to_device = nullptr;
_dump_from_device = nullptr;
return PX4_ERROR;
}

memset(_dump_to_device, 0, sizeof(gps_dump_s));
Expand All @@ -1133,6 +1136,8 @@ void SeptentrioGPS::initialize_communication_dump()
_dump_communication_pub.advertise();

_dump_communication_mode = (SeptentrioDumpCommMode)param_dump_comm;

return PX4_OK;
}

void SeptentrioGPS::reset_if_scheduled()
Expand Down
8 changes: 6 additions & 2 deletions src/drivers/gnss/septentrio/septentrio.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,12 @@ class SeptentrioGPS : public ModuleBase<SeptentrioGPS>, public device::Device
*/
int write(const uint8_t *buf, size_t buf_length);

// TODO: Document
void initialize_communication_dump();
/**
* @brief Initialize GPS logging uORB topics and advertise them.
*
* @return PX4_OK on success, PX4_ERROR otherwise
*/
int initialize_communication_dump();

/**
* @brief Reset the receiver if it was requested by the user.
Expand Down

0 comments on commit 171dc84

Please sign in to comment.