Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: blueos_startup_update: load pi5 overlays in runtime #2646

Closed

Conversation

Williangalvani
Copy link
Member

No description provided.

core/tools/blueos_startup_update/blueos_startup_update.py Outdated Show resolved Hide resolved
core/tools/blueos_startup_update/blueos_startup_update.py Outdated Show resolved Hide resolved
core/tools/blueos_startup_update/blueos_startup_update.py Outdated Show resolved Hide resolved
Comment on lines 443 to 445
loaded_overlays = [overlay.split(": ")[1].strip() for overlay in loaded_overlays if ": " in overlay]
loaded_overlay_names = [overlay.split(" ")[0] for overlay in loaded_overlays if "dtparam" not in overlay]
loaded_dt_params = [overlay.split(" ")[-1] for overlay in loaded_overlays if "dtparam" in overlay]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend using a simple regex over doing this logic, it'll be simpler and more readable.

^(?<index>\d):\s+(?<name>\S+)($|\s+(?<args>.*))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Patrick here, it's easier to follow the parsing from the regex line.

core/tools/blueos_startup_update/blueos_startup_update.py Outdated Show resolved Hide resolved
core/tools/blueos_startup_update/blueos_startup_update.py Outdated Show resolved Hide resolved
@Williangalvani Williangalvani force-pushed the pi5_overlays branch 6 times, most recently from f106745 to 011283a Compare May 31, 2024 14:45
@Williangalvani
Copy link
Member Author

I re-wrote most of it to do it right. it is a lot more code, but it should also be a lot more robust, and easier to follow.

Copy link
Member

@patrickelectric patrickelectric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will move to ardupilot manager right ?

@Williangalvani
Copy link
Member Author

this will move to ardupilot manager right ?

yes, that is the current plan


@staticmethod
def from_string(overlay: str) -> "Overlay":
match = re.match(r"^((?P<index>\d+):\s+)?(?P<name>(\S)+)(?:$|\s+(?P<args>.*))", overlay)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract this line into a class method so we can call it on line 127 instead of having the regex duplicated?

@Williangalvani
Copy link
Member Author

closing this as we should only do these things if we detect a navigator (which only requires i2c overlays)

see #2670 and #2678

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.

3 participants