Fix RFM69 code, broken when introducing PilotAware

pull/30/head
Pawel Jalocha 2020-12-14 19:10:21 +00:00
rodzic 14039f2f10
commit d51f1b0c42
4 zmienionych plików z 27 dodań i 10 usunięć

Wyświetl plik

@ -269,7 +269,7 @@ void OLED_DrawRF(u8g2_t *OLED, GPS_Position *GPS) // RF
uint8_t Len=0;
#ifdef WITH_RFM69
Len+=Format_String(Line+Len, "RFM69"); // Type of RF chip used
if(Parameters.isTxTypeHW()) Line[Len++]='H';
if(Parameters.RFchipTypeHW) Line[Len++]='H';
Line[Len++]='W';
#endif
#ifdef WITH_RFM95
@ -635,7 +635,7 @@ void OLED_DrawSystem(u8g2_t *OLED, GPS_Position *GPS)
Len=0;
#ifdef WITH_RFM69
Len+=Format_String(Line+Len, "RFM69 v"); // Type of RF chip used
if(Parameters.isTxTypeHW()) Line[Len++]='H';
if(Parameters.RFchipTypeHW) Line[Len++]='H';
Line[Len++]='W';
#endif
#ifdef WITH_RFM95

Wyświetl plik

@ -78,13 +78,24 @@ class FlashParameters
uint8_t NavRate:3; // [Hz] GPS position report rate
int8_t TimeCorr:3; // [sec] it appears for ArduPilot you need to correct time by 3 seconds which is likley the leap-second issue
} ;
} ; //
} ; //
int16_t GeoidSepar; // [0.1m] Geoid-Separation, apparently ArduPilot MAVlink does not give this value (although present in the format)
// or it could be a problem of some GPSes
uint8_t PPSdelay; // [ms] delay between the PPS and the data burst starts on the GPS UART (used when PPS failed or is not there)
// uint8_t FreqPlan; // 0=default or force given frequency hopping plan
uint8_t Spare;
union
{ uint8_t GNSS;
struct
{ bool EnableGPS :1; //
bool EnableSBAS:1; //
bool EnableGAL :1; //
bool EnableBEI :1; //
bool EnableIMES:1; //
bool EnableQZSS:1; //
bool EnableGLO :1; //
} ;
} ;
static const uint8_t InfoParmLen = 16; // [char] max. size of an infp-parameter
static const uint8_t InfoParmNum = 15; // [int] number of info-parameters
@ -232,6 +243,7 @@ uint16_t StratuxPort;
NavMode = 2; // 2 = Avionic mode for MTK
#endif
NavRate = 0; // [Hz] 0 = do not attempt to change the navigation rate
GNSS = 0x67; // enable GPS, SBAS, GLONASS and GALILEO, but not BeiDou
GeoidSepar = 10*DEFAULT_GeoidSepar; // [0.1m]
Verbose = 1;
@ -642,6 +654,9 @@ uint16_t StratuxPort;
if(strcmp(Name, "NavRate")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
if(Mode<0) Mode=0; NavRate=Mode; return 1; }
if(strcmp(Name, "GNSS")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
GNSS=Mode; return 1; }
if(strcmp(Name, "PageMask")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
PageMask=Mode; return 1; }
@ -825,6 +840,7 @@ uint16_t StratuxPort;
// Write_Hex (Line, "EncryptKey[3]", EncryptKey[3] , 8); strcat(Line, " # [32-bit]\n"); if(fputs(Line, File)==EOF) return EOF;
#endif
Write_Hex (Line, "Verbose" , (uint32_t)Verbose, 2); strcat(Line, " # [ 0..3]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_Hex (Line, "GNSS" , (uint32_t)GNSS, 2); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_Hex (Line, "PageMask" , (uint32_t)PageMask, 4); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); if(fputs(Line, File)==EOF) return EOF;
#ifdef WITH_BT_PWR
@ -890,8 +906,9 @@ uint16_t StratuxPort;
// Write_Hex (Line, "EncryptKey[3]", EncryptKey[3] , 8); strcat(Line, " # [32-bit]\n"); Format_String(Output, Line);
#endif
Write_Hex (Line, "Verbose" , (uint32_t)Verbose, 2); strcat(Line, " # [ 0..3]\n"); Format_String(Output, Line);
Write_Hex (Line, "GNSS" , (uint32_t)GNSS , 2); strcat(Line, " # [ mask]\n"); Format_String(Output, Line);
Write_Hex (Line, "PageMask" , (uint32_t)PageMask, 4); strcat(Line, " # [ mask]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); Format_String(Output, Line);
#ifdef WITH_BT_PWR
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); Format_String(Output, Line);
#endif

Wyświetl plik

@ -61,7 +61,7 @@ static uint8_t RX_Channel=0; // (hopping) channel currently being
static void SetTxChannel(uint8_t TxChan=RX_Channel) // default channel to transmit is same as the receive channel
{
#ifdef WITH_RFM69
TRX.WriteTxPower(Parameters.TxPower, Parameters.isTxTypeHW()); // set TX for transmission
TRX.WriteTxPower(Parameters.TxPower, Parameters.RFchipTypeHW); // set TX for transmission
#endif
#if defined(WITH_RFM95) || defined(WITH_SX1272)
TRX.WriteTxPower(Parameters.TxPower); // set TX for transmission

Wyświetl plik

@ -545,12 +545,12 @@ class RFM_TRX
void WriteTxPowerMin(void) { WriteTxPower_W(-18); } // set minimal Tx power and setup for reception
int FSK_Configure(int16_t Channel, const uint8_t *Sync, bool PW=0)
int OGN_Configure(int16_t Channel, const uint8_t *Sync)
{ WriteMode(RF_OPMODE_STANDBY); // mode = STDBY
ClearIrqFlags();
WriteByte( 0x02, REG_DATAMODUL); // [0x00] Packet mode, FSK, 0x02: BT=0.5, 0x01: BT=1.0, 0x03: BT=0.3
WriteWord(PW?0x0341:0x0140, REG_BITRATEMSB); // bit rate = 100kbps
WriteWord(PW?0x013B:0x0333, REG_FDEVMSB); // FSK deviation = +/-50kHz
WriteWord(0x0140, REG_BITRATEMSB); // bit rate = 100kbps
WriteWord(0x0333, REG_FDEVMSB); // FSK deviation = +/-50kHz
setChannel(Channel); // operating channel
FSK_WriteSYNC(8, 7, Sync); // SYNC pattern (setup for reception)
WriteByte( 0x00, REG_PACKETCONFIG1); // [0x10] Fixed size packet, no DC-free encoding, no CRC, no address filtering