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

Allow NEOPIXEL_POWER* init outside of NeoPixel lib #116

Merged
merged 1 commit into from
Aug 12, 2021
Merged

Conversation

anecdata
Copy link
Member

@anecdata anecdata commented Aug 11, 2021

Ignore exception when trying to set up NEOPIXEL_POWER* pin, since user may have set that up already for controlling power independent of this library.

Based on comments starting here:
#111 (comment)

Tested on Adafruit CircuitPython 7.0.0-alpha.5-187-g1e53cf40a on 2021-08-11; Adafruit MagTag with ESP32S2

import board, digitalio, neopixel

# NeoPixels & light sensor
aux_power_io = digitalio.DigitalInOut(board.NEOPIXEL_POWER_INVERTED)
aux_power_io.direction = digitalio.Direction.OUTPUT
aux_power_io.value = False  # active low

status_light = neopixel.NeoPixel(board.NEOPIXEL, 4, brightness=0.05, pixel_order=neopixel.GRB)

status_light[1] = (255, 0, 255)
aux_power_io.value = True  # turn OFF NeoPixel power
status_light[2] = (0, 255, 0)  # no change after this statement (as expected)

# an interesting quirk:
aux_power_io.value = False  # no change after this statement
status_light[1] = (255, 0, 255)  # both NeoPixels turn on after this statement
# individual NeoPixel status is retained when power is disabled,
# but when power is re-enabled, it takes a new write to display all

Ignore exception when trying to set up `NEOPIXEL_POWER`* pin, since user may have set that up already for controlling power independently of this library.

Tested on `Adafruit CircuitPython 7.0.0-alpha.5-187-g1e53cf40a on 2021-08-11; Adafruit MagTag with ESP32S2`; code snippet:
```py
import digitalio, neopixel

# NeoPixels & light sensor
aux_power_io = digitalio.DigitalInOut(board.NEOPIXEL_POWER_INVERTED)
aux_power_io.direction = Direction.OUTPUT
aux_power_io.value = False  # active low

status_light = neopixel.NeoPixel(board.NEOPIXEL, 4, brightness=0.05, pixel_order=neopixel.GRB)
```
@tannewt tannewt self-requested a review August 12, 2021 16:41
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.

Thank you! cc @UnexpectedMaker

@tannewt tannewt merged commit 0f4661c into main Aug 12, 2021
@anecdata anecdata deleted the anecdata-patch-1 branch August 12, 2021 17:25
@UnexpectedMaker
Copy link

Oh wicked @anecdata - thanks for doing this. I hadn't had time to get to it yet, so it's much appreciated!

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 17, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306 to 1.4.1 from 1.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#22 from lesamouraipourpre/pypi

Updating https://github.com/adafruit/Adafruit_CircuitPython_MONSTERM4SK to 0.3.0 from 0.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MONSTERM4SK#10 from FoamyGuy/pwmio_cp7_update

Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel to 6.2.1 from 6.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_NeoPixel#116 from adafruit/anecdata-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_PCA9685 to 3.3.8 from 3.3.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_PCA9685#39 from FoamyGuy/pulseio_comment_update
  > Moved default branch to main

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1322 to 1.1.6 from 1.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1322#11 from lesamouraipourpre/pypi
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1327 to 1.3.1 from 1.3.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1327#11 from lesamouraipourpre/pypi

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1608 to 1.2.9 from 1.2.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1608#12 from lesamouraipourpre/pypi

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1680 to 1.0.3 from 1.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1680#3 from lesamouraipourpre/pypi

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1681 to 1.0.5 from 1.0.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1681#6 from lesamouraipourpre/pypi

Updating https://github.com/adafruit/Adafruit_CircuitPython_Slideshow to 1.7.0 from 1.6.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Slideshow#37 from FoamyGuy/pulseio_comment_update

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_DisplayIO_SSD1306, Adafruit_CircuitPython_SSD1322, Adafruit_CircuitPython_SSD1327, Adafruit_CircuitPython_SSD1608, Adafruit_CircuitPython_SSD1680, Adafruit_CircuitPython_SSD1681
@UnexpectedMaker
Copy link

@tannewt this change doesn't seem to be included in the neo pixel in frozen modules?
How do we make this happen?
Thanks!

@tannewt
Copy link
Member

tannewt commented Sep 2, 2021

Updated in adafruit/circuitpython#5288

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.

3 participants