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

added enable_dim_neopixel(), disable_dim_neopixel(), set_dim_level() #246

Merged
merged 6 commits into from
Sep 12, 2017

Conversation

asherlie
Copy link

@asherlie asherlie commented Sep 7, 2017

This adds 3 functions to the samd module for the user to control the behavior of the neopixel:

  • enable_dim_neopixel()
  • disable_dim_neopixel()
  • set_dim_level()

enable_dim_neopixel and disable_dim_neopixel turn on and off dim neopixel mode. set_dim_level takes in an integer from 0-255 and sets the brightness level of dim neopixel mode. The default brightness level for dim neopixel mode is 40. set_dim_level(0) will turn off the neopixel.

@tannewt
Copy link
Member

tannewt commented Sep 8, 2017

Looks like the test is failing because the code is too large for the Arduino Zero, Gemma M0 and Trinket M0. How about adding a single set_rgb_status_brightness to rgb_led_status.c and removing the enable/disable calls? 0 can disable and !=0 can enable implicitly.

@dhalbert
Copy link
Collaborator

dhalbert commented Sep 8, 2017

The 2.0.0-rc2 builds have only 56 bytes free on non-Express boards. You can get back some more space by lowering -finline-limit in the Makefile. -finline-limit=57 right now. Lower it only a few at a time (like 2-5), since it will cost a little performance somewhere.

@asherlie
Copy link
Author

asherlie commented Sep 8, 2017

I'll check it out tonight. I think I'll go the set_rgb_status_brightness route and not mess with the -finline-limit.

@dhalbert
Copy link
Collaborator

dhalbert commented Sep 8, 2017

I agree with @tannewt about the API, though with only 56 bytes left, you may still need to make room by fiddling with -finline-limit.

@asherlie
Copy link
Author

asherlie commented Sep 9, 2017

Oops. I'll fix this soon. Defined some variables in the wrong place relative to #ifdefs.

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.

Looks nearly there! Thanks!

One more change I'd like to see is that rgb_status_brightness be uint8_t. You'll need to check the value you get in samd_set_rgb_status_brightness to make sure its between 0 and 255 and throw a ValueError if its not.

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.

Looks good! Thank you!

@tannewt tannewt merged commit 5aa8922 into adafruit:master Sep 12, 2017
@asherlie asherlie deleted the dim_neopixel branch September 15, 2017 01:12
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