MCPcopy Create free account
hub / github.com/FastLED/FastLED / get_position

Function get_position

examples/FestivalStick/curr.h:412–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410
411
412FL_OPTIMIZATION_LEVEL_O0_BEGIN // Works around a compile bug in clang 19
413float get_position(uint32_t now) {
414 if (autoAdvance.value()) {
415 // Check if auto-advance was just enabled
416 // Auto-advance mode: increment smoothly from current position
417 float elapsedSeconds = float(now - lastUpdateTime) / 1000.0f;
418 float increment = elapsedSeconds * speed.value() *
419 0.3f; // Make it 1/20th the original speed
420 currentPosition = fl::fmodf(currentPosition + increment, 1.0f);
421 lastUpdateTime = now;
422 return currentPosition;
423 } else {
424 // Manual mode: use the dual slider control
425 float combinedPosition = positionCoarse.value() + positionFine.value() + positionExtraFine.value();
426 // Clamp to ensure we don't exceed 1.0
427 if (combinedPosition > 1.0f)
428 combinedPosition = 1.0f;
429 return combinedPosition;
430 }
431}
432FL_OPTIMIZATION_LEVEL_O0_END
433
434void fillFrameBufferNoise() {

Callers 1

loopFunction · 0.85

Calls 2

fmodfFunction · 0.85
valueMethod · 0.45

Tested by

no test coverage detected