Commit 9a7461bc authored by Mikhail Karpenko's avatar Mikhail Karpenko

Fix number conversion error

parent f9fd4fe2
...@@ -310,7 +310,8 @@ function parseIMU ($arr32){ ...@@ -310,7 +310,8 @@ function parseIMU ($arr32){
$temperatureScale=0.00565; // C/LSB $temperatureScale=0.00565; // C/LSB
$t=($arr32[15] & 0xffff); $t=($arr32[15] & 0xffff);
if ($t>=32768) $t-=65536; if ($t>=32768) $t-=65536;
for ($i=3;$i<15;$i++) if (($arr32[$i] & 0x80000000)!=0) $arr32[$i]-=0x100000000; for ($i=3;$i<15;$i++) if ((($arr32[$i] & 0x80000000)!=0) && ($arr32[$i] > 0)) $arr32[$i]-=0x100000000;
return array( return array(
"gyroX"=> $arr32[ 3]*$gyroScale, "gyroX"=> $arr32[ 3]*$gyroScale,
"gyroY"=> $arr32[ 4]*$gyroScale, "gyroY"=> $arr32[ 4]*$gyroScale,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment