Skip to content

Commit

Permalink
Add reset of configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusJull committed Jun 11, 2024
1 parent 7154274 commit 2f904a2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/drivers/m10spg/m10spg.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,25 @@ int m10spg_open(const SensorLocation *loc) {
UBXValsetPayload valset_payload;
UBXAckPayload ack_payload;

// Clear the RAM configuration to ensure our settings are the only ones being used
msg.header.class = 0x06;
msg.header.id = 0x04;
msg.header.length = 4;

UBXConfigResetPayload reset_payload;
reset_payload.navBbrMask[0] = 0x00;
reset_payload.navBbrMask[1] = 0x00;
reset_payload.resetMode = UBX_SOFT_RESET;
msg.payload = &reset_payload;
calculate_checksum(&msg, &msg.checksum_a, &msg.checksum_b);
send_message(loc, &msg);
// Has no response, sleep to wait for reset
sleep(1);

// Configure the chip
msg.payload = &valset_payload;

// Put our actual configuration on there
init_valset_message(&msg, RAM_LAYER);
uint8_t config_disabled = 0;
uint8_t config_dynmodel = DYNMODEL_AIR_4G;
Expand Down
16 changes: 16 additions & 0 deletions src/drivers/m10spg/ubx_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ typedef struct {
uint8_t flags; /**< Flags that describe if this time information is valid (see the interface description) */
} UBXUTCPayload;

typedef enum {
UBX_HARD_RESET = 0x00, /**< Hardware reset (watchdog), immediate */
UBX_SOFT_RESET = 0x01, /**< Controlled software reset (clears RAM) */
UBX_SOFT_GNSS_RESET = 0x02, /**< Controlled software reset, GNSS only */
UBX_HARD_WDT_RESET = 0x04, /**< Hardware reset (watchdog), after shutdown */
UBX_STOP_GNSS = 0x08, /** Controlled GNSS stop */
UBX_START_GNSS = 0x09, /**< Controlled GNSS start */
} UBXResetMode;

/** A struct representing the UBX-CFG-RST (reset reciever) payload */
typedef struct {
uint8_t navBbrMask[2]; /**< Bit fields that select what BBR data to clear (leave as 0 for a hot start) */
uint8_t resetMode; /**< The type of reset to perform, of type UBXResetMode */
uint8_t reserved; /**< Reserved bytes */
} UBXConfigResetPayload;

/** Max bytes to be used for valset payload items (limit of 64 items per message) */
#define MAX_VALSET_ITEM_BYTES 128

Expand Down

0 comments on commit 2f904a2

Please sign in to comment.