Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Move `motorsActive` function to motors.ino

Oleg Kalachev0a45614751eb
diff --git a/flix/control.ino b/flix/control.ino
index 0eb03d8..4633043 100644
--- a/flix/control.ino
+++ b/flix/control.ino
@@ -164,10 +164,6 @@ void controlTorque() {
motors[3] = constrain(motors[3], 0, 1);
}
-bool motorsActive() {
- return motors[0] > 0 || motors[1] > 0 || motors[2] > 0 || motors[3] > 0;
-}
-
const char* getModeName() {
switch (mode) {
case MANUAL: return "MANUAL";
diff --git a/flix/motors.ino b/flix/motors.ino
index 5e15506..1a7e786 100644
--- a/flix/motors.ino
+++ b/flix/motors.ino
@@ -46,3 +46,7 @@ void sendMotors() {
ledcWrite(MOTOR_2_PIN, getDutyCycle(motors[2]));
ledcWrite(MOTOR_3_PIN, getDutyCycle(motors[3]));
}
+
+bool motorsActive() {
+ return motors[0] != 0 || motors[1] != 0 || motors[2] != 0 || motors[3] != 0;
+}