-
Notifications
You must be signed in to change notification settings - Fork 80
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
Conversation
a87848b
to
ae96b85
Compare
060e44a
to
771ec3a
Compare
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] |
There was a problem hiding this comment.
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>.*))
There was a problem hiding this comment.
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.
f106745
to
011283a
Compare
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. |
ca17422
to
9eef311
Compare
9eef311
to
695bf1d
Compare
695bf1d
to
dfda0e9
Compare
There was a problem hiding this 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 ?
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) |
There was a problem hiding this comment.
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?
No description provided.