updates
This commit is contained in:
parent
b848a7fadd
commit
a684511d01
6 changed files with 72 additions and 24 deletions
|
@ -1,4 +1,4 @@
|
|||
#include "descriptionStruct.h"
|
||||
#include "structsAndDefines.h"
|
||||
#define jType_ANALOG_Desc 50
|
||||
#define jType_BUTTON_Desc 51
|
||||
#define jCommand_OUT_OF_BOUND 0xff
|
||||
|
|
|
@ -1,24 +1,28 @@
|
|||
#include "descriptionStruct.h"
|
||||
#include "structsAndDefines.h"
|
||||
|
||||
#define myId 0x01
|
||||
#define myChannel 1
|
||||
#define jNAME "DefaultReceiver"
|
||||
|
||||
#define jMPU
|
||||
#define jCOMP
|
||||
#define jGNSS
|
||||
|
||||
#define debug
|
||||
#define jOUT
|
||||
const byte jOutPins[] = {13, 12, 14, 27, 26, 25, 33, 32, 15 /*,2*/};
|
||||
|
||||
//https://dl.espressif.com/dl/package_esp32_index.json
|
||||
//1.0.6
|
||||
//#define debug
|
||||
|
||||
ChannelDesc buttonDesc[32] = {
|
||||
{3,"Armed"}
|
||||
{BUTTONswitch,"arm"}
|
||||
};
|
||||
ChannelDesc analogDesc[12] = {
|
||||
|
||||
};
|
||||
{ANALOGused, "throttle"},
|
||||
{ANALOGused, "yaw"},
|
||||
|
||||
{ANALOGused, "pitch"},
|
||||
{ANALOGused, "roll"},
|
||||
};
|
||||
|
||||
void onConnect(){
|
||||
|
||||
|
@ -41,4 +45,5 @@ void setup(){
|
|||
|
||||
void loop(){
|
||||
jLoop();
|
||||
|
||||
}
|
||||
|
|
38
MPU.h
38
MPU.h
|
@ -43,8 +43,34 @@ void initMPU(){
|
|||
//mpu6050.calcGyroOffsets(false,50,50);
|
||||
}
|
||||
|
||||
int dcounterxy = 0;
|
||||
|
||||
void MPULoop(){
|
||||
mpu6050.update();
|
||||
if((dcounterxy++)%100 == 0){
|
||||
Serial.print("AccX: ");
|
||||
Serial.print(mpu6050.getAccX());
|
||||
Serial.print(" AccY: ");
|
||||
Serial.print(mpu6050.getAccY());
|
||||
Serial.print(" AccZ: ");
|
||||
Serial.print(mpu6050.getAccZ());
|
||||
Serial.println();
|
||||
Serial.print("GyroX: ");
|
||||
Serial.print(mpu6050.getGyroX());
|
||||
Serial.print(" GyroY: ");
|
||||
Serial.print(mpu6050.getGyroY());
|
||||
Serial.print(" GyroZ: ");
|
||||
Serial.print(mpu6050.getGyroZ());
|
||||
Serial.println();
|
||||
Serial.print("AngleX: ");
|
||||
Serial.print(mpu6050.getAngleX());
|
||||
Serial.print(" AngleY: ");
|
||||
Serial.print(mpu6050.getAngleY());
|
||||
Serial.print(" AngleZ: ");
|
||||
Serial.print(mpu6050.getAngleZ());
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
|
||||
void MPUradioTask(){
|
||||
|
@ -102,18 +128,18 @@ void MPUradioTask(){
|
|||
case jCommand_MPU_get_calc_offsets_acc:{
|
||||
mpuSendData data;
|
||||
data.command = jCommand_MPU_get_calc_offsets_acc;
|
||||
data.X = mpu6050.getGyroXoffsetGlide();
|
||||
data.Y = mpu6050.getGyroYoffsetGlide();
|
||||
data.Z = mpu6050.getGyroZoffsetGlide();
|
||||
data.X = mpu6050.calcAccXoffset();
|
||||
data.Y = mpu6050.calcAccYoffset();
|
||||
data.Z = mpu6050.calcAccZoffset();
|
||||
jSendNRF(&data, sizeof(data));
|
||||
}
|
||||
break;
|
||||
case jCommand_MPU_get_calc_offsets_gyro:{
|
||||
mpuSendData data;
|
||||
data.command = jCommand_MPU_get_calc_offsets_gyro;
|
||||
data.X = mpu6050.calcAccXoffset();
|
||||
data.Y = mpu6050.calcAccYoffset();
|
||||
data.Z = mpu6050.calcAccZoffset();
|
||||
data.X = mpu6050.getGyroXoffsetGlide();
|
||||
data.Y = mpu6050.getGyroYoffsetGlide();
|
||||
data.Z = mpu6050.getGyroZoffsetGlide();
|
||||
jSendNRF(&data, sizeof(data));
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef _descriptionStruct_h_
|
||||
#define _descriptionStruct_h_
|
||||
|
||||
typedef struct {
|
||||
byte use; //0-3 || 0-1
|
||||
char text[29]; //Text
|
||||
}ChannelDesc;
|
||||
|
||||
#endif
|
|
@ -1,12 +1,15 @@
|
|||
#ifndef _juPadReceiver_h_
|
||||
#define _juPadReceiver_h_
|
||||
|
||||
#include "structsAndDefines.h"
|
||||
|
||||
#define maxLast 2500
|
||||
|
||||
typedef struct{
|
||||
byte type = 0xff;
|
||||
uint64_t pipe;
|
||||
byte channel;
|
||||
uint64_t pipe;
|
||||
char name[16] = "[UNNAMED]";
|
||||
}nrfMulticast;
|
||||
|
||||
#ifndef myId
|
||||
|
@ -107,6 +110,10 @@ void jNoConn(){
|
|||
nrfMulticast data;
|
||||
data.pipe = myPipe;
|
||||
data.channel = myChannel;
|
||||
#ifdef jNAME
|
||||
char nameMult[16] = jNAME;
|
||||
strncpy(data.name, nameMult, 16);
|
||||
#endif
|
||||
radio.write(&data, sizeof(data), true);
|
||||
radio.setChannel(myChannel);
|
||||
radio.startListening();
|
||||
|
|
19
structsAndDefines.h
Normal file
19
structsAndDefines.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef _structsAndDefines_h_
|
||||
#define _structsAndDefines_h_
|
||||
|
||||
typedef struct {
|
||||
byte use; //0-3 || 0-1
|
||||
char text[29]; //Text
|
||||
}ChannelDesc;
|
||||
|
||||
#define BUTTONunused 0
|
||||
#define BUTTONbutton 1
|
||||
#define BUTTONseeminglySwitch 2
|
||||
#define BUTTONswitch 3
|
||||
|
||||
#define ANALOGunused 0
|
||||
#define ANALOGused 1
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue