soundstorm / esphome_led_effects

Effects Selection for ESPhome addressable Lights like WS2812 with lambdas
GNU General Public License v3.0
33 stars 9 forks source link

When trying to compile your fireplace.yaml effect, I am getting compilation errors. #3

Open derekyle opened 1 year ago

derekyle commented 1 year ago

error: 'random8' was not declared in this scope; did you mean 'random'?

error: 'scale8_video' was not declared in this scope

error: 'qadd8' was not declared in this scope

Are the 3 errors I get. Are there some missing dependencies that I should be including?

derekyle commented 1 year ago

Actually, I figured it out. It looks like those functions are only available on the FastLed platform, which is deprecated. But I was able to get it to work by downgrading the arduino platform version and setting to FastLed.

soundstorm commented 1 year ago

I just merged the PR by @dvv, maybe he can adjust that to work with builtin functions.

dvv commented 1 year ago

Please try with below header.

#pragma once

#ifndef FASTLED_INTERNAL
uint8_t qadd8( uint8_t i, uint8_t j)
{
  unsigned int t = i + j;
  if( t > 255) t = 255;
  return t;
}

uint8_t scale8_video( uint8_t i, uint8_t scale)
{
  uint8_t j = (((int)i * (int)scale) >> 8) + ((i&&scale)?1:0);
  // uint8_t nonzeroscale = (scale != 0) ? 1 : 0;
  // uint8_t j = (i == 0) ? 0 : (((int)i * (int)(scale) ) >> 8) + nonzeroscale;
  return j;
}
#endif