Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Minor changes Simplify the code, print imu temperature

Oleg Kalachev71abe1bcdb86
diff --git a/docs/usage.md b/docs/usage.md
index 04e765f..540c521 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -89,6 +89,9 @@ QGroundControl is a ground control station software that can be used to monitor
3. Connect your computer or smartphone to the appeared `flix` Wi-Fi network (password: `flixwifi`).
4. Launch QGroundControl app. It should connect and begin showing the drone's telemetry automatically.
+> [!TIP]
+> If QGroundControl doesn't connect, try to disable the firewall and/or VPN on your computer, as they may block the connection.
+
### Access console
The console is a command line interface (CLI) that allows to interact with the drone, change parameters, and perform various actions. There are two ways of accessing the console: using **serial port** or using **QGroundControl (wirelessly)**.
diff --git a/flix/control.ino b/flix/control.ino
index aa7edb6..2b7e3ca 100644
--- a/flix/control.ino
+++ b/flix/control.ino
@@ -149,6 +149,7 @@ void controlTorque() {
motors[MOTOR_REAR_LEFT] = thrustTarget + torqueTarget.x + torqueTarget.y - torqueTarget.z;
motors[MOTOR_REAR_RIGHT] = thrustTarget - torqueTarget.x + torqueTarget.y + torqueTarget.z;
+ // Prioritize angle control over thrust control
desaturate(motors[MOTOR_FRONT_LEFT], motors[MOTOR_FRONT_RIGHT], motors[MOTOR_REAR_LEFT], motors[MOTOR_REAR_RIGHT]);
motors[0] = constrain(motors[0], 0, 1);
diff --git a/flix/estimate.ino b/flix/estimate.ino
index 3303da9..75c2ec6 100644
--- a/flix/estimate.ino
+++ b/flix/estimate.ino
@@ -32,8 +32,7 @@ void applyGyro() {
void applyAcc() {
// test should we apply accelerometer gravity correction
- float accNorm = acc.norm();
- landed = !motorsActive() && abs(accNorm - ONE_G) < ONE_G * 0.1f;
+ landed = !motorsActive() && abs(acc.norm() - ONE_G) < ONE_G * 0.1f;
if (!landed) return;
diff --git a/flix/imu.ino b/flix/imu.ino
index 0b0e97f..b6a84b5 100644
--- a/flix/imu.ino
+++ b/flix/imu.ino
@@ -125,6 +125,7 @@ void printIMUInfo() {
print("model: %s\n", imu.getModel());
print("who am I: 0x%02X\n", imu.whoAmI());
print("rate: %.0f\n", loopRate);
+ print("temperature: %.1f °C\n", imu.getTemp());
print("gyro: %f %f %f\n", gyro.x, gyro.y, gyro.z);
print("acc: %f %f %f\n", acc.x, acc.y, acc.z);
imu.waitForData();
diff --git a/flix/power.ino b/flix/power.ino
index a6df104..b79a898 100644
--- a/flix/power.ino
+++ b/flix/power.ino
@@ -20,6 +20,7 @@ void setupPower() {
void readVoltage() {
if (voltagePin < 0) return;
+
static Rate rate(10);
if (!rate) return;