-
Notifications
You must be signed in to change notification settings - Fork 19
moved spi block to where it's needed #36
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
Conversation
Thanks for submitting this fix @slootsky, the change makes sense to me. I think we also want to use |
@FoamyGuy yeah, I saw your patch [ to remove the parameters to board.SPI() ] after I'd done my code. I didn't realize that SPI would work with no parameters (I haven't gone into the board code). I can add that change if you want. |
I think the main difference is The other nice thing is I do think we want to make that change. If you change this PR to use |
note: I don't have code that tests this line, so I can't confirm it. Also, having trouble getting black to run correctly.
@slootsky It looks like all you've got to do is run black which should automatically fix the errors we're getting. You can find out how to do that here: https://learn.adafruit.com/improve-your-code-with-pylint/black The short version is |
…thon_PortalBase into feature/fix_SPI_error # Conflicts: # adafruit_portalbase/wifi_coprocessor.py
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.
These changes look good to me.
I tested them successfully with:
Adafruit CircuitPython 7.0.0-alpha.1-817-g927d5a045 on 2021-04-25; Adafruit PyPortal with samd51j20
Updating https://github.com/adafruit/Adafruit_CircuitPython_FunHouse to 2.1.0 from 2.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_FunHouse#12 from makermelissa/main Updating https://github.com/adafruit/Adafruit_CircuitPython_MagTag to 2.1.0 from 2.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_MagTag#61 from makermelissa/main Updating https://github.com/adafruit/Adafruit_CircuitPython_PortalBase to 1.7.0 from 1.6.2: > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#39 from makermelissa/main > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#38 from makermelissa/main > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#36 from slootsky/feature/fix_SPI_error
without this block moved, there is an error regarding SCK in use
Traceback (most recent call last):
File "code.py", line 80, in
File "/lib/adafruit_pyportal/init.py", line 152, in init
File "/lib/adafruit_pyportal/network.py", line 95, in init
File "adafruit_portalbase/wifi_coprocessor.py", line 66, in init
ValueError: SCK in use
The spi object is passed into the WiFi constructor, but if there was no esp object passed in, then the spi was ignored and attempted to be reconstructed.
Since spi isn't needed in the if esp block, I just moved it to the else block