[Client] Fix "blinking" coordinates in flood mode
In calibration flood mode, the coordinates were "blinking" (correct values, then 0, etc.). This is now fixed.
This commit is contained in:
parent
b68cb179a9
commit
d566187f42
|
@ -410,14 +410,21 @@ void make_packet()
|
||||||
printf("Direction = %d, X = %f, Y = %f, Z = %f\n",
|
printf("Direction = %d, X = %f, Y = %f, Z = %f\n",
|
||||||
packet[offset - 1], options.x, options.y, options.z) ;
|
packet[offset - 1], options.x, options.y, options.z) ;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
// Convert the coordinates to the network endianess
|
||||||
options.x = owl_htonf(options.x) ;
|
options.x = owl_htonf(options.x) ;
|
||||||
options.y = owl_htonf(options.y) ;
|
options.y = owl_htonf(options.y) ;
|
||||||
options.z = owl_htonf(options.z) ;
|
options.z = owl_htonf(options.z) ;
|
||||||
|
// Copy the coordinates to the packet
|
||||||
memcpy(&packet[offset], &options.x, sizeof(float)) ;
|
memcpy(&packet[offset], &options.x, sizeof(float)) ;
|
||||||
offset += sizeof(float) ;
|
offset += sizeof(float) ;
|
||||||
memcpy(&packet[offset], &options.y, sizeof(float)) ;
|
memcpy(&packet[offset], &options.y, sizeof(float)) ;
|
||||||
offset += sizeof(float) ;
|
offset += sizeof(float) ;
|
||||||
memcpy(&packet[offset], &options.z, sizeof(float)) ;
|
memcpy(&packet[offset], &options.z, sizeof(float)) ;
|
||||||
|
// Convert the coordinates back to the host endianess (mandatory
|
||||||
|
// in flood mode)
|
||||||
|
options.x = owl_ntohf(options.x) ;
|
||||||
|
options.y = owl_ntohf(options.y) ;
|
||||||
|
options.z = owl_ntohf(options.z) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
else // Standard packet
|
else // Standard packet
|
||||||
|
|
Loading…
Reference in New Issue