Move loopRate to time.ino

This commit is contained in:
Oleg Kalachev 2025-01-10 07:15:15 +03:00
parent f9e1802bc0
commit 5530ad2981
4 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@
extern PID rollRatePID, pitchRatePID, yawRatePID, rollPID, pitchPID;
extern LowPassFilter<Vector> ratesFilter;
extern const int MOTOR_REAR_LEFT, MOTOR_REAR_RIGHT, MOTOR_FRONT_RIGHT, MOTOR_FRONT_LEFT;
extern float loopRate;
const char* motd =
"\nWelcome to\n"

View File

@ -21,7 +21,6 @@
float t = NAN; // current step time, s
float dt; // time delta from previous step, s
float loopRate; // loop rate, Hz
int16_t channels[RC_CHANNELS]; // raw rc channels
float controls[RC_CHANNELS]; // normalized controls in range [-1..1] ([0..1] for throttle)
float controlsTime; // time of the last controls update

View File

@ -3,6 +3,8 @@
// Time related functions
float loopRate; // Hz
void step() {
float now = micros() / 1000000.0;
dt = now - t;

View File

@ -15,7 +15,6 @@
float t = NAN;
float dt;
float loopRate;
float motors[4];
int16_t channels[16]; // raw rc channels
float controls[RC_CHANNELS];