LedFlash routine


#1

Hi,
adding the duration parameter to the led flash routine returned a strange effect.

I changed the duration from zero to 100 msec to have a shorter flash effect

  // Flash all LEDs from a value of 255 to 100, frequency 20Hz, 100ms duration
  blue.flash(255, 100, 20, 100);
  red.flash(255, 100, 20, 100);
  green.flash(255, 100, 20, 100);

Now if you do the effect, you see that after the flash, the blue led is OFF and the green and red leds are at the normal brightness value, until the audio file is played, then it returns to normal.

I hid the problem changing the code from
while (fx.playing())

to

while (blue.withEffect())

But my concern is on the core routine.

Giulio


#2

Hi @Mangaman
Let me check into this and get back to you.


#3

Hi @Mangaman,

This is a bug that we will fix in the next version. Thank you for reporting this.

Try with this quick fix: locate the file ServiceTimer.cpp. Mine is in C:\Users\MyUser\AppData\Local\Arduino15\packages\artekit\hardware\stm32f4\1.0.0\cores\propboard\ServiceTimer.cpp where MyUser is the Windows username.

Replace the STObject::remove function with this code:

void STObject::remove()
{
	__disable_irq();

	if (stList == this) {
		stList = this->next;
	} else {
		STObject *prev, *list;
		prev = stList;
		list = stList->next;

		while (list && list != this)
		{
			prev = list;
			list = list->next;
		}

		if (list)
			prev->next = this->next;

		this->next = NULL;
	}

	__enable_irq();
}

The code other than be corrected should also be improved.

Another thing. You still have to do the while (blue.withEffect()) trick because when the flash effect ends, the LEDs will go off. You should launch your shimmer routine again. Perhaps the flash LED effect should end with the off value passed to the HBLED::flash function instead of ending with fixed a value of zero.


[BETA] Known issues, TBDs and feature requests
#4

Hi @Ivan,
thanks for the routine modification.
It works as you explained.
I have to add a shimmer call again to make it restart in time.