mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Added setting of min/max frequencies on OPLink coordinator.
This commit is contained in:
parent
61712be03d
commit
c330db3a28
@ -95,6 +95,9 @@ typedef struct {
|
||||
typedef struct {
|
||||
PHPacketHeader header;
|
||||
uint32_t source_id;
|
||||
uint32_t min_frequency;
|
||||
uint32_t max_frequency;
|
||||
uint32_t channel_spacing;
|
||||
OPLinkSettingsMainPortOptions main_port;
|
||||
OPLinkSettingsFlexiPortOptions flexi_port;
|
||||
OPLinkSettingsVCPPortOptions vcp_port;
|
||||
|
@ -107,7 +107,8 @@ static int32_t RadioSendHandler(uint8_t *buf, int32_t length);
|
||||
static void ProcessInputStream(UAVTalkConnection connectionHandle, uint8_t rxbyte);
|
||||
static void queueEvent(xQueueHandle queue, void *obj, uint16_t instId, UAVObjEventType type);
|
||||
static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port, OPLinkSettingsRemoteFlexiPortOptions flexi_port,
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed);
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed,
|
||||
uint32_t min_frequency, uint32_t max_frequency, uint32_t channel_spacing);
|
||||
static void updateSettings();
|
||||
|
||||
// ****************
|
||||
@ -127,14 +128,14 @@ static int32_t RadioComBridgeStart(void)
|
||||
// Configure the com port configuration callback
|
||||
PIOS_RFM22B_SetComConfigCallback(pios_rfm22b_id, &configureComCallback);
|
||||
|
||||
// Get the settings.
|
||||
OPLinkSettingsData oplinkSettings;
|
||||
OPLinkSettingsGet(&oplinkSettings);
|
||||
|
||||
// Set the baudrates, etc.
|
||||
bool is_coordinator = PIOS_RFM22B_IsCoordinator(pios_rfm22b_id);
|
||||
if (is_coordinator) {
|
||||
|
||||
// Get the settings.
|
||||
OPLinkSettingsData oplinkSettings;
|
||||
OPLinkSettingsGet(&oplinkSettings);
|
||||
|
||||
// Set the maximum radio RF power.
|
||||
switch (oplinkSettings.MaxRFPower)
|
||||
{
|
||||
@ -167,10 +168,16 @@ static int32_t RadioComBridgeStart(void)
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the frequency range.
|
||||
PIOS_RFM22B_SetFrequencyRange(pios_rfm22b_id, oplinkSettings.MinFrequency, oplinkSettings.MaxFrequency, oplinkSettings.ChannelSpacing);
|
||||
|
||||
// Reinitilize the modem.
|
||||
PIOS_RFM22B_Reinit(pios_rfm22b_id);
|
||||
}
|
||||
|
||||
// Set the initial frequency.
|
||||
PIOS_RFM22B_SetInitialFrequency(pios_rfm22b_id, oplinkSettings.InitFrequency);
|
||||
|
||||
// Start the primary tasks for receiving/sending UAVTalk packets from the GCS.
|
||||
xTaskCreate(telemetryTxTask, (signed char *)"telemTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->telemetryTxTaskHandle));
|
||||
xTaskCreate(radioRxTask, (signed char *)"radioRxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioRxTaskHandle));
|
||||
@ -505,7 +512,8 @@ static void queueEvent(xQueueHandle queue, void *obj, uint16_t instId, UAVObjEve
|
||||
* \param[in] com_speed The com port speed
|
||||
*/
|
||||
static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port, OPLinkSettingsRemoteFlexiPortOptions flexi_port,
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed)
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed,
|
||||
uint32_t min_frequency, uint32_t max_frequency, uint32_t channel_spacing)
|
||||
{
|
||||
|
||||
// Update the com baud rate
|
||||
@ -552,6 +560,9 @@ static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port,
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the frequency range.
|
||||
PIOS_RFM22B_SetFrequencyRange(pios_rfm22b_id, min_frequency, max_frequency, channel_spacing);
|
||||
|
||||
// Update the OPLinkSettings object.
|
||||
OPLinkSettingsSet(&oplinkSettings);
|
||||
}
|
||||
@ -561,7 +572,7 @@ static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port,
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the oplink settings, called on startup.
|
||||
* Update the oplink settings.
|
||||
*/
|
||||
static void updateSettings()
|
||||
{
|
||||
|
@ -65,13 +65,12 @@
|
||||
#define ISR_TIMEOUT 2 // ms
|
||||
#define EVENT_QUEUE_SIZE 5
|
||||
#define RFM22B_DEFAULT_RX_DATARATE RFM22_datarate_9600
|
||||
#define RFM22B_DEFAULT_FREQUENCY 430000000
|
||||
#define RFM22B_NOMINAL_CARRIER_FREQUENCY 430000000
|
||||
#define RFM22B_FREQUENCY_HOP_STEP_SIZE 75000
|
||||
#define RFM22B_NUM_CHANNELS 128
|
||||
#define RFM22B_DEFAULT_CHANNEL 28
|
||||
#define RFM22B_DEFAULT_TX_POWER RFM22_tx_pwr_txpow_7
|
||||
#define RFM22B_LINK_QUALITY_THRESHOLD 20
|
||||
#define RFM22B_NOMINAL_CARRIER_FREQUENCY 430000000
|
||||
#define RFM22B_MAXIMUM_FREQUENCY 440000000
|
||||
#define RFM22B_DEFAULT_FREQUENCY 433000000
|
||||
#define RFM22B_FREQUENCY_HOP_STEP_SIZE 75000
|
||||
//#define RFM22B_TEST_DROPPED_PACKETS 1
|
||||
|
||||
// The maximum amount of time since the last message received to consider the connection broken.
|
||||
@ -203,7 +202,7 @@ static void rfm22_sendStatus(struct pios_rfm22b_dev *rfm22b_dev);
|
||||
static void rfm22_sendPPM(struct pios_rfm22b_dev *rfm22b_dev);
|
||||
static void rfm22b_add_rx_status(struct pios_rfm22b_dev *rfm22b_dev, enum pios_rfm22b_rx_packet_status status);
|
||||
static bool rfm22_receivePacket(struct pios_rfm22b_dev *rfm22b_dev, PHPacketHandle p, uint16_t rx_len);
|
||||
static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint32_t frequency_hz, uint8_t channel);
|
||||
static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint32_t min_frequency, uint32_t max_frequency, uint32_t step_size);
|
||||
static bool rfm22_setFreqHopChannel(struct pios_rfm22b_dev *rfm22b_dev, uint8_t channel);
|
||||
static void rfm22_calculateLinkQuality(struct pios_rfm22b_dev *rfm22b_dev);
|
||||
static bool rfm22_ready_to_send(struct pios_rfm22b_dev *rfm22b_dev);
|
||||
@ -485,31 +484,6 @@ static const uint8_t reg_71[] = { 0x23, 0x23, 0x23, 0x23, 0x
|
||||
|
||||
static const uint8_t reg_72[] = { 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x0D, 0x0F, 0x13, 0x1A, 0x2E, 0x33, 0x66, 0x9A, 0xCD}; // rfm22_frequency_deviation
|
||||
|
||||
// ************************************
|
||||
// Scan Spectrum settings
|
||||
// GFSK modulation
|
||||
// no manchester encoding
|
||||
// data whitening
|
||||
// FIFO mode
|
||||
// 5-nibble rx preamble length detection
|
||||
// 10-nibble tx preamble length
|
||||
#define SS_LOOKUP_SIZE 2
|
||||
|
||||
static const uint8_t ss_reg_1C[] = { 0x51, 0x32}; // rfm22_if_filter_bandwidth
|
||||
static const uint8_t ss_reg_1D[] = { 0x00, 0x00}; // rfm22_afc_loop_gearshift_override
|
||||
|
||||
static const uint8_t ss_reg_20[] = { 0xE8, 0x38}; // rfm22_clk_recovery_oversampling_ratio
|
||||
static const uint8_t ss_reg_21[] = { 0x60, 0x02}; // rfm22_clk_recovery_offset2
|
||||
static const uint8_t ss_reg_22[] = { 0x20, 0x4D}; // rfm22_clk_recovery_offset1
|
||||
static const uint8_t ss_reg_23[] = { 0xC5, 0xD3}; // rfm22_clk_recovery_offset0
|
||||
static const uint8_t ss_reg_24[] = { 0x00, 0x07}; // rfm22_clk_recovery_timing_loop_gain1
|
||||
static const uint8_t ss_reg_25[] = { 0x0F, 0xFF}; // rfm22_clk_recovery_timing_loop_gain0
|
||||
|
||||
static const uint8_t ss_reg_2A[] = { 0xFF, 0xFF}; // rfm22_afc_limiter .. AFC_pull_in_range = <20>AFCLimiter[7:0] x (hbsel+1) x 625 Hz
|
||||
|
||||
static const uint8_t ss_reg_70[] = { 0x24, 0x2D}; // rfm22_modulation_mode_control1
|
||||
static const uint8_t ss_reg_71[] = { 0x2B, 0x23}; // rfm22_modulation_mode_control2
|
||||
|
||||
|
||||
static inline uint32_t timeDifferenceMs(portTickType start_time, portTickType end_time)
|
||||
{
|
||||
@ -599,12 +573,9 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu
|
||||
rfm22b_dev->stats.tx_seq = 0;
|
||||
rfm22b_dev->stats.rx_seq = 0;
|
||||
|
||||
// initialize the frequency hopping step size (specified in 10khz increments).
|
||||
uint32_t freq_hop_step_size = RFM22B_FREQUENCY_HOP_STEP_SIZE / 10000;
|
||||
if (freq_hop_step_size > 255) {
|
||||
freq_hop_step_size = 255;
|
||||
}
|
||||
rfm22b_dev->frequency_hop_step_size_reg = (uint8_t)freq_hop_step_size;
|
||||
// Initialize the frequencies.
|
||||
PIOS_RFM22B_SetFrequencyRange(*rfm22b_id, RFM22B_NOMINAL_CARRIER_FREQUENCY, RFM22B_NOMINAL_CARRIER_FREQUENCY, RFM22B_FREQUENCY_HOP_STEP_SIZE);
|
||||
PIOS_RFM22B_SetInitialFrequency(*rfm22b_id, RFM22B_DEFAULT_FREQUENCY);
|
||||
|
||||
// Initialize the bindings.
|
||||
for (uint32_t i = 0; i < OPLINKSETTINGS_BINDINGS_NUMELEM; ++i) {
|
||||
@ -759,6 +730,38 @@ void PIOS_RFM22B_SetTxPower(uint32_t rfm22b_id, enum rfm22b_tx_power tx_pwr)
|
||||
rfm22b_dev->tx_power = tx_pwr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the radio frequency range and initial frequency
|
||||
* \param[in] rfm22b_id The RFM22B device index.
|
||||
* \param[in] min_freq The minimum frequency
|
||||
* \param[in] max_freq The maximum frequency
|
||||
* \param[in] step_size The channel step size
|
||||
*/
|
||||
void PIOS_RFM22B_SetFrequencyRange(uint32_t rfm22b_id, uint32_t min_freq, uint32_t max_freq, uint32_t step_size)
|
||||
{
|
||||
struct pios_rfm22b_dev *rfm22b_dev = (struct pios_rfm22b_dev *)rfm22b_id;
|
||||
if (!PIOS_RFM22B_validate(rfm22b_dev)) {
|
||||
return;
|
||||
}
|
||||
rfm22b_dev->con_packet.min_frequency = min_freq;
|
||||
rfm22b_dev->con_packet.max_frequency = max_freq;
|
||||
rfm22b_dev->con_packet.channel_spacing = step_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the initial radio frequency range
|
||||
* \param[in] rfm22b_id The RFM22B device index.
|
||||
* \param[in] init_freq The initial frequency
|
||||
*/
|
||||
void PIOS_RFM22B_SetInitialFrequency(uint32_t rfm22b_id, uint32_t init_freq)
|
||||
{
|
||||
struct pios_rfm22b_dev *rfm22b_dev = (struct pios_rfm22b_dev *)rfm22b_id;
|
||||
if (!PIOS_RFM22B_validate(rfm22b_dev)) {
|
||||
return;
|
||||
}
|
||||
rfm22b_dev->init_frequency = init_freq;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the com port configuration callback (to receive com configuration over the air)
|
||||
* \param[in] rfm22b_id The rfm22b device.
|
||||
@ -1225,8 +1228,10 @@ static void rfm22_process_event(struct pios_rfm22b_dev *rfm22b_dev, enum pios_rf
|
||||
|
||||
// ************************************
|
||||
|
||||
static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint32_t frequency_hz, uint8_t channel)
|
||||
static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint32_t min_frequency, uint32_t max_frequency, uint32_t step_size)
|
||||
{
|
||||
uint32_t frequency_hz = min_frequency;
|
||||
|
||||
// holds the hbsel (1 or 2)
|
||||
uint8_t hbsel;
|
||||
if (frequency_hz < 480000000)
|
||||
@ -1241,17 +1246,25 @@ static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev,
|
||||
uint8_t fch = (fc >> 8) & 0xff;
|
||||
uint8_t fcl = fc & 0xff;
|
||||
|
||||
// Calculate the number of frequency hopping channels.
|
||||
rfm22b_dev->num_channels = (step_size == 0) ? 1 : (uint16_t)((max_frequency - min_frequency) / step_size);
|
||||
|
||||
// initialize the frequency hopping step size (specified in 10khz increments).
|
||||
uint32_t freq_hop_step_size = step_size / 10000;
|
||||
if (freq_hop_step_size > 255) {
|
||||
freq_hop_step_size = 255;
|
||||
}
|
||||
rfm22_write(rfm22b_dev, RFM22_frequency_hopping_step_size, (uint8_t)freq_hop_step_size);
|
||||
|
||||
// frequency hopping channel (0-255)
|
||||
rfm22b_dev->frequency_step_size = 156.25f * hbsel;
|
||||
|
||||
// frequency hopping channel (0-255)
|
||||
rfm22b_dev->frequency_hop_channel = channel;
|
||||
rfm22_write(rfm22b_dev, RFM22_frequency_hopping_channel_select, channel);
|
||||
rfm22b_dev->frequency_hop_channel = 0;
|
||||
rfm22_write(rfm22b_dev, RFM22_frequency_hopping_channel_select, 0);
|
||||
|
||||
// no frequency offset
|
||||
rfm22_write(rfm22b_dev, RFM22_frequency_offset1, 0);
|
||||
// no frequency offset
|
||||
rfm22_write(rfm22b_dev, RFM22_frequency_offset2, 0);
|
||||
|
||||
// set the carrier frequency
|
||||
@ -2243,9 +2256,11 @@ static void rfm22_setConnectionParameters(struct pios_rfm22b_dev *rfm22b_dev)
|
||||
|
||||
// Call the com port configuration function
|
||||
if (rfm22b_dev->com_config_cb)
|
||||
rfm22b_dev->com_config_cb(cph->main_port, cph->flexi_port, cph->vcp_port, cph->com_speed);
|
||||
rfm22b_dev->com_config_cb(cph->main_port, cph->flexi_port, cph->vcp_port, cph->com_speed,
|
||||
cph->min_frequency, cph->max_frequency, cph->channel_spacing);
|
||||
|
||||
// Configure this modem from the connection request message.
|
||||
rfm22_setNominalCarrierFrequency(rfm22b_dev, cph->min_frequency, cph->max_frequency, cph->channel_spacing);
|
||||
rfm22_setDatarate(rfm22b_dev, rfm22b_dev->datarate, true);
|
||||
PIOS_RFM22B_SetTxPower((uint32_t)rfm22b_dev, cph->max_tx_power);
|
||||
}
|
||||
@ -2267,10 +2282,11 @@ static uint8_t rfm22_calcChannel(struct pios_rfm22b_dev *rfm22b_dev)
|
||||
{
|
||||
portTickType time = rfm22_coordinatorTime(rfm22b_dev, xTaskGetTickCount());
|
||||
// We change channels every 128 ms.
|
||||
time = time >> 7;
|
||||
// The channel is calculated using the 16 bit CRC as the pseudo random number generator, and there are 128 channels.
|
||||
return (uint8_t)(time & 0x7f);
|
||||
//return (uint8_t)(PIOS_CRC16_updateByte((time && 0xffff), 0) & 0x7f);
|
||||
uint16_t n = (time >> 7) & 0xffff;
|
||||
// The channel is calculated using the 16 bit CRC as the pseudo random number generator.
|
||||
n = PIOS_CRC16_updateByte(n, 0);
|
||||
float num_channels = rfm22b_dev->num_channels;
|
||||
return (uint8_t)(num_channels * (float)n / (float)0xffff);
|
||||
}
|
||||
|
||||
static bool rfm22_changeChannel(struct pios_rfm22b_dev *rfm22b_dev)
|
||||
@ -2515,9 +2531,6 @@ static enum pios_rfm22b_event rfm22_init(struct pios_rfm22b_dev *rfm22b_dev)
|
||||
rfm22_write(rfm22b_dev, RFM22_sync_word1, SYNC_BYTE_3);
|
||||
rfm22_write(rfm22b_dev, RFM22_sync_word0, SYNC_BYTE_4);
|
||||
|
||||
// set frequency hopping channel step size (multiples of 10kHz)
|
||||
rfm22_write(rfm22b_dev, RFM22_frequency_hopping_step_size, rfm22b_dev->frequency_hop_step_size_reg);
|
||||
|
||||
// set the tx power
|
||||
rfm22_write(rfm22b_dev, RFM22_tx_power, RFM22_tx_pwr_papeaken | RFM22_tx_pwr_papeaklvl_0 | RFM22_tx_pwr_lna_sw | rfm22b_dev->tx_power);
|
||||
|
||||
@ -2534,7 +2547,7 @@ static enum pios_rfm22b_event rfm22_init(struct pios_rfm22b_dev *rfm22b_dev)
|
||||
rfm22_write(rfm22b_dev, RFM22_xtal_osc_load_cap, rfm22b_dev->cfg.RFXtalCap);
|
||||
|
||||
// Initialize the frequency and datarate to te default.
|
||||
rfm22_setNominalCarrierFrequency(rfm22b_dev, RFM22B_NOMINAL_CARRIER_FREQUENCY, RFM22B_DEFAULT_CHANNEL);
|
||||
rfm22_setNominalCarrierFrequency(rfm22b_dev, RFM22B_DEFAULT_FREQUENCY, RFM22B_DEFAULT_FREQUENCY, RFM22B_FREQUENCY_HOP_STEP_SIZE);
|
||||
rfm22_setDatarate(rfm22b_dev, RFM22B_DEFAULT_RX_DATARATE, true);
|
||||
|
||||
return RFM22B_EVENT_INITIALIZED;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <packet_handler.h>
|
||||
#include <oplinksettings.h>
|
||||
|
||||
/* Constant definitions */
|
||||
enum gpio_direction {GPIO0_TX_GPIO1_RX, GPIO0_RX_GPIO1_TX};
|
||||
|
||||
/* Global Types */
|
||||
@ -98,12 +99,15 @@ struct rfm22b_stats {
|
||||
|
||||
/* Callback function prototypes */
|
||||
typedef void (*PIOS_RFM22B_ComConfigCallback)(OPLinkSettingsRemoteMainPortOptions main_port, OPLinkSettingsRemoteFlexiPortOptions flexi_port,
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed);
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed,
|
||||
uint32_t min_frequency, uint32_t max_frequency, uint32_t channel_spacing);
|
||||
|
||||
/* Public Functions */
|
||||
extern int32_t PIOS_RFM22B_Init(uint32_t *rfb22b_id, uint32_t spi_id, uint32_t slave_num, const struct pios_rfm22b_cfg *cfg);
|
||||
extern void PIOS_RFM22B_Reinit(uint32_t rfb22b_id);
|
||||
extern void PIOS_RFM22B_SetTxPower(uint32_t rfm22b_id, enum rfm22b_tx_power tx_pwr);
|
||||
extern void PIOS_RFM22B_SetFrequencyRange(uint32_t rfm22b_id, uint32_t min_freq, uint32_t max_freq, uint32_t step_size);
|
||||
extern void PIOS_RFM22B_SetInitialFrequency(uint32_t rfm22b_id, uint32_t init_freq);
|
||||
extern void PIOS_RFM22B_SetDestinationId(uint32_t rfm22b_id, uint32_t dest_id);
|
||||
extern void PIOS_RFM22B_SetComConfigCallback(uint32_t rfm22b_id, PIOS_RFM22B_ComConfigCallback cb);
|
||||
extern void PIOS_RFM22B_SetBindings(uint32_t rfm22b_id, const uint32_t bindingPairIDs[], const uint8_t mainPortSettings[],
|
||||
|
@ -773,6 +773,11 @@ struct pios_rfm22b_dev {
|
||||
// The number of times that the current packet has been resent.
|
||||
uint8_t cur_resent_count;
|
||||
|
||||
// The initial frequency
|
||||
uint32_t init_frequency;
|
||||
// The number of frequency hopping channels.
|
||||
uint16_t num_channels;
|
||||
|
||||
// The frequency hopping step size
|
||||
float frequency_step_size;
|
||||
// current frequency hop channel
|
||||
|
@ -43,7 +43,8 @@
|
||||
#if defined(PIOS_INCLUDE_RFM22B)
|
||||
// Forward declarations
|
||||
static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port, OPLinkSettingsRemoteFlexiPortOptions flexi_port,
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed);
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed,
|
||||
uint32_t min_frequency, uint32_t max_frequency, uint32_t channel_spacing);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -767,7 +768,8 @@ void PIOS_Board_Init(void) {
|
||||
* \param[in] com_speed The com port speed
|
||||
*/
|
||||
static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port, OPLinkSettingsRemoteFlexiPortOptions flexi_port,
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed)
|
||||
OPLinkSettingsRemoteVCPPortOptions vcp_port, OPLinkSettingsComSpeedOptions com_speed,
|
||||
uint32_t min_frequency, uint32_t max_frequency, uint32_t channel_spacing)
|
||||
{
|
||||
uint32_t comBaud = 9600;
|
||||
switch (com_speed) {
|
||||
@ -796,6 +798,9 @@ static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port,
|
||||
if (PIOS_COM_TELEM_RF) {
|
||||
PIOS_COM_ChangeBaud(PIOS_COM_TELEM_RF, comBaud);
|
||||
}
|
||||
|
||||
// Set the frequency range.
|
||||
PIOS_RFM22B_SetFrequencyRange(pios_rfm22b_id, min_frequency, max_frequency, channel_spacing);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -63,6 +63,10 @@ ConfigPipXtremeWidget::ConfigPipXtremeWidget(QWidget *parent) : ConfigTaskWidget
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "FlexiPort", m_oplink->FlexiPort);
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "VCPPort", m_oplink->VCPPort);
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "MaxRFPower", m_oplink->MaxRFTxPower);
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "MinFrequency", m_oplink->MinimumFrequency);
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "MaxFrequency", m_oplink->MaximumFrequency);
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "InitFrequency", m_oplink->InitFrequency);
|
||||
addUAVObjectToWidgetRelation("OPLinkSettings", "ChannelSpacing", m_oplink->StepSize);
|
||||
|
||||
addUAVObjectToWidgetRelation("OPLinkStatus", "DeviceID", m_oplink->DeviceID);
|
||||
addUAVObjectToWidgetRelation("OPLinkStatus", "RxGood", m_oplink->Good);
|
||||
|
@ -2460,6 +2460,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="MinimumFrequencyLabel">
|
||||
<property name="text">
|
||||
<string>Min Freq</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="MinimumFrequency">
|
||||
<property name="toolTip">
|
||||
<string extracomment="The minimum transmit frequency (Hz)"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="FlexiPortLabel">
|
||||
<property name="text">
|
||||
@ -2483,6 +2500,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="MaximumFrequencyLabel">
|
||||
<property name="text">
|
||||
<string>Max Freq</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="MaximumFrequency">
|
||||
<property name="toolTip">
|
||||
<string extracomment="The maximum transmit frequency (Hz)"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="VCPPortLabel">
|
||||
<property name="text">
|
||||
@ -2506,17 +2540,34 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="MaxRFTxPowerLabel">
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="InitFrequencyLabel">
|
||||
<property name="text">
|
||||
<string>Max RF Tx Power(mW)</string>
|
||||
<string>Initial Freq</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="2" column="3">
|
||||
<widget class="QLineEdit" name="InitFrequency">
|
||||
<property name="toolTip">
|
||||
<string extracomment="The initial transmit frequency (Hz)"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="MaxRFTxPowerLabel">
|
||||
<property name="text">
|
||||
<string>Max Power</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="MaxRFTxPower">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@ -2525,7 +2576,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set the maximum TX output power the modem will use</string>
|
||||
<string>Set the maximum TX output power the modem will use (mW)</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
@ -2535,6 +2586,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="StepSizeLabel">
|
||||
<property name="text">
|
||||
<string>Step Size</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLineEdit" name="StepSize">
|
||||
<property name="toolTip">
|
||||
<string extracomment="The channel spacing (Hz)"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -17,6 +17,8 @@
|
||||
<field name="RM_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM2,DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge" defaultvalue="Disabled"/>
|
||||
|
||||
<field name="RadioPort" units="function" type="enum" elements="1" options="Disabled,Telemetry" defaultvalue="Disabled"/>
|
||||
<field name="MaxRFPower" units="mW" type="enum" elements="1" options="1.25,1.6,3.16,6.3,12.6,25,50,100" defaultvalue="100"/>
|
||||
<field name="DefaultFrequency" units="Hz" type="uint32" elements="1" defaultvalue="433000000"/>
|
||||
|
||||
<field name="TelemetrySpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>
|
||||
<field name="GPSSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>
|
||||
|
@ -10,6 +10,10 @@
|
||||
<field name="FlexiPort" units="" type="enum" elements="1" options="Disabled,Telemetry,Serial,PPM" defaultvalue="Disabled"/>
|
||||
<field name="VCPPort" units="" type="enum" elements="1" options="Disabled,Serial" defaultvalue="Disabled"/>
|
||||
<field name="MaxRFPower" units="mW" type="enum" elements="1" options="1.25,1.6,3.16,6.3,12.6,25,50,100" defaultvalue="100"/>
|
||||
<field name="MinFrequency" units="Hz" type="uint32" elements="1" defaultvalue="430000000"/>
|
||||
<field name="MaxFrequency" units="Hz" type="uint32" elements="1" defaultvalue="440000000"/>
|
||||
<field name="InitFrequency" units="Hz" type="uint32" elements="1" defaultvalue="433000000"/>
|
||||
<field name="ChannelSpacing" units="Hz" type="uint32" elements="1" defaultvalue="75000"/>
|
||||
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user