From 9c8c0e2578bdabdd5befd25bc0d47e88a43170ed Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Thu, 15 May 2025 09:22:17 +0300 Subject: [PATCH] Minor code updates --- docs/firmware.md | 2 +- flix/flix.ino | 2 +- flix/imu.ino | 2 +- flix/motors.ino | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/firmware.md b/docs/firmware.md index 3871009..89bab48 100644 --- a/docs/firmware.md +++ b/docs/firmware.md @@ -15,7 +15,7 @@ The main loop is running at 1000 Hz. All the dataflow is happening through globa * `rates` *(Vector)* — filtered angular rates, *rad/s*. * `attitude` *(Quaternion)* — estimated attitude (orientation) of drone. * `controls` *(float[])* — user control inputs from the RC, normalized to [-1, 1] range. -* `motors` *(float[])* — motor outputs, normalized to [-1, 1] range; reverse rotation is possible. +* `motors` *(float[])* — motor outputs, normalized to [0, 1] range; reverse rotation is possible. ## Source files diff --git a/flix/flix.ino b/flix/flix.ino index 0c7ea7b..ea89c1c 100644 --- a/flix/flix.ino +++ b/flix/flix.ino @@ -19,7 +19,7 @@ Vector acc; // accelerometer data, m/s/s Vector rates; // filtered angular rates, rad/s Quaternion attitude; // estimated attitude bool landed; // are we landed and stationary -float motors[4]; // normalized motors thrust in range [-1..1] +float motors[4]; // normalized motors thrust in range [0..1] void setup() { Serial.begin(SERIAL_BAUDRATE); diff --git a/flix/imu.ino b/flix/imu.ino index 0cf6139..42b3793 100644 --- a/flix/imu.ino +++ b/flix/imu.ino @@ -11,8 +11,8 @@ MPU9250 IMU(SPI); Vector accBias; -Vector gyroBias; Vector accScale(1, 1, 1); +Vector gyroBias; void setupIMU() { print("Setup IMU\n"); diff --git a/flix/motors.ino b/flix/motors.ino index 0386552..f15fd46 100644 --- a/flix/motors.ino +++ b/flix/motors.ino @@ -55,7 +55,7 @@ bool motorsActive() { return motors[0] != 0 || motors[1] != 0 || motors[2] != 0 || motors[3] != 0; } -void testMotor(uint8_t n) { +void testMotor(int n) { print("Testing motor %d\n", n); motors[n] = 1; 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