diff --git a/flix/motors.ino b/flix/motors.ino index 84aa599..d0c2cd6 100644 --- a/flix/motors.ino +++ b/flix/motors.ino @@ -88,45 +88,3 @@ void sendMotors() ledcWrite(2, pwmToDutyCycle(getPWM(motors[2], 2))); ledcWrite(3, pwmToDutyCycle(getPWM(motors[3], 3))); } - -// ===================== - -const uint32_t REVERSE_PAUSE = 0.1 * 1000000; - -static uint8_t lastMotorDirection[4]; -static uint32_t lastDirectionChange[4]; - -static void handleReversePause() -{ - for (int i = 0; i < 4; i++) { - if (abs(sign(motors[i]) - lastMotorDirection[i]) > 1) { // 0 => 1 is not direction change, -1 => 1 is - lastDirectionChange[i] = stepTime; - } - if (stepTime - lastDirectionChange[i] < REVERSE_PAUSE) { - // wait before changing direction - motors[i] = 0; - } - lastMotorDirection[i] = sign(motors[i]); - } -} - -// ===================== - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - -float motorThrust[1][10] = { - {0,0.5513626834,0.5387840671,0.6498951782,0.7023060797,0.7610062893,0.8679245283,1,0.9937106918,0.9916142558} -}; -uint16_t minPwm = 1500; -uint16_t pwmStep = 100; - -static float thrustToMotorInput(uint8_t n, float thrust) -{ - for (int i = 0; i < ARRAY_SIZE(motorThrust[n]); i++) { - if (thrust <= motorThrust[n][i]) { - // TODO: pwm - return mapff(thrust, 0, 1, motorThrust[n][i-1], motorThrust[n][i]); - } - } - return 1; -} diff --git a/gazebo/Arduino.h b/gazebo/Arduino.h index 30f576e..6e29617 100644 --- a/gazebo/Arduino.h +++ b/gazebo/Arduino.h @@ -7,14 +7,12 @@ #pragma once -#include #include #include #include #include #include -using std::cout; using std::max; using std::min; using std::isfinite; diff --git a/gazebo/flix.h b/gazebo/flix.h index 496c233..dce7089 100644 --- a/gazebo/flix.h +++ b/gazebo/flix.h @@ -34,8 +34,6 @@ static void controlManual(); static void controlRate(); void desaturate(float& a, float& b, float& c, float& d); static void indicateSaturation(); - -// cli static void showTable(); static void cliTestMotor(uint8_t n); @@ -45,4 +43,4 @@ void calibrateGyro() { printf("Skip gyro calibrating\n"); }; void calibrateAccel() { printf("Skip accel calibrating\n"); }; void fullMotorTest(int n) {}; void sendMotors() {}; -void printIMUCal() { Serial.print("cal: N/A\n"); }; +void printIMUCal() { printf("cal: N/A\n"); };