Skip to content

Commit

Permalink
AP_HAL_ChibiOS: support configuration of highres IMUs on board subtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Apr 15, 2024
1 parent 5ec9eac commit 5b5d31e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ IMU Invensensev3 SPI:icm45686-2 ROTATION_ROLL_180 BOARD_MATCH(FMUV6_BOARD_HOLY
IMU Invensensev3 SPI:icm45686-3 ROTATION_ROLL_180 BOARD_MATCH(FMUV6_BOARD_HOLYBRO_6X_45686)
IMU Invensensev3 SPI:icm45686-1 ROTATION_YAW_90 BOARD_MATCH(FMUV6_BOARD_HOLYBRO_6X_45686)

IMU_HIGHRES_SAMPLE 7 BOARD_MATCH(FMUV6_BOARD_HOLYBRO_6X_45686)

define HAL_DEFAULT_INS_FAST_SAMPLE 7

# enable RAMTROM parameter storage
Expand Down
8 changes: 8 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,14 @@ def write_IMU_config(self, f):
if len(devlist) < 3:
f.write('#define INS_MAX_INSTANCES %u\n' % len(devlist))
f.write('#define HAL_INS_PROBE_LIST %s\n\n' % ';'.join(devlist))
highres = self.get_config('IMU_HIGHRES_SAMPLE', required=False, aslist=True)
if highres is not None:
if highres[-1].startswith("BOARD_MATCH("):
f.write('#define HAL_INS_HIGHRES_SAMPLE %s\n' % highres[0])
f.write('#define HAL_INS_HIGHRES_SAMPLE_MASK (%s?HAL_INS_HIGHRES_SAMPLE:0)\n' % highres[-1])
else:
f.write('#define HAL_INS_HIGHRES_SAMPLE %s\n' % highres[0])
f.write('#define HAL_INS_HIGHRES_SAMPLE_MASK %s\n' % highres[0])

def write_MAG_config(self, f):
'''write MAG config defines'''
Expand Down

0 comments on commit 5b5d31e

Please sign in to comment.