[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:
Matteo Cypriani 2011-08-20 18:45:23 +02:00
parent b68cb179a9
commit d566187f42
1 changed files with 7 additions and 0 deletions

View File

@ -410,14 +410,21 @@ void make_packet()
printf("Direction = %d, X = %f, Y = %f, Z = %f\n",
packet[offset - 1], options.x, options.y, options.z) ;
#endif // DEBUG
// Convert the coordinates to the network endianess
options.x = owl_htonf(options.x) ;
options.y = owl_htonf(options.y) ;
options.z = owl_htonf(options.z) ;
// Copy the coordinates to the packet
memcpy(&packet[offset], &options.x, sizeof(float)) ;
offset += sizeof(float) ;
memcpy(&packet[offset], &options.y, sizeof(float)) ;
offset += 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