mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-12 17:57:53 +00:00
Telemetry working; moved power override bit
This commit is contained in:
parent
810b8a07ac
commit
d26404ca85
@ -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_CHANNEL_REDUCTION 0x0F
|
||||||
#define CABELL_OPTION_MASK_RECIEVER_OUTPUT_MODE 0x30
|
#define CABELL_OPTION_MASK_RECIEVER_OUTPUT_MODE 0x30
|
||||||
#define CABELL_OPTION_SHIFT_RECIEVER_OUTPUT_MODE 4
|
#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 {
|
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
|
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;
|
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 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
|
* mask 0x30>>4 : Reciever outout mode
|
||||||
* 0 = Single PPM on individual pins for each channel
|
* 0 (00) = Single PPM on individual pins for each channel
|
||||||
* 1 = SUM PPM on channel 1 pin
|
* 1 (01) = SUM PPM on channel 1 pin
|
||||||
* mask 0x40>>6 Unused
|
* 2 (10) = Future use. Reserved for SBUS output
|
||||||
* mask 0x80>>7 Unused by RX. Contains max power override flag for Multiprotocol T module
|
* 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 modelNum;
|
||||||
uint8_t checkSum_LSB;
|
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
|
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0F); // RX mode with 16 bit CRC
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CABELL_SetPower();
|
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_1C_DYNPD, 0x3F); // Enable dynamic payload length on all pipes
|
||||||
NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x04); // Enable dynamic Payload Length
|
NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x04); // Enable dynamic Payload Length
|
||||||
NRF24L01_Activate(0x73);
|
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
|
// 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
|
// 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
|
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);
|
uint8_t rf_setup = NRF24L01_ReadReg(NRF24L01_06_RF_SETUP);
|
||||||
|
@ -505,7 +505,7 @@ uint8_t Update_All()
|
|||||||
update_led_status();
|
update_led_status();
|
||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
#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
|
#endif
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,6 +134,7 @@ void NRF24L01_SetBitrate(uint8_t bitrate)
|
|||||||
// Bit 0 goes to RF_DR_HIGH, bit 1 - to RF_DR_LOW
|
// Bit 0 goes to RF_DR_HIGH, bit 1 - to RF_DR_LOW
|
||||||
rf_setup = (rf_setup & 0xD7) | ((bitrate & 0x02) << 4) | ((bitrate & 0x01) << 3);
|
rf_setup = (rf_setup & 0xD7) | ((bitrate & 0x02) << 4) | ((bitrate & 0x01) << 3);
|
||||||
NRF24L01_WriteReg(NRF24L01_06_RF_SETUP, rf_setup);
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -608,7 +608,7 @@ void TelemetryUpdate()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((telemetry_link & 1 )&& protocol != MODE_FRSKYX)
|
if((telemetry_link & 1 )&& protocol != MODE_FRSKYX)
|
||||||
{ // FrSkyD + Hubsan + AFHDS2A + Bayang
|
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell
|
||||||
frsky_link_frame();
|
frsky_link_frame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user