81 views
in Embedded Wizard Studio by
Hi,

I'm trying to read a value from the main application and display it on UI. I have the following:

var string tempDistance = string(device.CurDistance,0,1) + " mm";

which displays the " mm" part, but the variable is not displayed. It should work(?) as I've tested the following:

if (device.CurDistance > 10.0)
  temp = "DISTANCE ACQUIRED!"
else
  temp = "DISTANCE NOT ACQUIRED!";

which correctly switches between "DISTANCE ACQUIRED" and "DISTANCE NOT ACQUIRED".

Any idea what might be going on? I'm extremely new to embedded wizard, so excuse my confusion...

Br

1 Answer

0 votes
by
 
Best answer
After investigating the generated code, the bug was caused by EwStringAnsi() called in EwNewStringFloat().

For some reason, the following check was run:

  /* aAnsi string was empty? -> return Null string */
  if ( !str )
    return 0;

Not sure why this happens, but I fixed it with replacing EwNewStringFloat() with EwNewStringInt(). I'm running an old version of EW (8.30), so perhaps this has been fixed in newer versions.

Br

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

...