316 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...