From ec30c5c7368016fd90cfa6e3fac628cd3f9aa90e Mon Sep 17 00:00:00 2001 From: Thomas Frans Date: Tue, 18 Jun 2024 11:28:29 +0200 Subject: [PATCH] gnss(septentrio): fix incorrect heading offset configuration Heading offset was configured as radians but should be configured as degrees on Septentrio receivers. The parameter was already in degrees but the configuration logic was changing it into radians. Also allow the entire allowed range of heading offset values for Septentrio receivers. --- src/drivers/gnss/septentrio/module.yaml | 2 +- src/drivers/gnss/septentrio/septentrio.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/gnss/septentrio/module.yaml b/src/drivers/gnss/septentrio/module.yaml index fd06252469..1b151f3618 100644 --- a/src/drivers/gnss/septentrio/module.yaml +++ b/src/drivers/gnss/septentrio/module.yaml @@ -71,7 +71,7 @@ parameters: type: float decimal: 3 default: 0 - min: 0 + min: -360 max: 360 unit: deg reboot_required: true diff --git a/src/drivers/gnss/septentrio/septentrio.cpp b/src/drivers/gnss/septentrio/septentrio.cpp index 5b88391017..095e60d5c3 100644 --- a/src/drivers/gnss/septentrio/septentrio.cpp +++ b/src/drivers/gnss/septentrio/septentrio.cpp @@ -153,8 +153,6 @@ SeptentrioDriver::SeptentrioDriver(const char *device_path, Instance instance, u // Enforce null termination. _port[sizeof(_port) - 1] = '\0'; - reset_gps_state_message(); - int32_t enable_sat_info {0}; get_parameter("SEP_SAT_INFO", &enable_sat_info); @@ -211,6 +209,8 @@ SeptentrioDriver::SeptentrioDriver(const char *device_path, Instance instance, u } set_device_type(DRV_GPS_DEVTYPE_SBF); + + reset_gps_state_message(); } SeptentrioDriver::~SeptentrioDriver() @@ -948,7 +948,7 @@ SeptentrioDriver::ConfigureResult SeptentrioDriver::configure() } // Specify the offsets that the receiver applies to the computed attitude angles. - snprintf(msg, sizeof(msg), k_command_set_attitude_offset, (double)(_heading_offset * 180 / M_PI_F), (double)_pitch_offset); + snprintf(msg, sizeof(msg), k_command_set_attitude_offset, static_cast(_heading_offset), static_cast(_pitch_offset)); if (!send_message_and_wait_for_ack(msg, k_receiver_ack_timeout_fast)) { return ConfigureResult::FailedCompletely;