Closed caternuson closed 1 year ago
Hi ! OP here What about L413 and L478 ? Should they be fixed to ?
Also i am very surprise that any other part of this library don't need this .
Not patching the other line cause spinup_time to not work
(venv) pi@prusabox:~/test_emc2101 $ vi /home/pi/test_emc2101/venv/lib/python3.7/site-packages/adafruit_emc2101/__init__.py
(venv) pi@prusabox:~/test_emc2101 $ rm -r /home/pi/test_emc2101/venv/lib/python3.7/site-packages/adafruit_emc2101/__pycache__
(venv) pi@prusabox:~/test_emc2101 $ python
Python 3.7.3 (default, Jun 29 2023, 18:03:57)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> from adafruit_emc2101.emc2101_lut import EMC2101_LUT as EMC2101
>>> i2c = board.I2C()
>>> emc = EMC2101(i2c)
>>> emc.spinup_drive
1
>>> emc.spinup_drive = 3
>>> emc.spinup_drive
3
>>> emc.spinup_time
4
>>> emc.spinup_time = 7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/test_emc2101/venv/lib/python3.7/site-packages/adafruit_emc2101/__init__.py", line 413, in spinup_time
from emc2101_enums import SpinupTime
ModuleNotFoundError: No module named 'emc2101_enums'
while doing so fix the issue
(venv) pi@prusabox:~/test_emc2101 $ vi /home/pi/test_emc2101/venv/lib/python3.7/site-packages/adafruit_emc2101/__init__.py
(venv) pi@prusabox:~/test_emc2101 $ rm -r /home/pi/test_emc2101/venv/lib/python3.7/site-packages/adafruit_emc2101/__pycache__
(venv) pi@prusabox:~/test_emc2101 $ python
Python 3.7.3 (default, Jun 29 2023, 18:03:57)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> from adafruit_emc2101.emc2101_lut import EMC2101_LUT as EMC2101
>>> i2c = board.I2C()
>>> emc = EMC2101(i2c)
>>> emc.spinup_drive
3
>>> emc.spinup_drive = 1
>>> emc.spinup_drive
1
>>> emc.spinup_time
7
>>> emc.spinup_time = 4
>>> emc.spinup_time
4
>>>
Related forum post: https://forums.adafruit.com/viewtopic.php?t=204056
Good catch. Those other imports should also be updated. Pushed those changes.
TBH - This is one of the python-isms I'm never sure about myself. I actually like your approach better though.
@FoamyGuy thanks for updating and closing this one up!
For #31.
Tested on QT PY RP2040: