Telemetry working; moved power override bit

This commit is contained in:
Dennis 2017-05-07 19:10:02 -04:00
parent 810b8a07ac
commit d26404ca85
4 changed files with 14 additions and 10 deletions

View File

@ -45,7 +45,7 @@ Multiprotocol is distributed in the hope that it will be useful,
#define CABELL_OPTION_MASK_CHANNEL_REDUCTION 0x0F
#define CABELL_OPTION_MASK_RECIEVER_OUTPUT_MODE 0x30
#define CABELL_OPTION_SHIFT_RECIEVER_OUTPUT_MODE 4
#define CABELL_OPTION_MASK_MAX_POWER_OVERRIDE 0x80
#define CABELL_OPTION_MASK_MAX_POWER_OVERRIDE 0x40
typedef struct {
enum RxMode_t : uint8_t { // Note bit 8 is used to indicate if the packet is the first of 2 on the channel. Mask out this bit before using the enum
@ -60,10 +60,12 @@ typedef struct {
uint8_t option;
/* mask 0x0F : Channel reduction. The number of channels to not send (subtracted frim the 16 max channels) at least 4 are always sent
* mask 0x30>>4 : Reciever outout mode
* 0 = Single PPM on individual pins for each channel
* 1 = SUM PPM on channel 1 pin
* mask 0x40>>6 Unused
* mask 0x80>>7 Unused by RX. Contains max power override flag for Multiprotocol T module
* 0 (00) = Single PPM on individual pins for each channel
* 1 (01) = SUM PPM on channel 1 pin
* 2 (10) = Future use. Reserved for SBUS output
* 3 (11) = Unused
* mask 0x40>>6 Contains max power override flag for Multiprotocol TX module. Also sent to RX
* mask 0x80>>7 Unused
*/
uint8_t modelNum;
uint8_t checkSum_LSB;
@ -258,8 +260,8 @@ static void __attribute__((unused)) CABELL_send_packet(uint8_t bindMode)
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0F); // RX mode with 16 bit CRC
}
#endif
CABELL_SetPower();
}
//-----------------------------------------------------------------------------------------
@ -364,6 +366,7 @@ static void __attribute__((unused)) CABELL_init()
NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3F); // Enable dynamic payload length on all pipes
NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x04); // Enable dynamic Payload Length
NRF24L01_Activate(0x73);
prev_power = NRF_POWER_0;
}
//-----------------------------------------------------------------------------------------
@ -371,7 +374,7 @@ static void CABELL_SetPower() // This over-ride the standard Set Power to all
// Note that on many modules max power may actually be worse than the normal high power setting
// test and only use max if it helps the range
{
if(IS_BIND_DONE_on && !IS_RANGE_FLAG_on && (option & CABELL_OPTION_MASK_MAX_POWER_OVERRIDE)) { // If we are not in range or bind mode and power setting override is in effect, then set max power, else standard pawer logic
if(IS_BIND_DONE_on && !IS_RANGE_FLAG_on && ((option & CABELL_OPTION_MASK_MAX_POWER_OVERRIDE) != 0)) { // If we are not in range or bind mode and power setting override is in effect, then set max power, else standard pawer logic
if(prev_power != NRF_POWER_3) // prev_power is global variable for NRF24L01; NRF_POWER_3 is max power
{
uint8_t rf_setup = NRF24L01_ReadReg(NRF24L01_06_RF_SETUP);

View File

@ -505,7 +505,7 @@ uint8_t Update_All()
update_led_status();
#if defined(TELEMETRY)
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
if((protocol==MODE_FRSKYD) || (protocol==MODE_BAYANG) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) )
if((protocol==MODE_FRSKYD) || (protocol==MODE_BAYANG) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) || (protocol==MODE_CABELL) )
#endif
TelemetryUpdate();
#endif

View File

@ -134,6 +134,7 @@ void NRF24L01_SetBitrate(uint8_t bitrate)
// Bit 0 goes to RF_DR_HIGH, bit 1 - to RF_DR_LOW
rf_setup = (rf_setup & 0xD7) | ((bitrate & 0x02) << 4) | ((bitrate & 0x01) << 3);
NRF24L01_WriteReg(NRF24L01_06_RF_SETUP, rf_setup);
prev_power = NRF_POWER_0; // Power setting was just reset. This will get updated in the next call to SetPower
}
/*
@ -681,4 +682,4 @@ void LT8900_WritePayload(uint8_t* msg, uint8_t len)
NRF24L01_WritePayload(LT8900_buffer+LT8900_buffer_start,pos_final+pos-LT8900_buffer_start);
}
// End of LT8900 emulation
#endif
#endif

View File

@ -608,7 +608,7 @@ void TelemetryUpdate()
#endif
if((telemetry_link & 1 )&& protocol != MODE_FRSKYX)
{ // FrSkyD + Hubsan + AFHDS2A + Bayang
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell
frsky_link_frame();
return;
}