mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 08:46:34 +00:00
replaced &0xFFFF with explicit casts
This commit is contained in:
parent
503c68320a
commit
18c17168e1
@ -455,18 +455,18 @@ CRGBPalette16 IRAM_ATTR &Segment::currentPalette(CRGBPalette16 &targetPalette, u
|
|||||||
// relies on WS2812FX::service() to call it for each frame
|
// relies on WS2812FX::service() to call it for each frame
|
||||||
void Segment::handleRandomPalette() {
|
void Segment::handleRandomPalette() {
|
||||||
// is it time to generate a new palette?
|
// is it time to generate a new palette?
|
||||||
if (((millis()/1000U) & 0xFFFF) - _lastPaletteChange > randomPaletteChangeTime) {
|
if ((uint16_t)((uint16_t)(millis() / 1000U) - _lastPaletteChange) > randomPaletteChangeTime){
|
||||||
_newRandomPalette = useHarmonicRandomPalette ? generateHarmonicRandomPalette(_randomPalette) : generateRandomPalette();
|
_newRandomPalette = useHarmonicRandomPalette ? generateHarmonicRandomPalette(_randomPalette) : generateRandomPalette();
|
||||||
_lastPaletteChange = millis()/1000U; //take lower 16bits
|
_lastPaletteChange = (uint16_t)(millis() / 1000U);
|
||||||
_lastPaletteBlend = (uint16_t)(millis() & 0xFFFF)-512; // starts blending immediately
|
_lastPaletteBlend = (uint16_t)((uint16_t)millis() - 512); // starts blending immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
// if palette transitions is enabled, blend it according to Transition Time (if longer than minimum given by service calls)
|
// if palette transitions is enabled, blend it according to Transition Time (if longer than minimum given by service calls)
|
||||||
if (strip.paletteFade) {
|
if (strip.paletteFade) {
|
||||||
// assumes that 128 updates are sufficient to blend a palette, so shift by 7 (can be more, can be less)
|
// assumes that 128 updates are sufficient to blend a palette, so shift by 7 (can be more, can be less)
|
||||||
// in reality there need to be 255 blends to fully blend two entirely different palettes
|
// in reality there need to be 255 blends to fully blend two entirely different palettes
|
||||||
if ((millis() & 0xFFFF) - _lastPaletteBlend < strip.getTransition() >> 7) return; // not yet time to fade, delay the update
|
if ((uint16_t)((uint16_t)millis() - _lastPaletteBlend) < strip.getTransition() >> 7) return; // not yet time to fade, delay the update
|
||||||
_lastPaletteBlend = millis(); //take lower 16bits
|
_lastPaletteBlend = (uint16_t)millis();
|
||||||
}
|
}
|
||||||
nblendPaletteTowardPalette(_randomPalette, _newRandomPalette, 48);
|
nblendPaletteTowardPalette(_randomPalette, _newRandomPalette, 48);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user