423 views
in System Integration by

We are using EmbeddedWizard 8.3 on an STM32f429 project on bare metal with a GUI consisting of various screens, some of which have a SlideTouchHandler hooked up to a VerticalList. We use these to set things such as hours and minutes. When starting to scroll an item, there is an initial delay before scrolling starts.This problem also occurs when scrolling widgets vertically or horizontally. We are using double buffering for the display.

 Currently we are using the code below, which is called during the idle time of the rest of the application:

    /* receive touch inputs and provide the application with them */
    if ( EwBspGetTouchPosition( &touchPos ))
    {

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

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

      touched = 1;
      events  = 1;
    }
    /* end of touch cycle */
    else if ( touched == 1 )
    {

      CoreRoot__DriveCursorHitting( rootObject, 0, 0, touchPos );
      touched = 0;
      events  = 1;
    }
    
    /* process expired timers */
    timers = EwProcessTimers();

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

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

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

      /* print current memory statistic to serial interface - uncomment if needed */
      /* EwPrintProfilerStatistic( 0 ); */
    }
    /* otherwise sleep/suspend the UI application until a certain event occurs or a timer expires... */
    else
    {
      EwBspWaitForSystemEvent( EwNextTimerExpiration());
    }

 

I can reduce the delay significantly if I replace the EwBspWaitForSystemEvent( EwNextTimerExpiration()); with a simple delay of 2 ms (HAL_Delay(2)).

My questions are:

1. Is it OK to replace EwBspWaitForSystemEvent( EwNextTimerExpiration()); with a simple delay? All that EwNextTimerExpiration() does is return the next timer expiry and EwBspWaitForSystemEvent() waits a maximum ot 10ms.

2. Are there any other things I can do to reduce the scolling lag?

1 Answer

0 votes
by
Hello,

of course, you can reduce the EwBspWaitForSystemEvent() to a simple delay with 1 ms as long as you are running bare metal. The function EwBspWaitForSystemEvent() is intended to be used in combination with an operating system to use the CPU time for other tasks until the next timer expires.

In case you have still some delays during the scrolling, you can check the following:

- Is the touch driver blocking for some time?

- Does your other software (drivers, middleware, ...) block the CPU for several milliseconds?

In such cases it is always the question, if the GUI animation itself is too slow or if the system does not give the UI the opportunity to update continuously.

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

...