mirror of
https://github.com/okalachev/flix.git
synced 2026-06-27 21:46:38 +00:00
Typo and minor code style changes
This commit is contained in:
+6
-2
@@ -40,10 +40,12 @@ void readIMU() {
|
||||
imu.getGyro(gyro.x, gyro.y, gyro.z);
|
||||
imu.getAccel(acc.x, acc.y, acc.z);
|
||||
calibrateGyroOnce();
|
||||
// apply scale and bias
|
||||
|
||||
// Apply scale and bias
|
||||
acc = (acc - accBias) / accScale;
|
||||
gyro = gyro - gyroBias;
|
||||
// rotate to body frame
|
||||
|
||||
// Rotate to body frame
|
||||
Quaternion rotation = Quaternion::fromEuler(imuRotation);
|
||||
acc = Quaternion::rotateVector(acc, rotation.inversed());
|
||||
gyro = Quaternion::rotateVector(gyro, rotation.inversed());
|
||||
@@ -52,6 +54,7 @@ void readIMU() {
|
||||
void calibrateGyroOnce() {
|
||||
static Delay landedDelay(2);
|
||||
if (!landedDelay.update(landed)) return; // calibrate only if definitely stationary
|
||||
|
||||
gyroBias = gyroBiasFilter.update(gyro);
|
||||
}
|
||||
|
||||
@@ -105,6 +108,7 @@ void calibrateAccelOnce() {
|
||||
if (acc.x < accMin.x) accMin.x = acc.x;
|
||||
if (acc.y < accMin.y) accMin.y = acc.y;
|
||||
if (acc.z < accMin.z) accMin.z = acc.z;
|
||||
|
||||
// Compute scale and bias
|
||||
accScale = (accMax - accMin) / 2 / ONE_G;
|
||||
accBias = (accMax + accMin) / 2;
|
||||
|
||||
+2
-1
@@ -18,7 +18,7 @@ const int MOTOR_REAR_LEFT = 0, MOTOR_REAR_RIGHT = 1, MOTOR_FRONT_RIGHT = 2, MOTO
|
||||
|
||||
void setupMotors() {
|
||||
print("Setup Motors\n");
|
||||
// configure pins
|
||||
// Configure pins
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ledcAttach(motorPins[i], pwmFrequency, pwmResolution);
|
||||
pwmFrequency = ledcChangeFrequency(motorPins[i], pwmFrequency, pwmResolution); // when reconfiguring
|
||||
@@ -35,6 +35,7 @@ void sendMotors() {
|
||||
|
||||
int getDutyCycle(float value) {
|
||||
value = constrain(value, 0, 1);
|
||||
|
||||
if (pwmMax >= 0) { // pwm mode
|
||||
float pwm = mapf(value, 0, 1, pwmMin, pwmMax);
|
||||
if (value == 0) pwm = pwmStop;
|
||||
|
||||
@@ -55,6 +55,7 @@ void calibrateRC() {
|
||||
print("RC_RX_PIN = %d, set the RC pin!\n", rcRxPin);
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t zero[16]; // for zero positions
|
||||
uint16_t center[16]; // for center positions
|
||||
uint16_t _[16]; // for unused data
|
||||
|
||||
@@ -56,6 +56,7 @@ void setupWiFi() {
|
||||
void sendWiFi(const uint8_t *buf, int len) {
|
||||
if (espnow) {
|
||||
espnow.write(buf, len);
|
||||
|
||||
static Rate discovery(2);
|
||||
if (discovery) espnowBroadcast.write((const uint8_t *)"flix", 4); // broadcast message to help finding this device
|
||||
return;
|
||||
|
||||
@@ -28,7 +28,7 @@ from pyflix import Flix
|
||||
flix = Flix() # create a Flix object and wait for connection
|
||||
```
|
||||
|
||||
If using ESP-NOW connection, specify the proxy's device name in `FLIX_DEVICE` environment variable or pass it to the constructor: `Flix(device='/dev/cu.usbserial-0001')`.
|
||||
If using ESP-NOW connection, specify the proxy device name in `FLIX_DEVICE` environment variable or pass it to the constructor: `Flix(device='/dev/cu.usbserial-0001')`.
|
||||
|
||||
### Telemetry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user