added GYRO_X, Y, and Z, ACCEL_X, Y, Z

pull/74/head
alanbjohnston 5 years ago committed by GitHub
parent b162d1b1a8
commit b2fe6e2084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,6 +57,13 @@
#define PLUS_Z 6
#define MINUS_Z 7
#define GYRO_X 7
#define GYRO_Y 8
#define GYRO_Z 9
#define ACCEL_X 10
#define ACCEL_Y 11
#define ACCEL_Z 12
#define OFF -1
#define ON 1
@ -1486,18 +1493,24 @@ if (payload == ON)
if (token != NULL)
{
sensor[count1] = atof(token);
if (sensor[count1] < sensor_min[count1])
sensor_min[count1] = sensor[count1];
if (sensor[count1] > sensor_max[count1])
sensor_max[count1] = sensor[count1];
// #ifdef DEBUG_LOGGING
#ifdef DEBUG_LOGGING
printf("sensor: %f ", sensor[count1]);
// #endif
#endif
token = strtok(NULL, space);
}
}
printf("\n");
for (count1 = 0; count1 < 20; count1++)
{
if (sensor[count1] < sensor_min[count1])
sensor_min[count1] = sensor[count1];
if (sensor[count1] > sensor_max[count1])
sensor_max[count1] = sensor[count1];
printf("Smin %f Smax %f \n", sensor_min[count1], sensor_max[count1]);
}
xAngularVelocity = (int)(gyroX + 0.5) + 2048;
yAngularVelocity = (int)(gyroY + 0.5) + 2048;
zAngularVelocity = (int)(gyroZ + 0.5) + 2048;
@ -1561,9 +1574,15 @@ if (payload == ON)
encodeA(b, 39 + head_offset, IHUcpuTemp);
encodeB(b, 40 + head_offset, xAngularVelocity);
encodeA(b, 42 + head_offset, yAngularVelocity);
encodeB(b, 43 + head_offset, zAngularVelocity);
// encodeB(b, 40 + head_offset, xAngularVelocity);
// encodeA(b, 42 + head_offset, yAngularVelocity);
// encodeB(b, 43 + head_offset, zAngularVelocity);
encodeB(b, 40 + head_offset, (int)(sensor[GYRO_X] + 0.5) + 2048);
encodeA(b, 42 + head_offset, (int)(sensor[GYRO_Y] + 0.5) + 2048);
encodeB(b, 43 + head_offset, (int)(sensor[GYRO_Z] + 0.5) + 2048);
encodeA(b, 45 + head_offset, (int)(BME280humidity + 0.5)); // in place of sensor1
encodeB(b, 46 + head_offset,PSUCurrent);

Loading…
Cancel
Save

Powered by TurnKey Linux.