Skip to content

- added a few methods to accept an offset parameter - #464

Closed
tweep wants to merge 1 commit into
FastLED:masterfrom
tweep:01_add_offset_to_colorutils
Closed

tweep wants to merge 1 commit into
FastLED:masterfrom
tweep:01_add_offset_to_colorutils

Conversation

@tweep

@tweep tweep commented Jun 9, 2017

Copy link
Copy Markdown

this is useful if you keep all your LEDs in a single, large array.
I do this to save dynamic memory - because I have LED strands with
different lengths; declaring a two-dimensional LED matrix will
reserve too much memory; so i put them all in one single one-dimensional
array
New methods which accept an "offset parameter" are :

  • fill_solid
  • fill_rainbow
  • fadeToBlackBy
  • nscale8

  this is useful if you keep all your LEDs in a single, large array.
  I do this to save dynamic memory -  because I have LED strands with
  different lengths; declaring a two-dimensional LED matrix will
  reserve too much memory; so i put them all in one single one-dimensional
  array
  New methods which accept an "offset parameter" are :
  - fill_solid
  - fill_rainbow
  - fadeToBlackBy
  - nscale8
@mikeburg

mikeburg commented Jun 9, 2017

Copy link
Copy Markdown

Hi,

Is there any reason why you could not simply pass the pointer to starting offset led to these routines?

Example: fill_solid(&leds[offset], count, CRGB::Green);

-- Michael

@focalintent

Copy link
Copy Markdown
Contributor

leds + offset should also work.

This area of the library is due for a major overhaul to make use of the pixel sets, which will change up all of this - but make doing things like this far easier :)

@MFornander

Copy link
Copy Markdown

Like @mikeburg said, this can literally by done by replacing "buffer" with "buffer+offset" in any method. I don't think we need to add an argument here.

@tweep

tweep commented Jun 9, 2017

Copy link
Copy Markdown
Author

Ooops, my bad; pointers work of course.

Thanks !

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.

4 participants