562 views
in System Integration by
Good evening everybody,

I'm having the issue, that Views::Text doesn't change content to dynamic updates.

The integration works like this:

The application cyclically triggers the GUI to poll actual parameter values.

Therefore, I have created a SystemEvent in the DeviceInterface and a custom button, which owns a System event handler, pointing to SystemEvent - so far this works without problems.

In the slot of the System event handler, I'm polling via native statement values from my C application - so far this works.

The cycle time is 100ms @ which polling happens (System is AM4378).

After polling the value to the property "value", the OnSet is triggered and converts the int32 into a string.

The problem is, that EwNewStringInt returns NULL and as a result, the Views::Texts remains empty.

Thank you for your help,

with best regards,

Stefan Wagner
by
An important addition: in prototyper string building is successful and Views::Text reacts on value changes as needed.

 

Thanks,

Best regards,

Stefan

1 Answer

0 votes
by

Hello Stefan,

just a few ideas without seeing your implementation:

1.) Is there an error message during runtime reporting that something is going wrong? If yes, please let us know.

2.) I assume that your DeviceInterface class is accessed as autoobject in your application.
Please consider the livetime of autoobjects. Everytime, the autoobject is no more in use, the instance will be deleted by the Garbage Collector. When the timer triggered polling happens, a new instance of the device class will be created. Within the Prototyper on PC, the Garabage Collector is running after a couple of seconds - this could explains, why you get the expected value within the Prototyper. 
In order to prevent the Garbage Collector from freeing an autoobject, please add a variable to the root class, set the type to your class Application::Device and the value to the instance (autoobject) of the class. 

3.) Otherwise, please let us know the code that you are using with EwNewStringInt() or EwNewStringFloat() - that does not work as expected.

Best regards,

Manfred Schweyer.

by

Good morning Mr. Schweyer,

please see following screenshot from Debug console:

Debug console

You can see there, that I pass a value (250) to the string function and I get a string (disp) back.

Next, it's passed Views::Text.String but the display content is not changed / update, although the value clearly differs from the previous one.

In EmWi prototyper, this works without any problems. Also initial values are always shown. The problem persists with values changed during runtime.

 

Thank you,

with best regards,

Stefan

 

by
Hello Stefan,

can you post the Chora code of the method OnSetValue() of the class CustomClasses::ParameterButton_linked?

Best regards,

Manfred.
by

Hello Manfred,

 

thanks for prompt reply.

Here the Chora code for OnSetValue() :

var string disp = "";

// The value doesn't change - nothing to do.
if ( pure Value == value )
  return;                
// Remember the property's new value.
pure Value = value;     

SetPar(ParGroup, ParID, pure Value);      //this method interfaces by native code with device and sets Value in device --> this works

disp = string(value);                               //Build string from integer value --> this works

EditWindow.String = disp;                      //Pass string to instance of Views::Text inside CustomClasses::ParameterButton_linked --> Views::Text doesn't change displayed string

 

 

Thank you,

best regards,

Stefan

by

Hello Stefan,

can you please add a

trace disp;

statement within the last line and check what is printed on the console (via serial connection) from your target?

By the way: Are there any error messages reported?

Another idea: Did you modify the main loop so that the signals are not handled properly? I'm asking this because the Views::Text items update the content triggered by a postsignal.

Best regards,

Manfred.

by

Hello Manfred,

thank for the hints.

I added "trace disp;" to the Chora code in EmWi and the console print is:

[Display] FPS 2813.4
[Display] FPS 2803.3
[OK]
Run RTOS...    [OK]
SetPhyMode:000021e1 Auto:1, FD10:1, HD10:1, FD100:1, HD100:1, FD1000:1 LPBK:0
LCD data found in EEPROM
Initialize Graphics Engine...                [OK]
Create EmWi Root Object...                   [OK]
Create EmWi Viewport...                      [OK]
File size=488576
ENETPHY_FindingState: PhyNum: 1
ENETPHY_DisablePhy(1)
Enable Phy to negotiate external connection
NWAY Advertising: FullDuplex-1000 FullDuplex-100 HalfDuplex-100 FullDuplex-10 HalfDuplex-10
[Display] FPS 1913.3
trace: 250
[Display] FPS 1701.1

Next thing I did is, that I placed a breakpoint inside "ViewsText_OnSetString" and I can verify, that the OnSet itself is working:

Going further, the processor runs into "EwPostSignal":

Going further happens without any error "Err03" posted.

This is the object posted:

So I can confirm, that the reaction incl. sending the "Postsignal" is working:

The previous object posted shows up in the processing function for signals:

 

 

Furthermore, here is the cyclic code for Visualization handling:

************************************ CODE START ***************************************

/* receive touch inputs and provide the application with them */
    if ( GUITouch_GetTouchPosition( &touchPos ))
    {
          /* Convert values to screen abs - no calibration*/
        touchPosRet.X = touchPos.X;
        touchPosRet.Y = touchPos.Y;

        /* begin of touch cycle */
        if ( touched == 0 )
            CoreRoot__DriveCursorHitting( rootObject, 1, 0, touchPosRet );

        /* movement during touch cycle */
        else if ( touched == 1 )
            CoreRoot__DriveCursorMovement( rootObject, touchPosRet );

        touched = 1;
    }
    /* end of touch cycle */
    else if ( touched == 1 )
    {
        CoreRoot__DriveCursorHitting( rootObject, 0, 0, touchPosRet );
        touched = 0;
    }

    /* process expired timers */
    timers = EwProcessTimers();

    /* process the pending signals */
    signals = EwProcessSignals();

    /* refresh the screen, if something has changed and draw its content */
    if ( timers || signals )
    {
        Update( viewport, rootObject );

        /* after each processed message start the garbage collection */
        EwReclaimMemory();

    /* show the memory statistic */
#ifdef EW_PRINT_MEMORY_USAGE
    EwPrintProfilerStatistic( 0 );
#endif
    }



************************************ CODE END ***************************************

The postsignal are processed, since other OnSet methods are working without problems.

Are stepping in debug confirmed that.

Thanks,

best regards,

Stefan

by

Hi Stefan,

o.k. so far everything seems fine - only the update is missing...

However, the main loop is not up-to-date, please try the following:

************************************ CODE START ***************************************
    int    events  = 0;
    int    timers  = 0;
    int    signals = 0;
    int    devices = 0;

    /* receive touch inputs and provide the application with them */
    if ( GUITouch_GetTouchPosition( &touchPos ))
    {
          /* Convert values to screen abs - no calibration*/
        touchPosRet.X = touchPos.X;
        touchPosRet.Y = touchPos.Y;

        /* begin of touch cycle */
        if ( touched == 0 )
            events |= CoreRoot__DriveCursorHitting( rootObject, 1, 0, touchPosRet );

        /* movement during touch cycle */
        else if ( touched == 1 )
            events |= CoreRoot__DriveCursorMovement( rootObject, touchPosRet );

        touched = 1;
    }
    /* end of touch cycle */
    else if ( touched == 1 )
    {
        events |= CoreRoot__DriveCursorHitting( rootObject, 0, 0, touchPosRet );
        touched = 0;
    }

    /* process expired timers */
    timers = EwProcessTimers();

    /* process the pending signals */
    signals = EwProcessSignals();

    /* Update screen and memory, only if something has changed */
    if ( devices || timers || signals || events )
    {
      if ( CoreRoot__DoesNeedUpdate( rootObject ))
        Update( viewport, rootObject );

      /* after each processed message start the garbage collection */
      EwReclaimMemory();
    }


************************************ CODE END ***************************************

Does this change something in your application?

Best regards,

Manfred. 

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...