dead code removal

This commit is contained in:
2024-05-28 15:16:04 +02:00
parent 80ef0ac99e
commit 83b233e275
2 changed files with 14 additions and 44 deletions

View File

@@ -5,56 +5,24 @@
void setup() {
Serial.begin(9600);
Serial.println("startup");
//connect to internet and start sensor
connectivity.connectWiFi(ssid, pass);
sensorManager.sensorSetup();
//ws server address, port and URL
// webSocket.begin("145.28.160.108", 8001, "");
// try every 500 again if connection has failed
// webSocket.setReconnectInterval(500);
}
void loop() {
SensorManager::eulerAngles eulerRotation = sensorManager.getEulerAngles();
// Subtract offset
// rotation.i -= offset.i;
// rotation.j -= offset.j;
// rotation.k -= offset.k;
// rotation.w -= offset.w;
// Convert quaternion to Euler angles in radians
// Convert to degrees
// float rollDegrees = roll * 180.0f / PI;
// float pitchDegrees = pitch * 180.0f / PI;
// float yawDegrees = yaw * 180.0f / PI;
Serial.print(eulerRotation.roll);
Serial.print(" ");
Serial.print(eulerRotation.pitch);
Serial.print(" ");
Serial.print(eulerRotation.yaw);
sendData(eulerRotation.roll, eulerRotation.pitch, eulerRotation.yaw);
Serial.println();
// webSocket.loop();
}
// if (Serial.available()) {
// String command = Serial.readStringUntil('\n');
// command.trim(); // remove any trailing whitespace
// if (command == "setZeroPoint") {
// setZeroPoint();
// }
// }
// }
// void setZeroPoint() {
// offset = sensorManager.readLoop();
// }
void sendData(float roll, float pitch, float yaw){
String message = "{\"Sensor\": 1, \"roll\":\"" + String(roll) + "\",\"pitch\":\"" + String(pitch) + "\",\"yaw\":\"" + String(yaw) + "\"}";
webSocket.sendTXT(message);
}
String message = "{\"Sensor\": 1, \"roll\":\"" + String(eulerRotation.roll) + "\",\"pitch\":\"" + String(eulerRotation.pitch) + "\",\"yaw\":\"" + String(eulerRotation.yaw) + "\"}";
int messageLength = message.length();
Serial.println(message);
Serial.println(connectivity.httpPost("192.168.137.146", "/", 3445, message.c_str(), message.length(), "json"));
}