From 752ecd3d1baddf7fa01da6bd424fc71e2bcc2f6f Mon Sep 17 00:00:00 2001 From: Alexander Lerach Date: Thu, 17 Jul 2025 14:31:57 +0200 Subject: [PATCH] ubx: add option to wipe flash --- src/drivers/gps/devices | 2 +- src/drivers/gps/gps.cpp | 9 +++++++++ src/drivers/gps/params.c | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/drivers/gps/devices b/src/drivers/gps/devices index 4cea5de87c..f31394a37e 160000 --- a/src/drivers/gps/devices +++ b/src/drivers/gps/devices @@ -1 +1 @@ -Subproject commit 4cea5de87ce7e2a52e5289bd3639fd8eb770eafa +Subproject commit f31394a37e252e3017e64f729312bcce05ea3a90 diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index 2c40f63202..df2c26c905 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -909,6 +909,15 @@ GPS::run() gpsConfig.interface_protocols = static_cast(gps_ubx_cfg_intf); + int32_t gps_cfg_wipe = 0; + handle = param_find("GPS_CFG_WIPE"); + + if (handle != PARAM_INVALID) { + param_get(handle, &gps_cfg_wipe); + } + + gpsConfig.cfg_wipe = static_cast(gps_cfg_wipe); + if (_helper && _helper->configure(_baudrate, gpsConfig) == 0) { /* reset report */ diff --git a/src/drivers/gps/params.c b/src/drivers/gps/params.c index 512a5131e1..49497fa106 100644 --- a/src/drivers/gps/params.c +++ b/src/drivers/gps/params.c @@ -142,6 +142,22 @@ PARAM_DEFINE_INT32(GPS_UBX_BAUD2, 230400); */ PARAM_DEFINE_INT32(GPS_UBX_CFG_INTF, 0); +/** + * Wipes the flash config of UBX modules. + * + * Some UBX modules have a FLASH that allows to store persistent configuration that will be loaded on start. + * PX4 does override all configuration parameters it needs in RAM, which takes precedence over the values in FLASH. + * However, configuration parameters that are not overriden by PX4 can still cause unexpected problems during flight. + * To avoid these kind of problems a clean config can be reached by wiping the FLASH on boot. + * + * Note: Currently only supported on UBX. + * + * @reboot_required true + * @group GPS + * @boolean + */ +PARAM_DEFINE_INT32(GPS_CFG_WIPE, 0); + /** * Heading/Yaw offset for dual antenna GPS *