String Conversion Issues
Posted: Sun Nov 06, 2022 2:29 pm
Hi All,
I am having 2 issues which I want to ask help please
I am reading in a string on the UART then I split the stings and take out the different strings and then convert the strings into float numbers
my problem is when the substring is a positive value it converts correctly however when the string contains a negative then it converts incorrect
example "001.10" Convert correctly as below
Here we can see the same sting now negative "-001.10" results in -429496xxx
What am I doing wrong
The String RX_Data contains the string send by the instrument I am communicating with .RX_Data is declared as an String in FC.
I am also a bit confused in using that receive ByteArray macro from the UART component, I delare a byte array when I sue it in the macro parameters it generates an error as below Also here what am I doing wrong
Appreciate all help pointers as always
Peter
I am having 2 issues which I want to ask help please

I am reading in a string on the UART then I split the stings and take out the different strings and then convert the strings into float numbers
my problem is when the substring is a positive value it converts correctly however when the string contains a negative then it converts incorrect
example "001.10" Convert correctly as below
Here we can see the same sting now negative "-001.10" results in -429496xxx
What am I doing wrong

I am also a bit confused in using that receive ByteArray macro from the UART component, I delare a byte array when I sue it in the macro parameters it generates an error as below Also here what am I doing wrong

Appreciate all help pointers as always

Peter