Float unrecognized question
-
I'm becoming crazy on this datapoint,
Elevation position have to be an angle between 0 and 90 degrees,
due to some bug that actually I can't discover, it happens that I've a strange value in Elevation Position,
it seems to be 0 but it is notin my C code connected to mango via Modbus, I've the following patch:
#define EL_MAIN 0
#define NUM_OF_ELEVATION_AXES 2
float new_elevation_position[NUM_OF_ELEVATION_AXES] = { 0.0, 0.0 };
if (new_elevation_position[EL_MAIN] < 0.5f || new_elevation_position[EL_MAIN] > 89.5f){
----
}but the stm32 doesn't enter inside the IF, so , how I can understand the value inside elevation_position? By my point of view a float container can only produce numbers, so there's no way to do not fall inside the IF.
Please share me your suggestment, it is no possible for me to see the raw value because the board is about 4000kms far away from me.
Thanks,
Antonio -
Hang on, you're writing code into an STM32 but are unable to use the debugger to see the raw value?? Or do you mean you're trying to emulate the situation you are finding and cannot see why the stm32 won't work with your if statement?
In my experience of writing C, I either set the values for the array from initialisation, or the dimension of said array.
Sofloat new_elevation_position[] = { 0.0, 0.0 };
Should suffice, but that's just me.
First up, mango version, and check logs to see what's coming in to the system. See if you can catch any warnings or errors about incoming data.
Assuming this is modbus IP why not use wireshark to debug?
If it's not and it's serial, why not write a sniffer to log all raw data between the endpoint and mango?Looking at the value, it looks like it might be trying to display a control character and thus treating it as so.
From that deduction, are you certain the data fired is raw hex and not ascii?
You'd need 0x30 for a 0 which would fall outside of your if statement rules...
Otherwise, something's out of sync and thus you're receiving rubbish.Just throwing questions to get a better idea here...
Fox
-
Hi Fox and thanks for your answer,
the stm32 and it's mango are 400km away from me, I've not a so long cable to debug it using stlink, but maybe there's a way to do it over internet using openocd but I've to study about it, I was looking for a quick solution.
in Mango 2.8.8. the datapoint is defined asbut it is a float, I don't think it use character encoding Ascii.
It is modbus TCP.In any case I don't think it is a Mango problem but an STM32 FW bug because the datapoint is read_only.
For Mango just a bit of confuzione in the yellow fieldsFor me is important to undeestand the value that fall outside the IF statement
if (new_elevation_position[EL_MAIN] < 0.5f || new_elevation_position[EL_MAIN] > 89.5f){ ... bugManager(); }
-
Might be worth writing your own bridge to parse the data between the two systems.
Are you using an RTU encapsulation to talk to the stm32 or is it just TCP directly to it?Just thinking it would definitely be a better option than trying to talk to your micro and not brick anything....
Fox