mirror of
https://github.com/okalachev/flix.git
synced 2026-09-06 00:10:58 +00:00
Rename cli.ino => console.ino. Rename handleInput => handleConsole. Separate console initialization function. Always use usb cdc by default on s3/c3 (no configuration needed).
46 lines
822 B
Arduino
46 lines
822 B
Arduino
// Copyright (c) 2023 Oleg Kalachev <okalachev@gmail.com>
|
|
// Repository: https://github.com/okalachev/flix
|
|
|
|
// Main firmware file
|
|
|
|
#include "vector.h"
|
|
#include "quaternion.h"
|
|
#include "util.h"
|
|
|
|
extern float t, dt;
|
|
extern float controlRoll, controlPitch, controlYaw, controlThrottle, controlMode;
|
|
extern Vector gyro, acc;
|
|
extern Vector rates;
|
|
extern Quaternion attitude;
|
|
extern bool landed;
|
|
extern float motors[4];
|
|
|
|
void setup() {
|
|
setupConsole();
|
|
print("Initializing Flix\n");
|
|
setupParameters();
|
|
setupPower();
|
|
setupLED();
|
|
setLED(true);
|
|
setupMotors();
|
|
setupWiFi();
|
|
setupIMU();
|
|
setupRC();
|
|
setLED(false);
|
|
print("Initializing complete\n");
|
|
}
|
|
|
|
void loop() {
|
|
readIMU();
|
|
step();
|
|
readRC();
|
|
estimate();
|
|
control();
|
|
sendMotors();
|
|
handleConsole();
|
|
processMavlink();
|
|
readVoltage();
|
|
logData();
|
|
syncParameters();
|
|
}
|