DroFly support for 2.4

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
waderic
Posts: 14
Joined: Thu Aug 08, 2013 9:07 am
Location: France

DroFly support for 2.4

Post by waderic »

Hi,

Here is my code for DroFly support in Multiwii 2.4. I used code from Fernitronix :
http://www.fernitronix.fr/fr/multi-copt ... -de-drotek
I did not include SD card code but only flight controller code. Fernitronix's code worked without any change. I made successfull tests only with DroFly v3.

3 new defines are added in def.h
defined(DROTEK_DROFLY_V2)
defined(DROTEK_DROFLY_V3)
defined(DROTEK_DROFLY_V3_GPS)

In config.h, following define must be used for DroFly V3 with GPS
#define DROTEK_DROFLY_V3_GPS
#define GPS_SERIAL 2
#define UBLOX

Code: Select all

diff -crB 2.4/MultiWii/config.h 2.4_drofly/MultiWii/config.h
*** 2.4/MultiWii/config.h   2015-03-15 01:18:48.000000000 +0100
--- 2.4_drofly/MultiWii/config.h   2015-05-08 14:56:50.000000000 +0200
***************
*** 36,42 ****
      //#define BI
      //#define TRI
      //#define QUADP
!     //#define QUADX
      //#define Y4
      //#define Y6
      //#define HEX6
--- 36,42 ----
      //#define BI
      //#define TRI
      //#define QUADP
!     #define QUADX
      //#define Y4
      //#define Y6
      //#define HEX6
***************
*** 121,127 ****
        //#define DROTEK_10DOF_MS // Drotek 10DOF with ITG3200, BMA180, HMC5883, MS5611, LLC
        //#define DROTEK_6DOFv2   // Drotek 6DOF v2
        //#define DROTEK_6DOF_MPU // Drotek 6DOF with MPU6050
!       //#define DROTEK_10DOF_MPU//
        //#define MONGOOSE1_0     // mongoose 1.0    http://store.ckdevices.com/
        //#define CRIUS_LITE      // Crius MultiWii Lite
        //#define CRIUS_SE        // Crius MultiWii SE
--- 121,130 ----
        //#define DROTEK_10DOF_MS // Drotek 10DOF with ITG3200, BMA180, HMC5883, MS5611, LLC
        //#define DROTEK_6DOFv2   // Drotek 6DOF v2
        //#define DROTEK_6DOF_MPU // Drotek 6DOF with MPU6050
!       //#define DROTEK_10DOF_MPU//   
!       //#define DROTEK_DROFLY_V2//
!       //#define DROTEK_DROFLY_V3// Drotek DroFlyPro "V3" with MPU6050 and MS5611BA
!         #define DROTEK_DROFLY_V3_GPS// Drotek DroFlyPro "V3" with MPU6050 and MS5561BBA +  UBLOX GPS and HMC5883L integrated
        //#define MONGOOSE1_0     // mongoose 1.0    http://store.ckdevices.com/
        //#define CRIUS_LITE      // Crius MultiWii Lite
        //#define CRIUS_SE        // Crius MultiWii SE
***************
*** 664,670 ****
         in NMEA mode the GPS must be configured to output GGA and RMC NMEA sentences (which is generally the default conf for most GPS devices)
         at least 5Hz update rate. uncomment the first line to select the GPS serial port of the arduino */
         
!     //#define GPS_SERIAL 2         // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
                                     // must be 0 for PRO_MINI (ex GPS_PRO_MINI)
                                     // note: Now a GPS can share MSP on the same port. The only constrain is to not use it simultaneously, and use the same port speed.
 
--- 667,673 ----
         in NMEA mode the GPS must be configured to output GGA and RMC NMEA sentences (which is generally the default conf for most GPS devices)
         at least 5Hz update rate. uncomment the first line to select the GPS serial port of the arduino */
         
!     #define GPS_SERIAL 2         // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
                                     // must be 0 for PRO_MINI (ex GPS_PRO_MINI)
                                     // note: Now a GPS can share MSP on the same port. The only constrain is to not use it simultaneously, and use the same port speed.
 
***************
*** 679,685 ****
 
     
      //#define NMEA
!     //#define UBLOX
      //#define MTK_BINARY16
      //#define MTK_BINARY19
      //#define INIT_MTK_GPS        // initialize MTK GPS for using selected speed, 5Hz update rate and GGA & RMC sentence or binary settings
--- 682,688 ----
 
     
      //#define NMEA
!     #define UBLOX
      //#define MTK_BINARY16
      //#define MTK_BINARY19
      //#define INIT_MTK_GPS        // initialize MTK GPS for using selected speed, 5Hz update rate and GGA & RMC sentence or binary settings
diff -crB 2.4/MultiWii/def.h 2.4_drofly/MultiWii/def.h
*** 2.4/MultiWii/def.h   2015-03-14 15:45:20.000000000 +0100
--- 2.4_drofly/MultiWii/def.h   2015-04-05 15:52:35.000000000 +0200
***************
*** 1198,1203 ****
--- 1198,1254 ----
    #undef INTERNAL_I2C_PULLUPS
  #endif
 
+ #if defined(DROTEK_DROFLY_V2)
+ #if defined PILOTLAMP
+ #define BUZZERPIN_PINMODE          pinMode (11, OUTPUT);
+ #define    PL_PIN_ON    PORTB |= 1<<5;
+ #define    PL_PIN_OFF   PORTB &= ~(1<<5);
+ #else
+ #define BUZZERPIN_PINMODE          pinMode (11, OUTPUT);
+ #define BUZZERPIN_ON               PORTB |= 1<<5;
+ #define BUZZERPIN_OFF              PORTB &= ~(1<<5);
+ #endif
+ #define MPU6050
+ #define HMC5883
+ #define MS561101BA
+ #define ACC_ORIENTATION(X, Y, Z)  {imu.accADC[ROLL]  =  Y; imu.accADC[PITCH]  = -X; imu.accADC[YAW]  = Z;}
+ #define GYRO_ORIENTATION(X, Y, Z) {imu.gyroADC[ROLL] =  X; imu.gyroADC[PITCH] = Y; imu.gyroADC[YAW] = -Z;}
+ #define MAG_ORIENTATION(X, Y, Z)  {imu.magADC[ROLL]  =  -Y; imu.magADC[PITCH]  = X; imu.magADC[YAW]  = -Z;}
+ #define MPU6050_ADDRESS 0X69
+ #define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050
+ #undef INTERNAL_I2C_PULLUPS
+
+ #endif
+
+ #if defined(DROTEK_DROFLY_V3)||defined (DROTEK_DROFLY_V3_GPS)
+ #define MPU6050
+ #define MS561101BA
+ #define ACC_ORIENTATION(X, Y, Z)  {imu.accADC[ROLL]  =  Y; imu.accADC[PITCH]  = -X; imu.accADC[YAW]  = Z;}
+ #define GYRO_ORIENTATION(X, Y, Z) {imu.gyroADC[ROLL] =  X; imu.gyroADC[PITCH] = Y; imu.gyroADC[YAW] = -Z;}
+ #if defined (DROTEK_DROFLY_V3_GPS)
+ #define HMC5883
+ #define MAG_ORIENTATION(X, Y, Z)  {imu.magADC[ROLL]  =  Y; imu.magADC[PITCH]  = X; imu.magADC[YAW]  = Z;}
+ #endif
+ #define MPU6050_ADDRESS 0X69
+ #undef INTERNAL_I2C_PULLUPS
+ #define LEDPIN_PINMODE             pinMode (13, OUTPUT);pinMode (30, OUTPUT);
+ #define LEDPIN_TOGGLE              PINB  |= (1<<7); PINC  |= (1<<7);
+ #define LEDPIN_ON                  PORTB |= (1<<7); PORTC |= (1<<7);
+ #define LEDPIN_OFF                 PORTB &= ~(1<<7);PORTC &= ~(1<<7);
+ #define STABLEPIN_PINMODE          pinMode (30, OUTPUT);
+ #define STABLEPIN_ON               PORTC |= 1<<7;
+ #define STABLEPIN_OFF              PORTC &= ~(1<<7);
+ #if defined PILOTLAMP
+ #define BUZZERPIN_PINMODE          pinMode (11, OUTPUT);
+ #define    PL_PIN_ON    PORTB |= 1<<5;
+ #define    PL_PIN_OFF   PORTB &= ~(1<<5);
+ #else
+ #define BUZZERPIN_PINMODE          pinMode (11, OUTPUT);
+ #define BUZZERPIN_ON               PORTB |= 1<<5;
+ #define BUZZERPIN_OFF              PORTB &= ~(1<<5);
+ #endif
+ #endif
+
  #if defined(FLYDUINO_MPU)
    #define MPU6050
    #define ACC_ORIENTATION(X, Y, Z) {imu.accADC[ROLL] = X; imu.accADC[PITCH] = Y; imu.accADC[YAW] = Z;}

Post Reply