Skip to content

Object instantiation causes a reset #79

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
pshanesmith opened this issue Aug 10, 2021 · 4 comments
Closed

Object instantiation causes a reset #79

pshanesmith opened this issue Aug 10, 2021 · 4 comments

Comments

@pshanesmith
Copy link

Having a reset on the board when you create an instance of the Seesaw object limits a lot of applications of the device. The libraries for other breakouts don't do this. Most assume the current state persists unless you power off or reset.

Having the option to not reset would be beneficial.

In my example, I have separate scripts that are called by a master program. In the case, I trigger a PWM signal on one pin. Calling another script that reads the ADC on another pin resets the PWM signal.

@tannewt
Copy link
Member

tannewt commented Aug 11, 2021

Drivers should reset the peripheral to ensure the script runs the same each time. Leaving previous state can cause the script to change behavior without it being obvious why.

Why do you need to share state across scripts? A plugin system could achieve similar flexibility without restarting everything.

I agree though that there should be an option to turn off the reset. Perhaps a reset keyword arg that defaults to True would be sufficient. I think this will be more common as folks do deep sleeps where the scripts restart after wake up.

@pshanesmith
Copy link
Author

pshanesmith commented Aug 29, 2021

Thanks for the response. The drivers for many of the breakouts offered by Adafruit do not reset the device upon instantiation.

In my case, I was attempting to run small scripts in response to sensor input. This is part of an an application developed by someone else that polls using input modules and responds using output modules. There's no option to retain objects between polling and output cycles.

ladyada added a commit to ladyada/Adafruit_CircuitPython_seesaw that referenced this issue Oct 10, 2021
@tekktrik
Copy link
Member

tekktrik commented Oct 7, 2022

I think this was fixed by the linked commit above. Is that correct, @ladyada?

@ladyada ladyada closed this as completed Oct 7, 2022
@ladyada
Copy link
Member

ladyada commented Oct 7, 2022

yep!

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

No branches or pull requests

4 participants