comments and cleanup

This commit is contained in:
2024-06-05 13:56:23 +02:00
parent fbca5ce351
commit d0c74c4e25
4 changed files with 20 additions and 23 deletions

View File

@@ -9,9 +9,10 @@ void setup() {
}
void loop() {
SensorManager::RotationQuaternions Rotation = sensorManager.getQuaternions();
// SensorManager::acceleration rotationAcceleration = sensorManager.getAcelleration();
SensorManager::eulerAngles Rotation = sensorManager.getEulerAngles();
//static structure
// TODO: redo json for esp8266 and in android studio
struct acceleration {
float x = 9;
float y = 9;
@@ -19,22 +20,22 @@ struct acceleration {
} accelData;
if (!ipAquired) {
serverIp = connectivity.fetchIPAddress(); // Assign the value here
serverIp = connectivity.fetchIPAddress(); //Fetch pepper ip address
ipAquired = true;
}
unsigned long lastTime = 0; // will store the last time the code was run
unsigned long currentTime = millis();
if (currentTime - lastTime >= 100) { // 100 ms has passed
if (currentTime - lastTime >= 100) { // do everything inside every 100 ms
memset(buffer, 0, BUFFER_SIZE);
sprintf(
buffer,
"{\"deviceId\": %d, \"rotationX\": %f, \"rotationY\": %f, \"rotationZ\": %f, \"accelerationX\": %f, \"accelerationY\": %f, \"accelerationZ\": %f, \"type\": %s}",
DEVICE_ID,
Rotation.i,
Rotation.j,
Rotation.k,
Rotation.w,
Rotation.roll,
Rotation.pitch,
Rotation.yaw,
accelData.x,
accelData.y,
accelData.z,
"data");
@@ -45,6 +46,3 @@ struct acceleration {
lastTime = currentTime;
}
}
//acceleration.X
//acceleration.Y
//acceleration.Z