mirror of
https://github.com/okalachev/flix.git
synced 2025-07-29 20:38:59 +00:00
Make util module header instead of .ino-file
This commit is contained in:
parent
ddc46c049f
commit
f9e1802bc0
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@ -28,7 +28,6 @@
|
|||||||
"${workspaceFolder}/flix/motors.ino",
|
"${workspaceFolder}/flix/motors.ino",
|
||||||
"${workspaceFolder}/flix/rc.ino",
|
"${workspaceFolder}/flix/rc.ino",
|
||||||
"${workspaceFolder}/flix/time.ino",
|
"${workspaceFolder}/flix/time.ino",
|
||||||
"${workspaceFolder}/flix/util.ino",
|
|
||||||
"${workspaceFolder}/flix/wifi.ino"
|
"${workspaceFolder}/flix/wifi.ino"
|
||||||
],
|
],
|
||||||
"compilerPath": "~/.arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-g++",
|
"compilerPath": "~/.arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-g++",
|
||||||
@ -75,7 +74,6 @@
|
|||||||
"${workspaceFolder}/flix/motors.ino",
|
"${workspaceFolder}/flix/motors.ino",
|
||||||
"${workspaceFolder}/flix/rc.ino",
|
"${workspaceFolder}/flix/rc.ino",
|
||||||
"${workspaceFolder}/flix/time.ino",
|
"${workspaceFolder}/flix/time.ino",
|
||||||
"${workspaceFolder}/flix/util.ino",
|
|
||||||
"${workspaceFolder}/flix/wifi.ino"
|
"${workspaceFolder}/flix/wifi.ino"
|
||||||
],
|
],
|
||||||
"compilerPath": "~/Library/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-g++",
|
"compilerPath": "~/Library/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-g++",
|
||||||
@ -122,7 +120,6 @@
|
|||||||
"${workspaceFolder}/flix/motors.ino",
|
"${workspaceFolder}/flix/motors.ino",
|
||||||
"${workspaceFolder}/flix/rc.ino",
|
"${workspaceFolder}/flix/rc.ino",
|
||||||
"${workspaceFolder}/flix/time.ino",
|
"${workspaceFolder}/flix/time.ino",
|
||||||
"${workspaceFolder}/flix/util.ino",
|
|
||||||
"${workspaceFolder}/flix/wifi.ino"
|
"${workspaceFolder}/flix/wifi.ino"
|
||||||
],
|
],
|
||||||
"compilerPath": "~/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-g++.exe",
|
"compilerPath": "~/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-g++.exe",
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "quaternion.h"
|
#include "quaternion.h"
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
#include "lpf.h"
|
#include "lpf.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#define PITCHRATE_P 0.05
|
#define PITCHRATE_P 0.05
|
||||||
#define PITCHRATE_I 0.2
|
#define PITCHRATE_I 0.2
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
#include "quaternion.h"
|
#include "quaternion.h"
|
||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
#include "lpf.h"
|
#include "lpf.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#define WEIGHT_ACC 0.5f
|
#define WEIGHT_ACC 0.5f
|
||||||
#define RATES_LFP_ALPHA 0.2 // cutoff frequency ~ 40 Hz
|
#define RATES_LFP_ALPHA 0.2 // cutoff frequency ~ 40 Hz
|
||||||
|
|
||||||
LowPassFilter<Vector> ratesFilter(RATES_LFP_ALPHA);
|
LowPassFilter<Vector> ratesFilter(RATES_LFP_ALPHA);
|
||||||
extern const float ONE_G;
|
|
||||||
|
|
||||||
void estimate() {
|
void estimate() {
|
||||||
applyGyro();
|
applyGyro();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
#include "quaternion.h"
|
#include "quaternion.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#define SERIAL_BAUDRATE 115200
|
#define SERIAL_BAUDRATE 115200
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <MPU9250.h>
|
#include <MPU9250.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
// NOTE: use 'ca' command to calibrate the accelerometer and put the values here
|
// NOTE: use 'ca' command to calibrate the accelerometer and put the values here
|
||||||
Vector accBias(0, 0, 0);
|
Vector accBias(0, 0, 0);
|
||||||
@ -13,8 +14,6 @@ Vector accScale(1, 1, 1);
|
|||||||
MPU9250 IMU(SPI);
|
MPU9250 IMU(SPI);
|
||||||
Vector gyroBias;
|
Vector gyroBias;
|
||||||
|
|
||||||
extern const float ONE_G;
|
|
||||||
|
|
||||||
void setupIMU() {
|
void setupIMU() {
|
||||||
Serial.println("Setup IMU");
|
Serial.println("Setup IMU");
|
||||||
bool status = IMU.begin();
|
bool status = IMU.begin();
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// In case of using ESC, use this version of the code: https://gist.github.com/okalachev/8871d3a94b6b6c0a298f41a4edd34c61.
|
// In case of using ESC, use this version of the code: https://gist.github.com/okalachev/8871d3a94b6b6c0a298f41a4edd34c61.
|
||||||
// Motor: 8520 3.7V
|
// Motor: 8520 3.7V
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#define MOTOR_0_PIN 12 // rear left
|
#define MOTOR_0_PIN 12 // rear left
|
||||||
#define MOTOR_1_PIN 13 // rear right
|
#define MOTOR_1_PIN 13 // rear right
|
||||||
#define MOTOR_2_PIN 14 // front right
|
#define MOTOR_2_PIN 14 // front right
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Work with the RC receiver
|
// Work with the RC receiver
|
||||||
|
|
||||||
#include <SBUS.h>
|
#include <SBUS.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
// NOTE: use 'cr' command to calibrate the RC and put the values here
|
// NOTE: use 'cr' command to calibrate the RC and put the values here
|
||||||
int channelNeutral[] = {995, 883, 200, 972, 512, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
int channelNeutral[] = {995, 883, 200, 972, 512, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <soc/soc.h>
|
#include <soc/soc.h>
|
||||||
#include <soc/rtc_cntl_reg.h>
|
#include <soc/rtc_cntl_reg.h>
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "flix.h"
|
#include "flix.h"
|
||||||
#include "util.ino"
|
|
||||||
#include "rc.ino"
|
#include "rc.ino"
|
||||||
#include "time.ino"
|
#include "time.ino"
|
||||||
#include "motors.ino"
|
#include "motors.ino"
|
||||||
|
@ -1 +1 @@
|
|||||||
// Dummy file to make it possible to compile simulator with util.ino
|
// Dummy file to make it possible to compile simulator with Flix' util.h
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// Dummy file to make it possible to compile simulator with util.ino
|
// Dummy file to make it possible to compile simulator with Flix' util.h
|
||||||
|
|
||||||
#define WRITE_PERI_REG(addr, val) {}
|
#define WRITE_PERI_REG(addr, val) {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user