Skip to content

Commit

Permalink
Merge pull request Aircoookie#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 and softhack007 committed Nov 28, 2024
1 parent 5ea9cb1 commit e914417
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 179 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 e914417

Please sign in to comment.