540 views
in GUI Development by

Hello,

I'm trying to use the Arc path as a RPM indication of a dashboard, 

I setup a timer to trigger a "ChangeRpm" slot every 100ms, below is my "ChangeRpm" code,

if ( 0 == ReverseFlag )
{
  RpmArc.EndAngle += 5;

  if ( RpmArc.EndAngle >= 320.0)
  {
    ReverseFlag = 1;
  }
}
else
{
  RpmArc.EndAngle -= 5;
  if ( RpmArc.EndAngle <= 90.0 )
  {
    ReverseFlag = 0;    
  }
}

Then when I start the prototyper, the front end of rpm arc is like jumping back and forth, please see the footage below.

https://ask.embedded-wizard.de/?qa=blob&qa_blobid=18363368457057052073

Could you advise how to solve this issue?

Regards,

Noah

1 Answer

0 votes
by
 
Best answer

Hello Noah,

I do not see any problems with your implementation and the video. What do you mean with "jumping back and forth"? What I observe is that the arc moves with large steps. This is caused because the single step is 5 degree. Maybe you can explain better the problem?

Best regards

Paul Banach

by

Hi Paul,

Please focus on the front end of the arc, it looks like blinking when it's moving. Do you think that's caused by the 5 degree step?

I have changed the step to 0.1 degree, it does look smoother, but it's not a acceptable moving speed.

If this issue is caused by a large step, do you have any suggestions to have a smooth and fast arc animation?

Regards,

Noah

by
Hi Noah,

can you provide more information about the issue? Is this within the Prototyper or on your target? In case of a target, please let us know more details about that...

Best regards,

Manfred..
by
Hi Manfred,

This is within the Prototyper.

Regards,

Noah
by
Hi Noah,

how does it appear on your target? Especially when you reduce the time of calling your ChangeRpm() slot method from 100ms to e.g. 15 ms?

Regards,

Manfred.
by

Hi Manfred,

This is how it looks like on my NXP RT1170-EVK, the time of calling ChangeRpm() slot method is 15ms, and the step is still 5 degree.https://ask.embedded-wizard.de/?qa=blob&qa_blobid=8522761385327951702

Regards,

Noah

by
Hello Noah,

according to the recorded videos, the step of 5 degree is too large. This will result in large changes of the screen content between two animation phases what we then perceive as not smooth animation. I would calculate with smaller steps.

Or, alternatively but more complex in implementation, you animate the transitions between two steps. This means, instead of changing abruptly the angle from e.g. 100 to 105 degree, you start an animation effect to run this transition within a short period.

Best regards

Paul Banach
by

Hello Noah,

also possible: use the Gauge widget. This widget implements the animation effect mentioned in the second part of my above answer. So when you make a large step, the transion between the old and the new position is animated automatically.

The Gauge widget can be configured according to your needs. For this information please see: Customize your own Gauge.

Best regards

Paul Banach

by
Hi Paul,

I would like to confirm one thing, when I reset the EndAngle of a arc, does the EW redraw the whole arc again?

Regards,

Noah
by

Hello Noah,

I'm not sure what you mean with 'reset', but each time after the value of the property EndAngle has been changed, the entire arc is recalculated again and the area occupied by the Stroked Path view is redrawn automatically. Does it answer your question?

Best regards

Paul Banach 

by
Hi Paul,

Thank you for your explanation, now I understand a large step would result in not smooth arc animation.

Regards,

Noah
by
Hi Paul,

Is the Gauge widget able to be configured to a non-circular appearance? maybe like an oval?

Regards,

Noah
by
Hello Noah,

the generic Gauge widget is restricted to be circular.

Best regards

Paul Banach

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

...