FastLED 3.9.15
Loading...
Searching...
No Matches

◆ get_position()

FL_OPTIMIZATION_LEVEL_O0_BEGIN float get_position ( uint32_t now)

Definition at line 413 of file curr.h.

413 {
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}
uint16_t speed
Definition Noise.ino:66
fl::UICheckbox autoAdvance("Auto Advance", true)
static float currentPosition
Definition curr.h:250
fl::UISlider positionFine("Position Fine (1x)", 0.0f, 0.0f, 0.1f, 0.001f)
static uint32_t lastUpdateTime
Definition curr.h:251
fl::UISlider positionExtraFine("Position Extra Fine (0.1x)", 0.0f, 0.0f, 0.01f, 0.0001f)
fl::UISlider positionCoarse("Position Coarse (10x)", 0.0f, 0.0f, 1.0f, 0.01f)
float fmodf(float x, float y) FL_NOEXCEPT
Definition math.h:336

References autoAdvance(), currentPosition, fl::fmodf(), lastUpdateTime, positionCoarse(), positionExtraFine(), positionFine(), and speed.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: