mirror of
https://github.com/okalachev/flix.git
synced 2025-07-29 04:19:00 +00:00
Remove RC_CHANNELS macro
This commit is contained in:
parent
03c6576b72
commit
d60968ea25
@ -10,7 +10,6 @@
|
||||
#define SERIAL_BAUDRATE 115200
|
||||
#define WIFI_ENABLED 1
|
||||
|
||||
#define RC_CHANNELS 16
|
||||
#define RC_CHANNEL_ROLL 0
|
||||
#define RC_CHANNEL_PITCH 1
|
||||
#define RC_CHANNEL_THROTTLE 2
|
||||
@ -20,8 +19,8 @@
|
||||
|
||||
float t = NAN; // current step time, s
|
||||
float dt; // time delta from previous step, s
|
||||
int16_t channels[RC_CHANNELS]; // raw rc channels
|
||||
float controls[RC_CHANNELS]; // normalized controls in range [-1..1] ([0..1] for throttle)
|
||||
int16_t channels[16]; // raw rc channels
|
||||
float controls[16]; // normalized controls in range [-1..1] ([0..1] for throttle)
|
||||
Vector gyro; // gyroscope data
|
||||
Vector acc; // accelerometer data, m/s/s
|
||||
Vector rates; // filtered angular rates, rad/s
|
||||
|
10
flix/rc.ino
10
flix/rc.ino
@ -28,7 +28,7 @@ void readRC() {
|
||||
}
|
||||
|
||||
void normalizeRC() {
|
||||
for (uint8_t i = 0; i < RC_CHANNELS; i++) {
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
controls[i] = mapf(channels[i], channelNeutral[i], channelMax[i], 0, 1);
|
||||
}
|
||||
}
|
||||
@ -38,20 +38,20 @@ void calibrateRC() {
|
||||
Serial.println("··o ··o\n··· ···\n··· ···");
|
||||
delay(4000);
|
||||
for (int i = 0; i < 30; i++) readRC(); // ensure the values are updated
|
||||
for (int i = 0; i < RC_CHANNELS; i++) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
channelMax[i] = channels[i];
|
||||
}
|
||||
Serial.println("Calibrate RC: move all sticks to neutral positions in 4 seconds");
|
||||
Serial.println("··· ···\n··· ·o·\n·o· ···");
|
||||
delay(4000);
|
||||
for (int i = 0; i < 30; i++) readRC(); // ensure the values are updated
|
||||
for (int i = 0; i < RC_CHANNELS; i++) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
channelNeutral[i] = channels[i];
|
||||
}
|
||||
printRCCal();
|
||||
}
|
||||
|
||||
void printRCCal() {
|
||||
printArray(channelNeutral, RC_CHANNELS);
|
||||
printArray(channelMax, RC_CHANNELS);
|
||||
printArray(channelNeutral, 16);
|
||||
printArray(channelMax, 16);
|
||||
}
|
||||
|
@ -10,14 +10,13 @@
|
||||
#include "Arduino.h"
|
||||
#include "wifi.h"
|
||||
|
||||
#define RC_CHANNELS 16
|
||||
#define WIFI_ENABLED 1
|
||||
|
||||
float t = NAN;
|
||||
float dt;
|
||||
float motors[4];
|
||||
int16_t channels[16]; // raw rc channels
|
||||
float controls[RC_CHANNELS];
|
||||
float controls[16];
|
||||
Vector acc;
|
||||
Vector gyro;
|
||||
Vector rates;
|
||||
|
@ -38,8 +38,8 @@ bool joystickInit() {
|
||||
}
|
||||
|
||||
// apply calibration overrides
|
||||
extern int channelNeutral[RC_CHANNELS];
|
||||
extern int channelMax[RC_CHANNELS];
|
||||
extern int channelNeutral[16];
|
||||
extern int channelMax[16];
|
||||
memcpy(channelNeutral, channelNeutralOverride, sizeof(channelNeutralOverride));
|
||||
memcpy(channelMax, channelMaxOverride, sizeof(channelMaxOverride));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user