Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Make RC_CHANNELS=16 corresponding the number of SBUS channels

Oleg Kalachevf46460e53d6a
diff --git a/flix/flix.ino b/flix/flix.ino
index 0a3b80c..33f9761 100644
--- a/flix/flix.ino
+++ b/flix/flix.ino
@@ -10,7 +10,7 @@
#define WIFI_ENABLED 1
-#define RC_CHANNELS 6
+#define RC_CHANNELS 16
#define RC_CHANNEL_ROLL 0
#define RC_CHANNEL_PITCH 1
#define RC_CHANNEL_THROTTLE 2
@@ -26,7 +26,7 @@
float t = NAN; // current step time, s
float dt; // time delta from previous step, s
float loopFreq; // loop frequency, Hz
-int16_t channels[16]; // raw rc channels
+int16_t channels[RC_CHANNELS]; // raw rc channels
float controls[RC_CHANNELS]; // normalized controls in range [-1..1] ([0..1] for throttle)
Vector gyro; // gyroscope data
Vector acc; // accelerometer data, m/s/s
diff --git a/flix/rc.ino b/flix/rc.ino
index 4d846de..c11618d 100644
--- a/flix/rc.ino
+++ b/flix/rc.ino
@@ -6,8 +6,8 @@
#include <SBUS.h>
// NOTE: use 'cr' command to calibrate the RC and put the values here
-int channelNeutral[] = {995, 883, 200, 972, 512, 512};
-int channelMax[] = {1651, 1540, 1713, 1630, 1472, 1472};
+int channelNeutral[] = {995, 883, 200, 972, 512, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+int channelMax[] = {1651, 1540, 1713, 1630, 1472, 1472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
SBUS RC(Serial2, 16, 17); // NOTE: remove pin numbers (16, 17) if you use the new default pins for Serial2 (4, 25)
diff --git a/gazebo/flix.h b/gazebo/flix.h
index 951e051..7debf3e 100644
--- a/gazebo/flix.h
+++ b/gazebo/flix.h
@@ -10,7 +10,7 @@
#include "Arduino.h"
#include "wifi.h"
-#define RC_CHANNELS 6
+#define RC_CHANNELS 16
#define MOTOR_REAR_LEFT 0
#define MOTOR_FRONT_LEFT 3