BRT Community

General Category => Discussion - EVE => Topic started by: Cyrilou on February 24, 2021, 09:27:02 AM

Title: ESD with rtos threadx
Post by: Cyrilou on February 24, 2021, 09:27:02 AM
Hi,

We're migrating our monothread project on simple LCD display to EVE display.

I use 2 threads: one for display with EVE ESD project UI and an other for our own library. This library must send events info, data structures, event for displaying and synchronysing with UI thread.

For example our library must send an event to change of EVE page or to display or not some widgets.

There is no examples of this implementation/architecture.
How can I handle this easilly?

Regards
Title: Re: ESD with rtos threadx
Post by: Cyrilou on February 25, 2021, 02:19:11 PM
Is it would be a message queue like in guix?
Title: Re: ESD with rtos threadx
Post by: Kaetemi on March 10, 2021, 07:20:36 PM
In App.main, create an event slot named either "Idle" or "Update", and connect it to a C function that processes your message queue.

"Idle" will be called repeatedly when the ESD thread is waiting for EVE (frame swap, loading, etc.)
"Update" will be called once inbetween frames.

Depends on your requirements. "Update" is safest.
Title: Re: ESD with rtos threadx
Post by: Cyrilou on March 15, 2021, 08:51:43 AM
Hi , Thanks for this answer.

I use Update callback which is called here:
   ec->DeltaMs = ms - ec->Millis;
   ec->Millis = ms;
   Esd_GpuAlloc_Update(Esd_GAlloc); // Run GC
   Esd_TouchTag_Update(NULL); // Update touch
   if (ec->Update)
      ec->Update(ec->UserContext);<--callback

An other question I have is how much time can I allocate to scheduler for other thread execute (by tx thread sleep(time) instruction) without lock screen render? If I consider thread UI is the highest priority.
Title: Re: ESD with rtos threadx
Post by: Kaetemi on March 24, 2021, 01:39:47 AM
The screen update loop needs to run at least once per 16ms (that is, once per frame) to have smooth 60Hz UI updates.

Animations that run on the coprocessor (fullscreen video and progress spinners) don't require updates from the update loop, and remain smooth even if the update loop is blocked. (So you can use AVI video playback or the builtin progress spinners to entertain the user while doing heavy tasks on the mcu.)
Title: Re: ESD with rtos threadx
Post by: Cyrilou on April 07, 2021, 02:49:33 PM
So if I make a tx_thread_sleep(1) (one tick =10ms) in idle callback (when library poll cmdb_space) it is already too much! I must reduce tick time base.