Skip to content

minor lora sx126x _cmd optimization #895

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

Closed
wants to merge 2 commits into from

Conversation

maholli
Copy link
Contributor

@maholli maholli commented Jul 9, 2024

Currently, the micropython-lib lora sx126x driver dynamically creates at least one, sometimes two, memoryview objects with each call to _cmd. This PR simply provides the class with a long-lived memoryview object for _cmd to easily slice as necessary.

Unlike the SX127x chips, Semtech unfortunately designed the SX126x modems to be more command-centric (as opposed to directly setting registers). Given the amount _cmd is called during normal device operation, even a minor improvement here should have a decent impact.

Basic TX and RX tests pass on hardware.

@projectgus, care to review?

Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

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

Thanks for noticing this and submitting a fix, @maholli!

The other thing to change is micropython/lora/lora-sx126x/manifest.py. Please bump the version from 0.1.2 to 0.1.3 so that clients will update.

I have a suggestion for a further change inline, too.

The CI is also failing on the commit message format. To make CI happy, make any code changes changes then run commit --amend to change the existing commit contents and also rewrite the message to match the project format. After this you can git push --force back to your branch on GitHub in order to update.

For more details see:

@maholli maholli force-pushed the master branch 2 times, most recently from 4cc77c1 to 71faa7b Compare July 12, 2024 22:00
@maholli
Copy link
Contributor Author

maholli commented Jul 12, 2024

Requested changes have been made and the checks are happy. Let me know if there's anything else. Thanks again, @projectgus.

Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @maholli. I would probably squash the two commits into one, but we can probably also do that when we merge this.

@maholli
Copy link
Contributor Author

maholli commented Jul 17, 2024

Looks good to me, thanks @maholli. I would probably squash the two commits into one, but we can probably also do that when we merge this.

@projectgus Yes, feel free to squash when you merge. Thanks again!

@dpgeorge
Copy link
Member

Thanks for the contribution. Squashed and merged in 60d1370

@dpgeorge dpgeorge closed this Jul 23, 2024
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