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

Implements continuous mode #21

Merged
merged 4 commits into from
Dec 21, 2021
Merged

Implements continuous mode #21

merged 4 commits into from
Dec 21, 2021

Conversation

Smankusors
Copy link
Contributor

@Smankusors Smankusors commented Jul 14, 2020

Fixes #19
Also with an example.

Tested it on Nvidia Jetson Nano with 2 VL53L0X (but it's not from Adafruit).

adafruit_vl53l0x.py Outdated Show resolved Hide resolved
* remove atexit and cleanup
* fix the formatting and method naming
adafruit_vl53l0x.py Outdated Show resolved Hide resolved
@kattni
Copy link
Contributor

kattni commented Aug 19, 2020

@Smankusors Please let me know your status on this PR. Let us know if you're stuck or need assistance with anything. Thanks for the contribution!

@Smankusors
Copy link
Contributor Author

@Smankusors Please let me know your status on this PR. Let us know if you're stuck or need assistance with anything. Thanks for the contribution!

hmm to be honest I'm actually don't want to implement __enter__ and __exit__, kinda confusing. 😵

Should it create new class to handle the context or just use self to handle it? What about multiple sensors? Should it managed by one context manager or managed by itself separately?

thanks for replying btw 😉

@kattni
Copy link
Contributor

kattni commented Jan 6, 2021

@tannewt Can you weigh in on this? It's outside my knowledge. Thanks!

@tannewt
Copy link
Member

tannewt commented Jan 7, 2021

Should it create new class to handle the context or just use self to handle it? What about multiple sensors? Should it managed by one context manager or managed by itself separately?

I'd just use self. Multiple sensors could either do nested with or do start_continuous and stop_continuous explicitly.

@Smankusors
Copy link
Contributor Author

I'd just use self. Multiple sensors could either do nested with or do start_continuous and stop_continuous explicitly.

Hmm alright. But unfortunately I left my device and sensor on my workplace. And there's still pandemic going on. I will continue to work on this when I got access back.

@jposada202020
Copy link

Hello @Smankusors have you been able to get access to the device, are you still interested in this PR? let us know. Thanks :)

@Smankusors
Copy link
Contributor Author

Hello @Smankusors have you been able to get access to the device, are you still interested in this PR? let us know. Thanks :)

uh oh, yeah I do already have access to the device, but then I got busy with other things. I will try to find some free time to continue on this. Thanks for the reminder.

@jposada202020
Copy link

@Smankusors Thanks :)

@evaherrada evaherrada changed the base branch from master to main June 7, 2021 17:35
@Smankusors
Copy link
Contributor Author

alright I just implemented the context manager for the continuous mode. Also I add an example for the simple continuous 😉

hmm it seems like the code I wrote kinda look weird, I defined a class (continuous_manager) inside a function... is that ok? Or should I move it to somewhere?

@jposada202020
Copy link

@tannewt Could you review please. Thanks

@tannewt
Copy link
Member

tannewt commented Jun 8, 2021

alright I just implemented the context manager for the continuous mode. Also I add an example for the simple continuous wink

hmm it seems like the code I wrote kinda look weird, I defined a class (continuous_manager) inside a function... is that ok? Or should I move it to somewhere?

I think you can simplify it a bit by having continuous_mode return self and then putting the __enter__ and __exit__ functions on the top level class. __enter__ can call start and __exit__ would call stop.

@Smankusors
Copy link
Contributor Author

alright I just implemented the context manager for the continuous mode. Also I add an example for the simple continuous wink
hmm it seems like the code I wrote kinda look weird, I defined a class (continuous_manager) inside a function... is that ok? Or should I move it to somewhere?

I think you can simplify it a bit by having continuous_mode return self and then putting the __enter__ and __exit__ functions on the top level class. __enter__ can call start and __exit__ would call stop.

I see... how about the failing checks? Should I add the... license? Copy paste from other files?

@jposada202020
Copy link

@Smankusors for the copyright license yes, that is the way to go, as you adding the example you will need to add your name, or if you prefer you github user.
run Pylint and Black locally on your code. You can do
this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code

@Smankusors
Copy link
Contributor Author

OK I simplified the manager, and also add the license to my example codes. Is the license format I entered correct?

Copy link
Member

@tannewt tannewt 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! Thank you!

@tannewt tannewt requested a review from ladyada June 22, 2021 01:26
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

tested successfully with feather RP2040 and VL53L0X

@FoamyGuy FoamyGuy merged commit 2203552 into adafruit:main Dec 21, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 22, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_FRAM to 1.3.12 from 1.3.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_FRAM#32 from tekktrik/fix/update-value-error

Updating https://github.com/adafruit/Adafruit_CircuitPython_VL53L0X to 3.5.0 from 3.4.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_VL53L0X#21 from Smankusors/master
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.5.12 from 2.5.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#90 from kattni/specify-python
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 5.1.5 from 5.1.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#91 from Eason010212/fix-remaining-length
  > update rtd py version
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.

No continuous Mode
6 participants