cancel
Showing results for 
Search instead for 
Did you mean: 

Clarification on model::tick

brianshankland9
Associate II

Am I correct in thinking that if I can only make changes to screen widgets from within the model::tick() function?

I had passed the model pointer out to the remainder of my hardware app so it could push new updated data as it happened, but even though I saw the view code run to update the widgets, after their invalidate the screen image did not change.

I did see a brief flash of the updated widget as the screen was switching to another one so it looks as if the change was happening but the refresh was not.

If Instead of getting the model to update the presenter/view immediately when told from the outside world I set an internal flag and then from within the model:;tick I checked the flag and called the presenter the updates worked.

So it looks as if the invalidate was not taking effect unless part of the model::tick call, is this correct?

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi @brianshankland9​,

Am I correct in thinking that if I can only make changes to screen widgets from within the model::tick() function?

Not exactly. The entire application is getting ticked, not just the model. This means Screens, Widgets that support animation. So, you could override the ::tick() method in your concrete View and even send that tick to custom widgets if you wanted.

You're right, though, that the model::tick() method is the place where you'd interface with other peripheral tasks and you'd then use the modelListener interface to update the currently active Screen. So, you don't have to pass model pointers around if you're using multiple OS tasks.

And ultimately, yes, the application must be ticked for the screens to render to the framebuffer. It does not matter how much you invalidate() - It's all driven by the tick.

Hope that helps

Best regards,

Martin

View solution in original post

2 REPLIES 2
Martin KJELDSEN
Chief III

Hi @brianshankland9​,

Am I correct in thinking that if I can only make changes to screen widgets from within the model::tick() function?

Not exactly. The entire application is getting ticked, not just the model. This means Screens, Widgets that support animation. So, you could override the ::tick() method in your concrete View and even send that tick to custom widgets if you wanted.

You're right, though, that the model::tick() method is the place where you'd interface with other peripheral tasks and you'd then use the modelListener interface to update the currently active Screen. So, you don't have to pass model pointers around if you're using multiple OS tasks.

And ultimately, yes, the application must be ticked for the screens to render to the framebuffer. It does not matter how much you invalidate() - It's all driven by the tick.

Hope that helps

Best regards,

Martin

Thanks for feedback, I had always thought that an internal tick would be doing “lots under the hood�?. From what you say I should be able to update a text wildcard buffer, invalidate the widget then on the next tick the screen will get updated so my model::tick function could be empty. This was how I understood your system, but what I’m seeing is that if I perform the update from any code other than from within the model::tick (ie from another thread) then the screen is not getting updated even though the wildcard textbuffer has the new value. This is not a problem for me as I have just made my other threads update variables in the model and set “dirty�? flags so on the next model::tick the presentations are being called to perform the update and all is working. I was really just interested since the documentation did not explicitly say it had to be so if it was I was going to suggest a clarification, but maybe my system is not doing it right somehow. regards _________________________________________________­_ Brian Shankland Icon Research Ltd 3 Raw Holdings | East Calder | West Lothian | EH53 0HY | UK T: +44 1506 885000 Ext 226 F: +44 1506 885501 www.iconresearch.co.uk<>