Skip to content

Arduino Zero millis() and FastLED.delay() are 4x slower with WS2812B #633

Closed

Description

@lights0123

I have started to play around with the native FastLED support for the Arduino Zero (instead of using FastLED's math with Adafruit's ZeroDMA). I loaded the ColorPalette example, and noticed that the framerate and update frequency were ¼ of the actual speed. Changing FastLED.delay(1000 / UPDATES_PER_SECOND); to FastLED.delay(1000 / UPDATES_PER_SECOND / 4); and uint8_t secondHand = (millis() / 1000) % 60; to uint8_t secondHand = (millis() *4 / 1000) % 60; resolved the issue. This only occurs when FastLED is being constantly updated: changing FastLED.delay to delay resulted in exactly 1 FPS, not ¼ FPS.

This issue occured with a strip of 240 WS2812Bs and an off-brand Arduino Zero using the same board definition and bootloader.

Activity

  1. jeremyste commented on Dec 7, 2018

    @jeremyste

    I can confirm this as well. I have 200 LEDs and noticed a delay of about 3x what it should be. I suspect this is because FastLED.show() is disabling interrupts while shifting out data and thus millis() is not being updated. I compensated in my code in a similar way to the above.

  2. focalintent commented on Jan 20, 2019

    @focalintent
    Contributor

    Yeah - the SAMD code doesn't attempt to try to fix the clock - if interrupts are enabled then millis should update as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions