Use index references
This commit is contained in:
parent
6dea063a4a
commit
f6a38aaa04
@ -9,11 +9,14 @@
|
||||
#include "LinearAlgebra/Angle8.h"
|
||||
#include "LinearAlgebra/Spherical.h"
|
||||
|
||||
void NetworkSync::SendVector3(unsigned char *data, unsigned int startIndex,
|
||||
void NetworkSync::SendVector3(unsigned char *data, unsigned char *startIndex,
|
||||
const Vector3 v) {
|
||||
SendSingle100(data, startIndex, v.x);
|
||||
SendSingle100(data, startIndex += 4, v.y);
|
||||
SendSingle100(data, startIndex += 4, v.z);
|
||||
SendSingle100(data, *startIndex, v.x);
|
||||
(*startIndex) += 4;
|
||||
SendSingle100(data, *startIndex, v.y);
|
||||
(*startIndex) += 4;
|
||||
SendSingle100(data, *startIndex, v.z);
|
||||
(*startIndex) += 4;
|
||||
}
|
||||
|
||||
void NetworkSync::SendQuaternion(unsigned char *data, const int startIndex,
|
||||
@ -52,7 +55,7 @@ void NetworkSync::SendSpherical(unsigned char *data, int startIndex,
|
||||
// SendSingle100(data, startIndex += 4, s.distance);
|
||||
// }
|
||||
|
||||
void NetworkSync::SendQuat32(unsigned char *data, int startIndex,
|
||||
void NetworkSync::SendQuat32(unsigned char *data, unsigned char *startIndex,
|
||||
const Quaternion q) {
|
||||
unsigned char qx = (char)(q.x * 127 + 128);
|
||||
unsigned char qy = (char)(q.y * 127 + 128);
|
||||
@ -65,10 +68,10 @@ void NetworkSync::SendQuat32(unsigned char *data, int startIndex,
|
||||
qw = -qw;
|
||||
}
|
||||
// Serial.printf(" (%d) %d:%d:%d:%d ", startIndex, qx, qy, qz, qw);
|
||||
data[startIndex++] = qx;
|
||||
data[startIndex++] = qy;
|
||||
data[startIndex++] = qz;
|
||||
data[startIndex++] = qw;
|
||||
data[(*startIndex)++] = qx;
|
||||
data[(*startIndex)++] = qy;
|
||||
data[(*startIndex)++] = qz;
|
||||
data[(*startIndex)++] = qw;
|
||||
}
|
||||
|
||||
void NetworkSync::SendAngle8(unsigned char *data, unsigned int startIndex,
|
||||
|
@ -62,7 +62,7 @@ protected:
|
||||
// const float value);
|
||||
// void SendAngle32(unsigned char *data, unsigned int startIndex,
|
||||
// const float value);
|
||||
void SendVector3(unsigned char *data, unsigned int startIndex,
|
||||
void SendVector3(unsigned char *data, unsigned char *startIndex,
|
||||
const Vector3 v);
|
||||
void SendQuaternion(unsigned char *data, const int startIndex,
|
||||
const Quaternion q);
|
||||
@ -71,7 +71,8 @@ protected:
|
||||
void SendSpherical(unsigned char *data, int startIndex, Spherical s);
|
||||
// void SendSpherical16(unsigned char *data, int startIndex, Spherical s);
|
||||
// void SendSpherical32(unsigned char *data, int startIndex, Spherical s);
|
||||
void SendQuat32(unsigned char *data, int startIndex, const Quaternion q);
|
||||
void SendQuat32(unsigned char *data, unsigned char *startIndex,
|
||||
const Quaternion q);
|
||||
};
|
||||
|
||||
} // namespace RoboidControl
|
||||
|
Loading…
x
Reference in New Issue
Block a user