Flysky/CX20 reversed elevator channel

This commit is contained in:
pascallanger 2016-12-02 20:28:42 +01:00
parent d6b4437664
commit c24f7a86d4
2 changed files with 7 additions and 8 deletions

View File

@ -144,8 +144,11 @@ static void __attribute__((unused)) flysky_build_packet(uint8_t init)
packet[4] = rx_tx_addr[0];
for(i = 0; i < 8; i++)
{
packet[5 + i*2]=Servo_data[CH_AETR[i]]&0xFF; //low byte of servo timing(1000-2000us)
packet[6 + i*2]=(Servo_data[CH_AETR[i]]>>8)&0xFF; //high byte of servo timing(1000-2000us)
uint16_t temp=Servo_data[CH_AETR[i]];
if(sub_protocol == CX20 && CH_AETR[i] == ELEVATOR)
temp=servo_mid-temp; //reverse channel
packet[5 + i*2]=temp&0xFF; //low byte of servo timing(1000-2000us)
packet[6 + i*2]=(temp>>8)&0xFF; //high byte of servo timing(1000-2000us)
}
flysky_apply_extension_flags();
}

View File

@ -62,9 +62,7 @@ uint8_t packet[40];
uint16_t Servo_data[NUM_CHN];
uint8_t Servo_AUX;
uint16_t servo_max_100,servo_min_100,servo_max_125,servo_min_125;
#if defined(REVERSE_AILERON) || defined(REVERSE_ELEVATOR) || defined(REVERSE_THROTTLE) || defined(REVERSE_RUDDER)
uint16_t servo_mid;
#endif
uint16_t servo_mid;
// Protocol variables
uint8_t cyrfmfg_id[6];//for dsm2 and devo
@ -371,9 +369,7 @@ void setup()
Mprotocol_serial_init(); // Configure serial and enable RX interrupt
#endif //ENABLE_SERIAL
}
#if defined(REVERSE_AILERON) || defined(REVERSE_ELEVATOR) || defined(REVERSE_THROTTLE) || defined(REVERSE_RUDDER)
servo_mid=servo_min_100+servo_max_100; //In fact 2* mid_value
#endif
servo_mid=servo_min_100+servo_max_100; //In fact 2* mid_value
}
// Main