2023-12-18 09:14 PM - edited 2023-12-19 10:59 PM
Hi @Romain DIELEMAN @Yoann KLEIN @JTP1 @Mohammad MORADI ESFAHANIASL ...Please guide.....
I'm in the process of developing a screen which takes input from main board and the down timer keeps ticking.
LED blinks until the progress bar fills.
The requirement for the LED is to blink when the progress bar is filling and become stable green once the down timer displays 0:00.
The calculation for the down timer is done inside handleTickEvent() and I get to know that the timer has reached 0:00 inside handleTickEvent() and this is how my code looks.
if (testDuration == 0) //To set LED intensity to stable green
{
StableRGB(GREEN);
}
else if ((tickCounter % 30) == 0) //To set LED intensity to blinking green
{
Solved! Go to Solution.
2023-12-20 12:58 AM
Hello @KNara.2 ,
You cannot use "Application::getInstance()->unregisterTimerWidget(this);" because it is used for registering and unregistering widgets not a View (or screen). So, you cannot stop receiving the tick and you have to change the logic of your code.
A simple solution would be to have a flag next to to your testDuration so, when it is called once you won't pass the condition again. Like this:
if (testDuration == 0 && !greenLEDIsOn) //To set LED intensity to stable green
{
StableRGB(GREEN);
greenLEDIsON = true;
}
else if ((tickCounter % 30) == 0) //To set LED intensity to blinking green
{
if ((BlinkingGREEN() != HAL_OK))
{
//Report error
}
}
I hope this helps, good luck
2023-12-18 11:39 PM - edited 2023-12-19 04:52 AM
In other words can somebody guide me how to stop the tick counter when the timer reaches 0:00.
I saw this post and tried adding this code in handleTickEvent()
This is giving me compilation errors.
Can we stop the receiving ticks every frame from handleTickEvent()?
2023-12-20 12:58 AM
Hello @KNara.2 ,
You cannot use "Application::getInstance()->unregisterTimerWidget(this);" because it is used for registering and unregistering widgets not a View (or screen). So, you cannot stop receiving the tick and you have to change the logic of your code.
A simple solution would be to have a flag next to to your testDuration so, when it is called once you won't pass the condition again. Like this:
if (testDuration == 0 && !greenLEDIsOn) //To set LED intensity to stable green
{
StableRGB(GREEN);
greenLEDIsON = true;
}
else if ((tickCounter % 30) == 0) //To set LED intensity to blinking green
{
if ((BlinkingGREEN() != HAL_OK))
{
//Report error
}
}
I hope this helps, good luck
2023-12-20 05:08 AM
Thank you so much @Mohammad MORADI ESFAHANIASL that worked.
2023-12-20 05:27 AM
Glad to hear, you're very welcome