mBlock v3.2.1 MeRGBLed::setColor library function bug


#1

Hello!

It seems an error there, in function MeRGBLed::setColor(index, value):
Instead:

bool MeRGBLed::setColor(uint8_t index, long value)
{
  if(index == 0)
  {
    for(int16_t i = 0; i < count_led; i++)
    {
      uint8_t tmp    = index * 3;
// ...

Must be:

bool MeRGBLed::setColor(uint8_t index, long value)
{
  if(index == 0)
  {
    for(int16_t i = 0; i < count_led; i++)
    {
      uint8_t tmp    = i * 3;    
// ...

Then index == 0, function not set color value to all LEDs.
Only for LED number 0, but count_led times.


#2

:wink:

… and if index of LED in range [1, count_led], then this condition

  // ..
  else if(index < count_led)
  // ..

must be

  // ..
  else if(index <= count_led)
  // ..