Skip to content

Check lighthouse config files and add lh config check - #38

Merged
evoggy merged 1 commit into
mainfrom
evoggy/lh-config-fixes
Oct 8, 2026
Merged

evoggy merged 1 commit into
mainfrom
evoggy/lh-config-fixes

Conversation

@evoggy

@evoggy evoggy commented Oct 8, 2026

Copy link
Copy Markdown
Member

Follow-up to #37.

Checking files

  • Files are checked before connecting: the type, the version ('1', or '2' from earlier cfcli versions), and that the base station IDs and values are valid.
  • Only Lighthouse V2 base stations are supported, so a file with systemType: 1 is refused. A missing systemType means V2, as in cflib.
  • Base stations are written in ID order, so reading the same configuration twice gives the same file. Top-level fields cfcli doesn't know are kept.

Number of base stations
cfcli gets the number of base stations the firmware supports from the size of the lighthouse memory: 4 by default, up to 16 with CONFIG_DECK_LIGHTHOUSE_MAX_N_BS. Reads only go through those IDs. A write with IDs the firmware doesn't have is refused before anything is written.

lh config check
Compares the Crazyflie's configuration with a file (-i FILE or stdin), per base station:

  • how far the geometry moved and turned
  • whether the calibration belongs to another base station. The Crazyflie takes the calibration of a base station with another UID, so the geometry may need a new estimate.

It exits with the new exit code 60 (Differs) when they differ. --csv is supported.

BS | Geometry             | Calibration
---+----------------------+-------------------------------------------------------------------------
0  | not on the Crazyflie | other base station: 0x00BC614E in the file, 0xE8781C12 on the Crazyflie
1  | -                    | same

Testing

  • Unit tests pass.
  • On a Crazyflie over USB with firmware built for 4 base stations, lh config check was run with three files:
    • the file lh config read saved from it: exit 0
    • the same file with a geometry added and a UID changed: the differences were reported, exit 60
    • a file with base stations 4–7: reported as not supported by the firmware, exit 60

Files are checked before connecting: the type, the version ('1', or '2'
from earlier cfcli versions) and the base stations. Only Lighthouse V2
base stations are supported: a file with systemType 1 is refused. Base
stations are written in ID order, so reading the same configuration twice
gives the same file, and top-level fields cfcli doesn't know are kept.

The number of base stations the firmware supports (4 by default, up to 16
with CONFIG_DECK_LIGHTHOUSE_MAX_N_BS) is found from the size of the
lighthouse memory. Reads only go through those, and a write with base
station IDs the firmware doesn't have is refused before anything is
written.

`lh config check` compares the Crazyflie's configuration with a file, per
base station: how far the geometry moved and turned, and whether the
calibration belongs to another base station (the Crazyflie takes the
calibration of a base station with another UID). It exits with the new
exit code 60 when they differ.
@evoggy
evoggy merged commit f0ccb80 into main Oct 8, 2026
1 check passed
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.

1 participant