Skip to content

GPS: fix hwVersion field size from uint32_t to uint8_t#11510

Merged
sensei-hacker merged 2 commits intoiNavFlight:maintenance-9.xfrom
sensei-hacker:fix/gps-hwversion-uint8
Apr 25, 2026
Merged

GPS: fix hwVersion field size from uint32_t to uint8_t#11510
sensei-hacker merged 2 commits intoiNavFlight:maintenance-9.xfrom
sensei-hacker:fix/gps-hwversion-uint8

Conversation

@sensei-hacker
Copy link
Copy Markdown
Member

Summary

Follow-up to #11262. Changes gpsState.hwVersion from uint32_t to uint8_t and introduces a structured bit-field encoding for the hardware version byte sent via MSP_GPSSTATISTICS:

  • bits [7:6] = series (0b01 = u-blox Neo/M series)
  • bits [5:0] = generation within series (e.g. 8=M8, 9=M9, 10=M10)

Concrete values: M8=0x48, M9=0x49, M10=0x4A

The encoding reserves series values 0b10 and 0b11 for future chip families (u-blox F9, other manufacturers).

Files changed:

  • src/main/io/gps_ublox.h — new UBX_HW_SERIES_* macros + updated UBX_HW_VERSION_* constants
  • src/main/io/gps_private.huint32_t hwVersionuint8_t hwVersion
  • src/main/fc/fc_msp.csbufWriteU32sbufWriteU8
  • src/main/io/gps_ublox.c — decode function return type uint32_tuint8_t

Test plan

  • Firmware builds without errors or warnings
  • Tested with M9 receiver — hwVersion reported as 0x49, M9-precision preset auto-detected
  • Tested with M10 receiver — hwVersion reported as 0x4A, M10 preset auto-detected
  • Companion configurator PR: iNavFlight/inav-configurator#XXXX

Change gpsState.hwVersion from uint32_t to uint8_t and introduce a
structured bit-field encoding for the hardware version byte:
  bits [7:6] = series  (0b01 = u-blox Neo/M series)
  bits [5:0] = generation (e.g. 8=M8, 9=M9, 10=M10)

Update UBX_HW_VERSION_* constants accordingly (e.g. M8=0x48, M9=0x49,
M10=0x4A). Change MSP_GPSSTATISTICS to send hwVersion as a single byte
(sbufWriteU8) instead of four bytes (sbufWriteU32).

The bit-field layout reserves series values 0b10 and 0b11 for future
chip families (e.g. u-blox F9, other manufacturers).

Tested with M9 and M10 receivers — auto-detection working correctly.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 25, 2026

Test firmware build ready — commit 690c1ec

Download firmware for PR #11510

234 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

@sensei-hacker sensei-hacker merged commit 87b690c into iNavFlight:maintenance-9.x Apr 25, 2026
24 checks passed
@stronnag
Copy link
Copy Markdown
Collaborator

For the last 11 years we have had a conventention that MSP is a public API and we do not break public APIs.

This would appear to change this convention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants