cancel
Showing results for 
Search instead for 
Did you mean: 

ScrollWheel used counter (slot machine style) problem on downcounting

DVill
Associate II

Hi,

I'm using a ScrollWheel as counter for a slicer.

The scrollwheel has 5 item with 3 drawable in customcontainers with textarea.

It has 2 member values, the actual value and the set value. 

I overrided the UpdateItem callback to dinamically update the scrollwheel drawable for visualization as well as wheelAnimationEnd to update the current value during animation.

I have declared a function that set the new value to display in the counter and fires the animation to.

When called, it starts the animation transition rolling on all the number between the one it has at the beginning to the one used in the call.

The scroolwheel in always centered at position 2.

The code dinamically updates the wheel to have always the correct value displayed.

It works fine upcounting, not in downcounting.

When downcounting it stop always one before the desidered.

The internal value correctly reaches the set value in both directions but not the displayed when downcounting.

Something went wrong during the UpdateItem, only in downcounting and related to touchgfx management....

I attached the idleview files......

Have any idea about it?

It's a good solution or it works in upcounting 'cos I'm lucky?

Thank guys.

 

 

11 REPLIES 11
LouisB
ST Employee

Hello @DVill,

It's hard to understand what happens with only theses files, have you tried to debug and check if the invalidation is done correctly ?

BR,

Louis BOUDO
ST Software Engineer | TouchGFX

Hi,

thanks for your response first of all.

Yes, I debugged both on target (my board) as well as in simulator (via visual studio 2022) and what I saw is the following.

The strange behaviour is on rolling back to lower values starting from bigger value.

For example: you have displayed "10" and you set the value "0".

At the beginning you see a correct animation decreasing "10"->"9"->"8"...."1".

But on the last calling of onWheelAnimationEnded something strange happens:

"0" is initially showed, so it seems to be fine,

but on the last calling of  animateToItem(2, 0) which ends all the iteration, "1" is showed.

This last animateToItem(2, 0) (when _slicesDone is 0) in onWheelAnimationEnded, raises as designed the whSlicesUpdateItem call back, but the "item" passed has value "3", where I supposed it should be "2" ,so the "0" value is placed in the wrong place.

I checked manually rolling upwards  and I have another "1", and after "2","3","4".... so "0" updates in the wrong place.

What can I do to make it more clear?

Best regards and thank you.

So what you have is something like :

9 -> 8 -> 7 ... -> 1 -> 0 -> 1 ?

Have you tried to do a manual invalidation at the end ?

Louis BOUDO
ST Software Engineer | TouchGFX

Hi,

Yes, I have the sequence you wrote.

During a step by step simulation "0" appears before the last animateToItem(2, 0). After the last call "1" appears where it should be "0", because the last updateitem has a "item" parameter equal to "3" instead "2" (the one passed to animateToItem): "0" is in item 3 but the animateToItem is set to 2.

Yes, I tried to invaldate but nothing changed....

I think that calling animateToItem in a call back is not a good way to manage my use case....

Thanks. 

Maybe can you send the project so I can test it ?

Louis BOUDO
ST Software Engineer | TouchGFX

Hi, 

It will be great! But I don't know how to share it with you, because the whole project it's very big.

I'm using IAR for my project.

What files do you really need?

Thanks.

Hello,

Can you use this git ignore file ? So you then you only send me the important stuff ,

# CubeMX
.mxproject
backup_*.ioc

# TouchGFX
TouchGFX/*_backup.touchgfx
TouchGFX/build/
TouchGFX/config/
TouchGFX/generated/
TouchGFX/simulator/
TouchGFX/target.config
Middlewares/ST/touchgfx/
Middlewares/ST/touchgfx_components/
Middlewares/ST/touchgfx_backup*/
gcc/components.mk

# IAR
EWARM/settings/
EWARM/STM32*/
EWARM/*.dep
EWARM/*.ewt
EWARM/*.ipcf
EWARM/*.custom_argvars

# CubeIDE
STM32CubeIDE/.settings/
STM32CubeIDE/Debug/
STM32CubeIDE/Release/

# Keil
MDK-ARM/RTE/
MDK-ARM/STM32*/
MDK-ARM/DebugConfig/
MDK-ARM/*.lst
MDK-ARM/*.out
MDK-ARM/*vguix.*

# CMake
build/


BR,

Louis BOUDO
ST Software Engineer | TouchGFX
DVill
Associate II

Hi Louis,

I reproduced my problems in a simplier touchgfx app, reducing the whole size to the only simulator files.

All about my problems with scrollWheel are in this version as well. So you can debug it in Visual Studio via solution stored in .\simulator\msvs.

I think it's a good trade-off and I hope it is good for you, as well.

I'm using TouchGFX 4.23.2. and VS2022.

Thanks for your time.

Best regards.

 

LouisB
ST Employee

Hello @DVill,

I took a look at your project and the function is not supposed to be use control the value of the items. It's just to pass the value to the item. 
A solution is to set number of items to "10 000" in designer and use the code below :

#include <gui/main_screen/MainView.hpp>
#include "BitmapDatabase.hpp"
#include "texts/TextKeysAndLanguages.hpp"

MainView::MainView() :
    scrollWheel1AnimationEndCallback(this, &MainView::scrollWheel1AnimationEndHandler)
{
    scrollWheel1.setAnimationEndedCallback(scrollWheel1AnimationEndCallback);
    _val = 0;
    _lock = false;
    
}

void MainView::setupScreen()
{
}

void MainView::scrollWheel1UpdateItem(textContainer& item, int16_t itemIndex)
{
    item.updateText(itemIndex);
}

void MainView::tearDownScreen()
{

}

void MainView::IncData()
{
    if (_lock == false)
    { 
        _lock = true;
        scrollWheel1.animateToItem((scrollWheel1.getSelectedItem())+1, 50);

    }
}

void MainView::DecData()
{

    if (_lock == false)
    { 
        _lock = true;
        scrollWheel1.animateToItem((scrollWheel1.getSelectedItem())-1, 50);
    }

}

void MainView::scrollWheel1AnimationEndHandler()
{
    _lock = false;
}


Not 10000 items will be create, its just for the list to know the indexes.
BR,

Louis BOUDO
ST Software Engineer | TouchGFX