mirror of
https://github.com/okalachev/flix.git
synced 2026-08-15 16:29:00 +00:00
Add argument to motor testing commands for specifying thrust
This commit is contained in:
+5
-5
@@ -51,7 +51,7 @@ const char* motd =
|
||||
"espnow <mac> [<key>] - configure ESP-NOW peer\n"
|
||||
"mot - show motor output\n"
|
||||
"log [dump] - print log header [and data]\n"
|
||||
"mfr, mfl, mrr, mrl - test motor (remove props)\n"
|
||||
"mfr/mfl/mrr/mrl [<thrust>] - test motor (remove props)\n"
|
||||
"sys - show system info\n"
|
||||
"reset - reset drone's state\n"
|
||||
"reboot - reboot the drone\n";
|
||||
@@ -161,13 +161,13 @@ void doCommand(String str, bool echo = false) {
|
||||
} else if (command == "ca") {
|
||||
calibrateAccel();
|
||||
} else if (command == "mfr") {
|
||||
testMotor(MOTOR_FRONT_RIGHT);
|
||||
testMotor(MOTOR_FRONT_RIGHT, arg0.isEmpty() ? 0.2 : arg0.toFloat());
|
||||
} else if (command == "mfl") {
|
||||
testMotor(MOTOR_FRONT_LEFT);
|
||||
testMotor(MOTOR_FRONT_LEFT, arg0.isEmpty() ? 0.2 : arg0.toFloat());
|
||||
} else if (command == "mrr") {
|
||||
testMotor(MOTOR_REAR_RIGHT);
|
||||
testMotor(MOTOR_REAR_RIGHT, arg0.isEmpty() ? 0.2 : arg0.toFloat());
|
||||
} else if (command == "mrl") {
|
||||
testMotor(MOTOR_REAR_LEFT);
|
||||
testMotor(MOTOR_REAR_LEFT, arg0.isEmpty() ? 0.2 : arg0.toFloat());
|
||||
} else if (command == "sys") {
|
||||
#ifdef ESP32
|
||||
print("Chip: %s\n", ESP.getChipModel());
|
||||
|
||||
+2
-2
@@ -51,9 +51,9 @@ bool motorsActive() {
|
||||
return motors[0] != 0 || motors[1] != 0 || motors[2] != 0 || motors[3] != 0;
|
||||
}
|
||||
|
||||
void testMotor(int n) {
|
||||
void testMotor(int n, float thrust) {
|
||||
print("Testing motor %d\n", n);
|
||||
motors[n] = 0.2;
|
||||
motors[n] = thrust;
|
||||
delay(50); // ESP32 may need to wait until the end of the current cycle to change duty https://github.com/espressif/arduino-esp32/issues/5306
|
||||
sendMotors();
|
||||
pause(3);
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ const char* getModeName();
|
||||
void sendMotors();
|
||||
int getDutyCycle(float value);
|
||||
bool motorsActive();
|
||||
void testMotor(int n);
|
||||
void testMotor(int, float);
|
||||
void print(const char* format, ...);
|
||||
void pause(float duration);
|
||||
void doCommand(String str, bool echo);
|
||||
|
||||
Reference in New Issue
Block a user