update widgets and loop

Hello

I have little problem with my application.

Firt I create widow and some widgets
Second call function: do_operations

void do_operations(…)
{
while(…)
{
//
//some operations
//

      change_widget(w);

      //
      //some operations
      //

      delay(200);
 }

}

void change_widget(PtWidget_t * w)
{
//operation on widget w
PtSetResource(w, …);
}

Unfortunately all changes from change_widget() are visualized where lopp is finished.
But I want to change widgets one by one (with interval 200ms).
Any suggestions?

vitor “unexperienced”

PtFlush() repairs widgets immediately instead of waiting on a photon timer to do it

PtFlush();
delay(200);

Note: If you do not call delay()

  1. your application has priority higher than Photon:
    and keeps on consuming processor time, then widgets will get “repaired” on loop finish
  2. your application has priority lower than Photon:
    then photon has enough priority to execute its “repair” code on PtFlush() call

THe Photon programming environment is event driven. Although you can queue work in the callback, the work gets done when the photon main loop takes over. Perhaps if you explain what you are trying to do, we can explain a different approach to achieve it.

A different way to look at it is that every photon call just enqueues work - doesn’t actually do anything - until you finish your function and return to the main loop.

Rick…