cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX does not invalidate the image whose visibility state has changed

SPozz.1
Associate III

Hello,
My TouchGFX application (without an operating system) receives events from a communication channel, and in some cases, there are icons on the screen that need to change visibility based on the received state. The events are acquired during the normal polling cycle of the application. When, for example, an alarm arrives, the icon with the exclamation mark is displayed in this way:

 

void sHomeView::updateErrorView(bool error)
{
    imgCommErr.setVisible(error);
    imgCommErr.invalidate();
}

 

But invalidation does nothing; the screen portion is not redrawn.
The invalidation is not lost; it remains latent until another successful redraw event is triggered — for example, if a button is tapped, the imgCommErr object is also redrawn, as are any other objects that are in the same abnormal state.
To get it working as expected I need to call invalidation in this way:

 

static bool needToInvalidate = false;
static bool visibility = false;

void sHomeView::onTick()
{
    if (needToInvalidate)
    {
        needToInvalidate = false;
        imgCommErr.setVisible(visibility);
        imgCommErr.invalidate();
    }
}

void sHomeView::updateErrorView(bool error)
{
    visibility = error;
    needToInvalidate = true;
}

 

Why does invalidate only work when it is apparently synchronized with the screen refresh?
Best regards,
Stefano

4 REPLIES 4
GaetanGodart
ST Employee

Hello Stefano,

 

I am not able to reproduce the issue.

Can you share your project?

Also, can you tell us what software version you are using and what board you are using?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
SPozz.1
Associate III

Hello Gaetan,
board is custom, based on STM32U599VJT6.
The project is not shareable and will not work without the appropriate hardware.
TouchGFX 4.24.2

STM32CubeIDE Version: 1.17.0
STM32CubeMX 6.13.0
All packages are up to date

I'm sure I saw the same problem months ago also on STM32H723ZGT6

I will try to replicate the problem on a STM32F769 discovery kit (B-LCD40DSI1). But this will take long time as I am very busy with other projects.

Regards,
Stefano

You dont show how is called your update, but primary TGFX have some rules how it work, and you simply require accept and use .

SPozz.1
Associate III

simplified code....

 

static Model* model = nullptr;
Model::Model() :
   modelListener()
{
    model = this;
}

 

during main polling, the communication engine can trigger set_comm_status in the event of a status change.

 

extern "C" void set_comm_status(uint8_t unit_index, bool error) { model->setCommStatus(unit_index, error); }

void Model::setCommStatus(int unitIndex, bool error)
{
...
    if (modelListener != 0)
    {
         ModelEvent* ev = new ModelEvent(ModelEvents::Comm);
...
         ev->hasError = error;
...
         modelListener->onModelEvent(ev);
         delete(ev);
    }
}

 

 in the active screen:

 

void sHomeView::onModelEvent(ModelEvent* ev)
{
...
    updateErrorView(ev->haveErrors);
...
}

 

Whenever a screen becomes active, it can subscribe to model events.
While I understand that this approach doesn't quite fit the MVP pattern, I don't understand why an invalidated region still isn't updated instead of keeping the invalidation flag latent in memory.