const const const

small speedup by declaring some functions "const"
This commit is contained in:
Frank
2024-11-24 17:45:25 +01:00
parent 61c2ba98b7
commit ce8fc8930e
4 changed files with 8 additions and 8 deletions

View File

@@ -311,7 +311,7 @@ void Segment::setUpLeds() {
}
}
CRGBPalette16 &Segment::loadPalette(CRGBPalette16 &targetPalette, uint8_t pal) {
CRGBPalette16 &Segment::loadPalette(CRGBPalette16 &targetPalette, uint8_t pal) const {
static unsigned long _lastPaletteChange = millis() - 990000; // perhaps it should be per segment //WLEDMM changed init value to avoid pure orange after startup
static CRGBPalette16 randomPalette = CRGBPalette16(DEFAULT_COLOR);
static CRGBPalette16 prevRandomPalette = CRGBPalette16(CRGB(BLACK));
@@ -452,7 +452,7 @@ void Segment::startTransition(uint16_t dur) {
}
// transition progression between 0-65535
uint16_t IRAM_ATTR_YN Segment::progress() {
uint16_t IRAM_ATTR_YN Segment::progress() const {
if (!transitional || !_t) return 0xFFFFU;
unsigned long timeNow = millis();
if (timeNow - _t->_start > _t->_dur || _t->_dur == 0) return 0xFFFFU;