mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 15:58:12 +00:00
SX1276: RF power adjustment for DIY & Jumper T-Lite
This commit is contained in:
parent
ae842f0bdc
commit
2233f6f862
@ -205,7 +205,14 @@ void FRSKYR9_init()
|
||||
SX1276_SetDetectionThreshold(SX1276_MODEM_DETECTION_THRESHOLD_SF6);
|
||||
SX1276_SetLna(1, true);
|
||||
SX1276_SetHopPeriod(0); // 0 = disabled, we hop frequencies manually
|
||||
SX1276_SetPaDac(true);
|
||||
//RF Power
|
||||
SX1276_SetPaDac(false); // Disable 20dBm mode
|
||||
#if MULTI_5IN1_INTERNAL == JP_T18
|
||||
SX1276_SetPaConfig(true, 7, 0); // Lowest power for the T18: 2dBm
|
||||
#else
|
||||
SX1276_SetPaConfig(true, 7, option); // Use PA_HP on PA_BOOST, power=17-(15-option) dBm with option equal or lower to 15
|
||||
#endif
|
||||
SX1276_SetOcp(true,27); // Set OCP to max 240mA
|
||||
SX1276_SetTxRxMode(TX_EN); // Set RF switch to TX
|
||||
//Enable all IRQ flags
|
||||
SX1276_WriteReg(SX1276_11_IRQFLAGSMASK,0x00);
|
||||
@ -226,8 +233,14 @@ uint16_t FRSKYR9_callback()
|
||||
FrSkyR9_set_frequency(); // Set current center frequency
|
||||
//Set power
|
||||
// max power: 15dBm (10.8 + 0.6 * MaxPower [dBm])
|
||||
// output_power: 2 dBm (17-(15-OutputPower) (if pa_boost_pin == true))
|
||||
SX1276_SetPaConfig(true, 7, 0); // Lowest power for the T18
|
||||
// output_power: 2 dBm ( (if pa_boost_pin == true))
|
||||
#if MULTI_5IN1_INTERNAL != JP_T18
|
||||
if(option != prev_option)
|
||||
{ // Set RF power if it has changed
|
||||
SX1276_SetPaConfig(true, 7, option); // Use PA_HP on PA_BOOST, power=17-(15-option) dBm with option equal or lower to 15
|
||||
prev_option = option;
|
||||
}
|
||||
#endif
|
||||
//Build packet
|
||||
if( packet_length == 26 )
|
||||
FrSkyR9_build_packet();
|
||||
|
@ -166,6 +166,7 @@ enum
|
||||
OPTION_MAXTHR,
|
||||
OPTION_RFCHAN,
|
||||
OPTION_RFPOWER,
|
||||
OPTION_WBUS,
|
||||
};
|
||||
|
||||
#define NO_SUBTYPE nullptr
|
||||
@ -266,7 +267,11 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{PROTO_FRSKYL, STR_FRSKYL, STR_SUBTYPE_FRSKYL, 2, OPTION_RFTUNE, 0, 0, SW_CC2500, FRSKYL_init, FRSKYL_callback },
|
||||
#endif
|
||||
#if defined(FRSKYR9_SX1276_INO)
|
||||
#if MULTI_5IN1_INTERNAL == T18
|
||||
{PROTO_FRSKY_R9, STR_FRSKYR9, STR_SUBTYPE_FRSKYR9, 8, OPTION_NONE, 1, 0, 0, FRSKYR9_init, FRSKYR9_callback },
|
||||
#else // DIY & T-Lite
|
||||
{PROTO_FRSKY_R9, STR_FRSKYR9, STR_SUBTYPE_FRSKYR9, 8, OPTION_RFPOWER, 1, 0, 0, FRSKYR9_init, FRSKYR9_callback },
|
||||
#endif
|
||||
#endif
|
||||
#if defined(FUTABA_CC2500_INO)
|
||||
{PROTO_FUTABA, STR_FUTABA, STR_SUBTYPE_FUTABA, 1, OPTION_RFTUNE, 1, 1, SW_CC2500, SFHSS_init, SFHSS_callback },
|
||||
@ -402,6 +407,7 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
#endif
|
||||
#if defined(WFLY2_A7105_INO)
|
||||
{PROTO_WFLY2, STR_WFLY2, STR_SUBTYPE_WFLY2, 1, OPTION_OPTION, 1, 0, SW_A7105, WFLY2_init, WFLY2_callback },
|
||||
// {PROTO_WFLY2, STR_WFLY2, STR_SUBTYPE_WFLY2, 1, OPTION_WBUS, 1, 0, SW_A7105, WFLY2_init, WFLY2_callback },// crash OpenTX...
|
||||
#endif
|
||||
#if defined(XK_NRF24L01_INO)
|
||||
{PROTO_XK, STR_XK, STR_SUBTYPE_XK, 2, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback },
|
||||
@ -423,4 +429,3 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
#endif
|
||||
{0x00, nullptr, nullptr, 0, 0, 0, 0, 0, nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 2
|
||||
#define VERSION_PATCH_LEVEL 47
|
||||
#define VERSION_PATCH_LEVEL 48
|
||||
|
||||
//******************
|
||||
// Protocols
|
||||
@ -734,6 +734,10 @@ enum CYRF_POWER
|
||||
#define CYRF_RANGE_POWER CYRF_POWER_1 // 1/30 of the full power distance
|
||||
#define CYRF_BIND_POWER CYRF_POWER_0
|
||||
|
||||
// SX1276
|
||||
#define JP_T18 0
|
||||
#define JP_TLite 1
|
||||
|
||||
enum TXRX_State {
|
||||
TXRX_OFF,
|
||||
TX_EN,
|
||||
@ -1152,16 +1156,17 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
[11] Prev valid protocol number, can be used to skip invalid protocols
|
||||
[12..18] Protocol name [7], not null terminated if prototcol len == 7
|
||||
[19>>4] Option text to be displayed:
|
||||
OPTION_NONE 0
|
||||
OPTION_OPTION 1
|
||||
OPTION_RFTUNE 2
|
||||
OPTION_VIDFREQ 3
|
||||
OPTION_FIXEDID 4
|
||||
OPTION_TELEM 5
|
||||
OPTION_SRVFREQ 6
|
||||
OPTION_MAXTHR 7
|
||||
OPTION_RFCHAN 8
|
||||
OPTION_RFPOWER 9
|
||||
OPTION_NONE 0 Hidden field
|
||||
OPTION_OPTION 1 "Option:" value=-128..0(default)..127
|
||||
OPTION_RFTUNE 2 "RF freq tune:" value=-128..0(default)..127
|
||||
OPTION_VIDFREQ 3 "Video freq:" value=-128..0(default)..127
|
||||
OPTION_FIXEDID 4 "ID type:" value="Auto":0(default), "Fixed":1
|
||||
OPTION_TELEM 5 "Telem:" value="Off":0(default), "On":1, "Off+Aux":2, "On+Aux":3
|
||||
OPTION_SRVFREQ 6 "Servo freq(Hz):" value="50":0(default).."400":70 => display=50+5*option with option=0..70
|
||||
OPTION_MAXTHR 7 "Max throw:" value="Disabled":0, "Enabled":1
|
||||
OPTION_RFCHAN 8 "Select RF chan:" value=-128..0(default)..127
|
||||
OPTION_RFPOWER 9 "RF power:" "1.6mW":0(default),"2.0mW":1,"2.5mW":2,"3.2mW":3,"4.0mW":4,"5.0mW":5,"6.3mW":6,"7.9mW":7,"10mW\0":8,"13mW\0":9,"16mW\0":10,"20mW\0":11,"25mW\0":12,"32mW\0":13,"40mW\0":14,"50mW\0":15
|
||||
OPTION_WBUS 10 "Output:" "WBUS":0(default),"PPM":1
|
||||
[19&0x0F] Number of sub protocols
|
||||
[20..27] Sub protocol name [8], not null terminated if sub prototcol len == 8
|
||||
If the current protocol is invalid [12..27] are all 0x00.
|
||||
|
@ -230,11 +230,16 @@ void SX1276_SetPaConfig(bool pa_boost_pin, uint8_t max_power, uint8_t output_pow
|
||||
uint8_t data = 0x00;
|
||||
data = data | (pa_boost_pin << 7);
|
||||
data = data | (max_power << 4);
|
||||
data = data | output_power;
|
||||
data = data | (output_power & 0x0F);
|
||||
|
||||
SX1276_WriteReg(SX1276_09_PACONFIG, data);
|
||||
}
|
||||
|
||||
void SX1276_SetOcp(bool OcpOn, uint8_t OcpTrim)
|
||||
{
|
||||
SX1276_WriteReg(SX1276_0B_OCP, (OcpOn << 5) | OcpTrim);
|
||||
}
|
||||
|
||||
void SX1276_WritePayloadToFifo(uint8_t* payload, uint8_t length)
|
||||
{
|
||||
SX1276_WriteReg(SX1276_22_PAYLOAD_LENGTH, length);
|
||||
|
@ -423,6 +423,7 @@
|
||||
#endif
|
||||
#if not defined(DSM_CYRF6936_INO)
|
||||
#undef DSM_TELEMETRY
|
||||
#undef DSM_FWD_PGM
|
||||
#endif
|
||||
#if not defined(MLINK_CYRF6936_INO)
|
||||
#undef MLINK_HUB_TELEMETRY
|
||||
|
@ -80,9 +80,10 @@
|
||||
#define NRF24L01_INSTALLED
|
||||
//#define SX1276_INSTALLED // only supported on STM32 modules
|
||||
|
||||
//Uncomment (remove //) if you have an internal 5-in-1 Multi module.
|
||||
//Uncomment (remove //) if you have an internal 5-in-1 Multi module in a Jumper T18 or T-Lite.
|
||||
//All components are considered to be installed and specifics to that module are automatically configured
|
||||
//#define MULTI_5IN1_INTERNAL
|
||||
//#define MULTI_5IN1_INTERNAL JP_T18
|
||||
//#define MULTI_5IN1_INTERNAL JP_TLite
|
||||
|
||||
/** OrangeRX TX **/
|
||||
//If you compile for the OrangeRX TX module you need to select the correct board type.
|
||||
|
Loading…
x
Reference in New Issue
Block a user