Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…79b44-d973-9852-f2fa-63770883b36c
  • Loading branch information
dubusal@gmail.com committed Jul 10, 2011
1 parent eb5b7d4 commit 377cfd3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
9 changes: 5 additions & 4 deletions EEPROM.pde
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <avr/eeprom.h>

static uint8_t checkNewConf = 142;
static uint8_t checkNewConf = 143;

typedef struct eep_entry_t{
void * var;
Expand All @@ -19,6 +19,7 @@ static eep_entry_t eep_entry[] = {
, &rcExpo8, sizeof(rcExpo8)
, &rollPitchRate, sizeof(rollPitchRate)
, &yawRate, sizeof(yawRate)
, &dynThrPID, sizeof(dynThrPID)
, &activate, sizeof(activate)
, &accZero, sizeof(accZero)
, &magZero, sizeof(magZero)
Expand Down Expand Up @@ -55,9 +56,9 @@ void checkFirstTime() {
P8[ROLL] = 40; I8[ROLL] = 30; D8[ROLL] = 15;
P8[PITCH] = 40; I8[PITCH] = 30; D8[PITCH] = 15;
P8[YAW] = 80; I8[YAW] = 0; D8[YAW] = 0;
P8[PIDALT] = 40; I8[PIDALT] = 0; D8[PIDALT] = 10;
P8[PIDVEL] = 0; I8[PIDVEL] = 0; D8[PIDVEL] = 0;
P8[PIDLEVEL] = 120; I8[PIDLEVEL] = 45;
P8[PIDALT] = 40; I8[PIDALT] = 10; D8[PIDALT] = 10;
P8[PIDVEL] = 90; I8[PIDVEL] = 0; D8[PIDVEL] = 19;
P8[PIDLEVEL] = 90; I8[PIDLEVEL] = 45;
P8[PIDMAG] = 40;
rcRate8 = 45; // = 0.9 in GUI
rcExpo8 = 65;
Expand Down
2 changes: 0 additions & 2 deletions IMU.pde
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,4 @@ void getEstimatedAltitude(){
Delta = InstAcc * dt + (Kp1 * Kt) * AltError;
EstAlt += ((EstVelocity + Delta * 0.5f) * dt + (Kp2 * Kt) * AltError);
EstVelocity += Delta;
// Debug
//magADC[1] = EstVelocity*1000.0f/3.0f;
}
17 changes: 10 additions & 7 deletions Output.pde
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,16 @@ ISR(TIMER0_COMPB_vect) { //the same with digital PIN 6 and OCR0B counter


void mixTable() {
int16_t maxMotor;
uint8_t i;
int16_t maxMotor,a;
uint8_t i,axis;

// int16_t tmp = 4*max(max(abs(rcCommand[ROLL]),abs(rcCommand[PITCH])),50);
// #define PIDMIX(X,Y,Z) rcCommand[THROTTLE] +constrain(axisPID[ROLL]*X + axisPID[PITCH]*Y,-tmp,+tmp) + YAW_DIRECTION * axisPID[YAW]*Z
#define PIDMIX(X,Y,Z) rcCommand[THROTTLE] + axisPID[ROLL]*X + axisPID[PITCH]*Y + YAW_DIRECTION * axisPID[YAW]*Z

//limit big wobble issues
for(axis=0;axis<2;axis++) {
a = abs(rcCommand[axis]);
axisPID[axis] = constrain(axisPID[axis],-MAX_CORRECTION-a,+MAX_CORRECTION+a);
}
#if NUMBER_MOTOR > 3
//prevent "yaw jump" during yaw correction
axisPID[YAW] = constrain(axisPID[YAW],-100-abs(rcCommand[YAW]),+100+abs(rcCommand[YAW]));
Expand All @@ -243,9 +246,9 @@ void mixTable() {
servo[1] = constrain(1500 + YAW_DIRECTION * (axisPID[YAW] - axisPID[PITCH]), 1020, 2000); //RIGHT
#endif
#ifdef TRI
motor[0] = PIDMIX( 0,+4/6, 0); //REAR
motor[1] = PIDMIX(-1,-1/6, 0); //RIGHT
motor[2] = PIDMIX(+1,-1/6, 0); //LEFT
motor[0] = PIDMIX( 0,+4/3, 0); //REAR
motor[1] = PIDMIX(-1,-2/3, 0); //RIGHT
motor[2] = PIDMIX(+1,-2/3, 0); //LEFT
servo[0] = constrain(TRI_YAW_MIDDLE + YAW_DIRECTION * axisPID[YAW], TRI_YAW_CONSTRAINT_MIN, TRI_YAW_CONSTRAINT_MAX); //REAR
#endif
#ifdef QUADP
Expand Down
5 changes: 5 additions & 0 deletions Sensors.pde
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
//#define ITG3200_ADDRESS 0XD2
#endif

#if !defined(MS561101BA_ADDRESS)
#define MS561101BA_ADDRESS 0xEE //CBR=0 0xEE I2C address when pin CSB is connected to LOW (GND)
//#define MS561101BA_ADDRESS 0xEF //CBR=1 0xEF I2C address when pin CSB is connected to HIGH (VCC)
#endif

uint8_t rawADC[6];
static uint32_t neutralizeTime = 0;

Expand Down
14 changes: 10 additions & 4 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@
#define I2C_SPEED 100000L //100kHz normal mode, this value must be used for a genuine WMP
//#define I2C_SPEED 400000L //400kHz fast mode, it works only with some WMP clones

//#define PROMINI //Arduino type
#define MEGA
#define PROMINI //Arduino type
//#define MEGA

//enable internal I2C pull ups
//#define INTERNAL_I2C_PULLUPS
#define INTERNAL_I2C_PULLUPS

//****** advanced users settings *************

/* this parameter defines the maximum correction per axis multiwii can output before mixing the output to different motors
this parameter becomes inactive as soon as the stick are far from the center position in order to keep acro abilities
reducing this parameter can avoid big wobbles and allows higher PID settings
*/
#define MAX_CORRECTION 100

/* Failsave settings - added by MIS
Failsafe check pulse on THROTTLE channel. If the pulse is OFF (on only THROTTLE or on all channels) the failsafe procedure is initiated.
After FAILSAVE_DELAY time of pulse absence, the level mode is on (if ACC or nunchuk is avaliable), PITCH, ROLL and YAW is centered
Expand Down Expand Up @@ -71,7 +77,7 @@
// for other boards, I'm not sure, the info was gathered via rc forums, be cautious

//#define FFIMUv1 // first 9DOF+baro board from Jussi, with HMC5843
#define FFIMUv2 // second version of 9DOF+baro board from Jussi, with HMC5883
//#define FFIMUv2 // second version of 9DOF+baro board from Jussi, with HMC5883
//#define FREEIMUv1 // v0.1 & v0.2 & v0.3 version of 9DOF board from Fabio
//#define FREEIMUv035 // FreeIMU v0.3.5 no baro
//#define FREEIMUv035_MS // FreeIMU v0.3.5_MS
Expand Down

0 comments on commit 377cfd3

Please sign in to comment.