Skip to content

Commit

Permalink
Merge pull request #4181 from DedeHai/0_15_trig_math
Browse files Browse the repository at this point in the history
Added integer based `sin()/cos()` functions, changed all trig functions to wled_math
  • Loading branch information
DedeHai authored Nov 27, 2024
2 parents b83f0f4 + fa4c23b commit 92e59af
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 168 deletions.
4 changes: 2 additions & 2 deletions usermods/Analog_Clock/Analog_Clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class AnalogClockUsermod : public Usermod {

void secondsEffectSineFade(int16_t secondLed, Toki::Time const& time) {
uint32_t ms = time.ms % 1000;
uint8_t b0 = (cos8(ms * 64 / 1000) - 128) * 2;
uint8_t b0 = (cos8_t(ms * 64 / 1000) - 128) * 2;
setPixelColor(secondLed, gamma32(scale32(secondColor, b0)));
uint8_t b1 = (sin8(ms * 64 / 1000) - 128) * 2;
uint8_t b1 = (sin8_t(ms * 64 / 1000) - 128) * 2;
setPixelColor(inc(secondLed, 1, secondsSegment), gamma32(scale32(secondColor, b1)));
}

Expand Down
Loading

0 comments on commit 92e59af

Please sign in to comment.