Skip to content

Commit 67430c7

Browse files
committed
Several minor changes
1 parent 3631743 commit 67430c7

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

flix/estimate.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2023 Oleg Kalachev <okalachev@gmail.com>
22
// Repository: https://github.com/okalachev/flix
33

4-
// Attitude estimation from gyro and accelerometer
4+
// Attitude estimation using gyro and accelerometer
55

66
#include "quaternion.h"
77
#include "vector.h"

flix/flix.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ void setup() {
2121
disableBrownOut();
2222
setupParameters();
2323
setupLED();
24-
setupMotors();
2524
setLED(true);
25+
setupMotors();
2626
setupWiFi();
2727
setupIMU();
2828
setupRC();

flix/mavlink.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99
extern float controlTime;
1010

11-
bool mavlinkConnected = false;
12-
String mavlinkPrintBuffer;
1311
int mavlinkSysId = 1;
1412
Rate telemetryFast(10);
1513
Rate telemetrySlow(2);
1614

15+
bool mavlinkConnected = false;
16+
String mavlinkPrintBuffer;
17+
1718
void processMavlink() {
1819
sendMavlink();
1920
receiveMavlink();
@@ -41,9 +42,9 @@ void sendMavlink() {
4142
}
4243

4344
if (telemetryFast && mavlinkConnected) {
44-
const float zeroQuat[] = {0, 0, 0, 0};
45+
const float offset[] = {0, 0, 0, 0};
4546
mavlink_msg_attitude_quaternion_pack(mavlinkSysId, MAV_COMP_ID_AUTOPILOT1, &msg,
46-
time, attitude.w, attitude.x, -attitude.y, -attitude.z, rates.x, -rates.y, -rates.z, zeroQuat); // convert to frd
47+
time, attitude.w, attitude.x, -attitude.y, -attitude.z, rates.x, -rates.y, -rates.z, offset); // convert to frd
4748
sendMessage(&msg);
4849

4950
mavlink_msg_rc_channels_raw_pack(mavlinkSysId, MAV_COMP_ID_AUTOPILOT1, &msg, controlTime * 1000, 0,

flix/parameters.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ extern float rcLossTimeout, descendTime;
1515
Preferences storage;
1616

1717
struct Parameter {
18-
const char *name; // max length is 15 (Preferences key limit)
18+
const char *name; // max length is 15
1919
bool integer;
20-
union { float *f; int *i; }; // pointer to variable
20+
union { float *f; int *i; }; // pointer to the variable
2121
float cache; // what's stored in flash
2222
Parameter(const char *name, float *variable) : name(name), integer(false), f(variable) {};
2323
Parameter(const char *name, int *variable) : name(name), integer(true), i(variable) {};
@@ -112,6 +112,7 @@ Parameter parameters[] = {
112112
};
113113

114114
void setupParameters() {
115+
print("Setup parameters\n");
115116
storage.begin("flix", false);
116117
// Read parameters from storage
117118
for (auto &parameter : parameters) {

0 commit comments

Comments
 (0)