diff --git a/Multiprotocol/Symax_nrf24l01.ino b/Multiprotocol/Symax_nrf24l01.ino index 3506140..60ea9e9 100644 --- a/Multiprotocol/Symax_nrf24l01.ino +++ b/Multiprotocol/Symax_nrf24l01.ino @@ -30,6 +30,7 @@ #define SYMAX_FLAG_VIDEO 0x02 #define SYMAX_FLAG_PICTURE 0x04 #define SYMAX_FLAG_HEADLESS 0x08 +#define SYMAX_XTRM_RATES 0x10 #define SYMAX_PAYLOADSIZE 10 // receive data pipes set to this size, but unused #define SYMAX_MAX_PACKET_LENGTH 16 // X11,X12,X5C-1 10-byte, X5C 16-byte @@ -58,6 +59,7 @@ static void __attribute__((unused)) SYMAX_read_controls() { // Protocol is registered AETRF, that is // Aileron is channel 1, Elevator - 2, Throttle - 3, Rudder - 4, Flip control - 5 + // Extended (trim-added) Rates - 6, Photo - 7, Video - 8, Headless - 9 aileron = convert_channel_s8b(AILERON); elevator = convert_channel_s8b(ELEVATOR); throttle = convert_channel_8b(THROTTLE); @@ -67,6 +69,9 @@ static void __attribute__((unused)) SYMAX_read_controls() // Channel 5 if (Servo_AUX1) flags = SYMAX_FLAG_FLIP; + // Channel 6 + if (Servo_AUX2) + flags |= SYMAX_XTRM_RATES; // Channel 7 if (Servo_AUX3) flags |= SYMAX_FLAG_PICTURE; @@ -76,6 +81,7 @@ static void __attribute__((unused)) SYMAX_read_controls() // Channel 9 if (Servo_AUX5) flags |= SYMAX_FLAG_HEADLESS; + flags &= ~SYMAX_XTRM_RATES; // Extended rates & headless incompatible } #define X5C_CHAN2TRIM(X) ((((X) & 0x80 ? 0xff - (X) : 0x80 + (X)) >> 2) + 0x20) @@ -98,9 +104,15 @@ static void __attribute__((unused)) SYMAX_build_packet_x5c(uint8_t bind) packet[1] = rudder; packet[2] = elevator ^ 0x80; // reversed from default packet[3] = aileron; - packet[4] = X5C_CHAN2TRIM(rudder ^ 0x80);// drive trims for extra control range - packet[5] = X5C_CHAN2TRIM(elevator); - packet[6] = X5C_CHAN2TRIM(aileron ^ 0x80); + if (flags & SYMAX_XTRM_RATES) { // drive trims for extra control range + packet[4] = X5C_CHAN2TRIM(rudder ^ 0x80); + packet[5] = X5C_CHAN2TRIM(elevator); + packet[6] = X5C_CHAN2TRIM(aileron ^ 0x80); + } else { + packet[4] = 0x00; + packet[5] = 0x00; + packet[6] = 0x00; + } packet[7] = 0xae; packet[8] = 0xa9; packet[9] = 0x00; @@ -138,9 +150,14 @@ static void __attribute__((unused)) SYMAX_build_packet(uint8_t bind) packet[2] = rudder; packet[3] = aileron; packet[4] = (flags & SYMAX_FLAG_VIDEO ? 0x80 : 0x00) | (flags & SYMAX_FLAG_PICTURE ? 0x40 : 0x00); - packet[5] = (elevator >> 2) | 0xc0; //always high rates (bit 7 is rate control) - packet[6] = (rudder >> 2) | (flags & SYMAX_FLAG_FLIP ? 0x40 : 0x00); - packet[7] = (aileron >> 2) | (flags & SYMAX_FLAG_HEADLESS ? 0x80 : 0x00); + packet[5] = 0xc0; //always high rates (bit 7 is rate control) + packet[6] = flags & SYMAX_FLAG_FLIP ? 0x40 : 0x00; + packet[7] = flags & SYMAX_FLAG_HEADLESS ? 0x80 : 0x00; + if (flags & SYMAX_XTRM_RATES) { // use trims to extend controls + packet[5] |= elevator >> 2; + packet[6] |= rudder >> 2; + packet[7] |= aileron >> 2; + } packet[8] = 0x00; } packet[9] = SYMAX_checksum(packet); diff --git a/docs/Models.md b/docs/Models.md index a9d8293..0aaa547 100644 --- a/docs/Models.md +++ b/docs/Models.md @@ -7,9 +7,9 @@ The Deviation project (on which this project was based) have a useful list of mo ## Channel Map -CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8 ----|---|---|---|---|---|---|--- -A|E|T|R|FLIP|RATES|PICTURE|VIDEO +CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9 +---|---|---|---|---|---|---|---|--- +A|E|T|R|FLIP|RATES|PICTURE|VIDEO|HEADLESS ## Binding There are no special binding instructions. The model powers up in Autobind mode and expects the bind sequence from the transmitter within the first 4-5 seconds. @@ -45,6 +45,25 @@ One of the most annoying functions on the Syma X5C is that the motors stop when 1. When you want to fly in "idle-up" mode flick the switch and your stabilization will always be active. 1. Remeber to switch off idle-up as soon as the quad lands (or crashes - to avoid damage to the motors) +### Additional notes on rates: + +The SymaX driver can add full trim to the control output. Doing so enables +dramatic rates, steep angles, and high speeds. If CH6 is low, the usual Syma +full rates will be in effect. If CH6 is high, the SymaX extreme trim rates will be +in effect. Be cautious when first trying out the extreme rates. + +The extreme rates do not work with with headless mode because in this +mode the trim and the primary control directions may not be aligned - the +primary control directions will be based on the headless mode, but the trims +remain based upon the quadcopter's heading. So extreme rates are disabled +when headless mode is selected. + +Be aware that the use of extreme rates and the resulting steep angles will +disorient the gyro responsible for maintaining headless mode, and that the +direction the quadcopter thinks you selected for headless mode may not be +correct after especially wild flights. + + # Inductrix (Horizon Hobby)