mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Fixed carrier frequency problems.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2700 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c854b74690
commit
7f8b0d5788
@ -72,7 +72,7 @@ typedef struct
|
||||
|
||||
uint32_t min_frequency_Hz;
|
||||
uint32_t max_frequency_Hz;
|
||||
float frequency_Hz;
|
||||
uint32_t frequency_Hz;
|
||||
|
||||
uint32_t max_rf_bandwidth;
|
||||
|
||||
@ -90,7 +90,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float start_frequency;
|
||||
uint32_t start_frequency;
|
||||
float frequency_step_size;
|
||||
uint16_t magnitudes;
|
||||
// int8_t magnitude[0];
|
||||
@ -343,6 +343,7 @@ void apiconfig_process(void)
|
||||
{ // the local communications port has changed .. remove any data in the buffers
|
||||
apiconfig_rx_buffer_wr = 0;
|
||||
apiconfig_tx_buffer_wr = 0;
|
||||
apiconfig_tx_config_buffer_wr = 0;
|
||||
}
|
||||
else
|
||||
if (usb_comms)
|
||||
@ -393,9 +394,10 @@ void apiconfig_process(void)
|
||||
com_num--;
|
||||
}
|
||||
|
||||
// scan for a configuration packet in the received data
|
||||
uint16_t data_size = apiconfig_scanForConfigPacket(apiconfig_rx_buffer, &apiconfig_rx_buffer_wr, false);
|
||||
|
||||
if (data_size == 0 && apiconfig_rx_timer >= 10)
|
||||
if (data_size == 0 && ((usb_comms && apiconfig_rx_timer >= 10) || ((!usb_comms && apiconfig_rx_timer >= 20))))
|
||||
{ // no config packet found in the buffer within the timeout period, treat any data in the buffer as data to be sent over the air
|
||||
data_size = apiconfig_rx_buffer_wr;
|
||||
}
|
||||
@ -433,8 +435,8 @@ void apiconfig_process(void)
|
||||
{
|
||||
uint16_t data_size = apiconfig_tx_config_buffer_wr;
|
||||
|
||||
if (data_size > 32)
|
||||
data_size = 32;
|
||||
// if (data_size > 32)
|
||||
// data_size = 32;
|
||||
|
||||
if (!usb_comms && !GPIO_IN(SERIAL_CTS_PIN))
|
||||
break; // we can't yet send data down the comm-port
|
||||
|
@ -45,8 +45,8 @@ uint16_t ph_putData(const int connection_index, const void *data, uint16_t len);
|
||||
uint16_t ph_getData_used(const int connection_index);
|
||||
uint16_t ph_getData(const int connection_index, void *data, uint16_t len);
|
||||
|
||||
void ph_setNominalCarrierFrequency(float frequency_hz);
|
||||
float ph_getNominalCarrierFrequency(void);
|
||||
void ph_setNominalCarrierFrequency(uint32_t frequency_hz);
|
||||
uint32_t ph_getNominalCarrierFrequency(void);
|
||||
|
||||
void ph_setDatarate(uint32_t datarate_bps);
|
||||
uint32_t ph_getDatarate(void);
|
||||
|
@ -581,8 +581,8 @@ uint32_t rfm22_getDatarate(void);
|
||||
void rfm22_setTxPower(uint8_t tx_pwr);
|
||||
uint8_t rfm22_getTxPower(void);
|
||||
|
||||
void rfm22_setNominalCarrierFrequency(float frequency_hz);
|
||||
float rfm22_getNominalCarrierFrequency(void);
|
||||
void rfm22_setNominalCarrierFrequency(uint32_t frequency_hz);
|
||||
uint32_t rfm22_getNominalCarrierFrequency(void);
|
||||
|
||||
float rfm22_getFrequencyStepSize(void);
|
||||
|
||||
|
@ -1383,12 +1383,12 @@ void ph_processLinks(int connection_index)
|
||||
// *****************************************************************************
|
||||
// set/get the carrier frequency
|
||||
|
||||
void ph_setNominalCarrierFrequency(float frequency_hz)
|
||||
void ph_setNominalCarrierFrequency(uint32_t frequency_hz)
|
||||
{
|
||||
rfm22_setNominalCarrierFrequency(frequency_hz);
|
||||
}
|
||||
|
||||
float ph_getNominalCarrierFrequency(void)
|
||||
uint32_t ph_getNominalCarrierFrequency(void)
|
||||
{
|
||||
return rfm22_getNominalCarrierFrequency();
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ volatile uint8_t rf_mode; // holds our current RF mode
|
||||
|
||||
uint32_t lower_carrier_frequency_limit_Hz; // the minimum RF frequency we can use
|
||||
uint32_t upper_carrier_frequency_limit_Hz; // the maximum RF frequency we can use
|
||||
float carrier_frequency_hz; // the current RF frequency we are on
|
||||
uint32_t carrier_frequency_hz; // the current RF frequency we are on
|
||||
|
||||
uint32_t carrier_datarate_bps; // the RF data rate we are using
|
||||
|
||||
@ -575,7 +575,7 @@ uint8_t rfm22_getTxPower(void)
|
||||
|
||||
// ************************************
|
||||
|
||||
void rfm22_setNominalCarrierFrequency(float frequency_hz)
|
||||
void rfm22_setNominalCarrierFrequency(uint32_t frequency_hz)
|
||||
{
|
||||
|
||||
#if defined(RFM22_EXT_INT_USE)
|
||||
@ -629,7 +629,7 @@ void rfm22_setNominalCarrierFrequency(float frequency_hz)
|
||||
|
||||
}
|
||||
|
||||
float rfm22_getNominalCarrierFrequency(void)
|
||||
uint32_t rfm22_getNominalCarrierFrequency(void)
|
||||
{
|
||||
return carrier_frequency_hz;
|
||||
}
|
||||
@ -1574,7 +1574,7 @@ void rfm22_process(void)
|
||||
|
||||
if (power_on_reset)
|
||||
{ // we need to re-initialize the RF module - it told us it's reset itself
|
||||
float current_freq = carrier_frequency_hz; // fetch current rf nominal frequency
|
||||
uint32_t current_freq = carrier_frequency_hz; // fetch current rf nominal frequency
|
||||
uint32_t freq_hop_step_size = (uint32_t)frequency_hop_step_size_reg * 10000; // fetch the frequency hoppping step size
|
||||
rfm22_init(lower_carrier_frequency_limit_Hz, upper_carrier_frequency_limit_Hz, freq_hop_step_size);
|
||||
rfm22_setNominalCarrierFrequency(current_freq); // restore the nominal carrier frequency
|
||||
|
Loading…
Reference in New Issue
Block a user