diff --git a/ArducopterNG/ArduUser.h b/ArducopterNG/ArduUser.h index 7fd5b34073..963d0240a8 100644 --- a/ArducopterNG/ArduUser.h +++ b/ArducopterNG/ArduUser.h @@ -83,7 +83,7 @@ TODO: #define AUX_MID 1500 #define CHANN_CENTER 1500 // Channel center, legacy -#define MIN_THROTTLE 1080 // Throttle pulse width at minimun... +#define MIN_THROTTLE 1040 // Throttle pulse width at minimun... /*************************************************************/ // General definitions diff --git a/ArducopterNG/Arducopter.h b/ArducopterNG/Arducopter.h index eca11c866b..1a2e117b66 100644 --- a/ArducopterNG/Arducopter.h +++ b/ArducopterNG/Arducopter.h @@ -335,6 +335,7 @@ int leftMotor; int rightMotor; byte motorArmed = 0; int minThrottle = 0; +boolean flightOrientation = 0; // 0 = +, 1 = x this is read from DIP1 switch during system bootup // Serial communication char queryType; diff --git a/ArducopterNG/ArducopterNG.pde b/ArducopterNG/ArducopterNG.pde index b71a133c50..4410d36486 100644 --- a/ArducopterNG/ArducopterNG.pde +++ b/ArducopterNG/ArducopterNG.pde @@ -84,9 +84,11 @@ // Flight & Electronics orientation // Frame build condiguration -#define FLIGHT_MODE_+ // Traditional "one arm as nose" frame configuration +//#define FLIGHT_MODE_+ // Traditional "one arm as nose" frame configuration //#define FLIGHT_MODE_X // Frame orientation 45 deg to CCW, nose between two arms - +// 19-10-10 by JP +// This feature has been disabled for now, if you want to change between flight orientations +// just use DIP switch for that. DIP1 down = X, DIP1 up = + // Magneto orientation and corrections. // If you don't have magneto actiavted, It is safe to ignore these @@ -202,6 +204,10 @@ void setup() { // external command/telemetry // Battery monitor + + +/* ***************************************************** */ +// Main loop void loop() { //int aux; diff --git a/ArducopterNG/Radio.pde b/ArducopterNG/Radio.pde index 9eb2d7debb..e112113595 100644 --- a/ArducopterNG/Radio.pde +++ b/ArducopterNG/Radio.pde @@ -65,16 +65,17 @@ void read_radio() if (flightMode==STABLE_MODE) // IN STABLE MODE we convert stick positions to absoulte angles { // In Stable mode stick position defines the desired angle in roll, pitch and yaw - #ifdef FLIGHT_MODE_X +// #ifdef FLIGHT_MODE_X + if(!flightOrientation) { // For X mode we make a mix in the input float aux_roll = (ch_roll-roll_mid) / STICK_TO_ANGLE_FACTOR; float aux_pitch = (ch_pitch-pitch_mid) / STICK_TO_ANGLE_FACTOR; command_rx_roll = aux_roll - aux_pitch; command_rx_pitch = aux_roll + aux_pitch; - #else + } else { command_rx_roll = (ch_roll-roll_mid) / STICK_TO_ANGLE_FACTOR; // Convert stick position to absolute angles command_rx_pitch = (ch_pitch-pitch_mid) / STICK_TO_ANGLE_FACTOR; - #endif + } // YAW if (abs(ch_yaw-yaw_mid)>6) // Take into account a bit of "dead zone" on yaw diff --git a/ArducopterNG/System.pde b/ArducopterNG/System.pde index 2d99f2bdeb..1a1f02a5b8 100644 --- a/ArducopterNG/System.pde +++ b/ArducopterNG/System.pde @@ -93,7 +93,23 @@ void APM_Init() { #endif #endif - readUserConfig(); // Load user configurable items from EEPROM + // Read DIP Switches and other important values. DIP switches needs special functions to + // read due they are not defined as normal pins like other GPIO's are. + SW_DIP1 = APMPinRead(PINE, 7); + SW_DIP2 = APMPinRead(PINE, 6); + SW_DIP3 = APMPinRead(PINL, 6); + SW_DIP4 = APMPinRead(PINL, 7); + + /* Works, tested 18-10-10 JP + if(SW_DIP1) { + SerPrln("+ mode"); + } else { + SerPrln("x mode"); + } + */ + + flightOrientation = SW_DIP1; // DIP1 off = we are in + mode, DIP1 on = we are in x mode + readUserConfig(); // Load user configurable items from EEPROM // Safety measure for Channel mids if(roll_mid < 1400 || roll_mid > 1600) roll_mid = 1500; @@ -155,22 +171,6 @@ void APM_Init() { delay(1000); - // Read DIP Switches and other important values. DIP switches needs special functions to - // read due they are not defined as normal pins like other GPIO's are. - SW_DIP1 = APMPinRead(PINE, 7); - SW_DIP2 = APMPinRead(PINE, 6); - SW_DIP3 = APMPinRead(PINL, 6); - SW_DIP4 = APMPinRead(PINL, 7); - - /* Works, tested 18-10-10 JP - if(SW_DIP1) { - SerPrln("+ mode"); - } else { - SerPrln("x mode"); - } - */ - - DataFlash.StartWrite(1); // Start a write session on page 1 //timer = millis(); //tlmTimer = millis();