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

Refinements for MCP2221 #9

Merged
merged 5 commits into from
Feb 10, 2021
Merged

Refinements for MCP2221 #9

merged 5 commits into from
Feb 10, 2021

Conversation

caternuson
Copy link
Contributor

For #2

This is a bit hack-ish in the way it forces an MCP2221 reset, but seems to work. Tested with Blinka/MCP2221:

$ python3 scd30_simpletest.py 
Data Available!
CO2: 0.0 PPM
Temperature: 28.976119995117188 degrees C
Humidity: 28.07159423828125 %%rH

Waiting for new data...

Data Available!
CO2: 1135.52685546875 PPM
Temperature: 28.933395385742188 degrees C
Humidity: 28.12957763671875 %%rH

Waiting for new data...

Data Available!
CO2: 1375.5328369140625 PPM
Temperature: 28.946746826171875 degrees C
Humidity: 29.0130615234375 %%rH

And with CP 6.1.0 on QT Py:

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit QT Py M0 with samd21e18
>>> import scd30_simpletest
Data Available!
CO2: 0.0 PPM
Temperature: 28.8212 degrees C
Humidity: 28.0289 %%rH

Waiting for new data...

Data Available!
CO2: 930.281 PPM
Temperature: 28.8052 degrees C
Humidity: 27.6443 %%rH

Waiting for new data...

Data Available!
CO2: 988.408 PPM
Temperature: 28.8212 degrees C
Humidity: 27.5574 %%rH

@caternuson
Copy link
Contributor Author

As an alternative, could remove the call to reset() in __init__, similar to #3.

sleep(0.1) # not mentioned by datasheet, but required to avoid IO error
# pylint:disable=protected-access
# are we using Blinka?
if hasattr(self.i2c_device.i2c, "_i2c"):
Copy link
Member

Choose a reason for hiding this comment

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

id kinda sorta prefer not having this here but instead in a new simple example just for mcp2221 if thats ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we'd have to remove the call to reset() in __init__, which is maybe OK? otherwise you can't even instantiate with mcp2221.

Copy link
Member

Choose a reason for hiding this comment

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

.<
ridiculous sensor.
ok move the reset() out of init and into the example too

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

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

rename file to scd30_mcp2221test.py?

@caternuson
Copy link
Contributor Author

rename file to scd30_mcp2221test.py?

The new example? I was thinking it may end up growing with time. Can add whatever future hacks are needed for whatever board there?

@ladyada
Copy link
Member

ladyada commented Feb 10, 2021

want me to review?

@caternuson
Copy link
Contributor Author

Sure. I can rename the example too if you want. I'm really not sure best way to document this "feature". Might make sense to name it something to draw attention to it being something MCP2221 specific?

@ladyada
Copy link
Member

ladyada commented Feb 10, 2021

yeah rename to scd30_mcp2221test.py

@ladyada ladyada merged commit 746e77f into adafruit:main Feb 10, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 12, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_BME680 to 3.3.1 from 3.3.0:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#40 from caternuson/iss39
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#36 from adafruit/REUSE
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#38 from caternuson/iss37_spi_example
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 2.2.7 from 2.2.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#37 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_FONA to 2.1.2 from 2.1.1:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_FONA#12 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_HTS221 to 1.1.3 from 1.1.2:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_HTS221#6 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_MSA301 to 1.2.5 from 1.2.4:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_MSA301#14 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel to 6.0.2 from 6.0.1:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_NeoPixel#103 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_RockBlock to 1.3.1 from 1.3.0:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_RockBlock#19 from adafruit/REUSE

Updating https://github.com/adafruit/Adafruit_CircuitPython_SCD30 to 2.0.2 from 2.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_SCD30#9 from caternuson/iss2_mcp2221

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1327 to 1.2.1 from 1.2.0:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1327#9 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_ST7789 to 1.4.3 from 1.4.2:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_ST7789#21 from wildestpixel/patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A to 0.3.4 from 0.3.3:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#23 from SAK917/adafruit/Adafruit_CircuitPython_TCA9548A#20-remove-obsolete-code

Updating https://github.com/adafruit/Adafruit_CircuitPython_AWS_IOT to 2.0.5 from 2.0.4:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_AWS_IOT#16 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT to 2.3.3 from 2.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#25 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.3.4 from 1.3.3:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#37 from jfurcean/fix_api_docs

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_MIDI to 1.0.3 from 1.0.2:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_MIDI#6 from adafruit/REUSE

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 1.12.3 from 2.12.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#117 from kmatch98/bitmap_label_scale
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#116 from lesamouraipourpre/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Hue to 1.1.3 from 1.1.2:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_Hue#14 from adafruit/REUSE

Updating https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad to 0.13.2 from 0.13.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_ImageLoad#43 from adafruit/REUSE
  > Hardcoded Black and REUSE versions
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_LIFX to 1.9.4 from 1.1.2:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_LIFX#10 from adafruit/REUSE

Updating https://github.com/adafruit/Adafruit_CircuitPython_MagTag to 1.6.0 from 1.5.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_MagTag#54 from makermelissa/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 1.9.6 from 1.9.5:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#68 from jfabernathy/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO to 3.0.1 from 3.0.0:
  > Hardcoded Black and REUSE versions
  > Merge pull request adafruit/Adafruit_CircuitPython_SimpleIO#60 from adafruit/REUSE
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.

2 participants