diff --git a/flight/modules/OPLink/oplinkmod.c b/flight/modules/OPLink/oplinkmod.c index 6727cdde3..a1106a1e9 100644 --- a/flight/modules/OPLink/oplinkmod.c +++ b/flight/modules/OPLink/oplinkmod.c @@ -16,7 +16,8 @@ * @{ * * @file oplinkmod.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @brief System module * * @see The GNU Public License (GPL) Version 3 @@ -67,9 +68,11 @@ static xTaskHandle systemTaskHandle; static bool stackOverflow; static bool mallocFailed; volatile int initTaskDone = 0; +static uint8_t previousRFXtalCap; // Private functions static void systemTask(void *parameters); +static void oplinkSettingsUpdatedCb(UAVObjEvent *ev); /** * Create the module task. @@ -133,6 +136,10 @@ static void systemTask(__attribute__((unused)) void *parameters) PIOS_SYS_Reset(); } + // Initialize previousRFXtalCap used by callback + OPLinkSettingsRFXtalCapGet(&previousRFXtalCap); + OPLinkSettingsConnectCallback(oplinkSettingsUpdatedCb); + // Initialize vars lastSysTime = xTaskGetTickCount(); @@ -152,18 +159,19 @@ static void systemTask(__attribute__((unused)) void *parameters) if (pios_rfm22b_id) { // Update the status - oplinkStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id); - oplinkStatus.RxGood = radio_stats.rx_good; - oplinkStatus.RxCorrected = radio_stats.rx_corrected; - oplinkStatus.RxErrors = radio_stats.rx_error; - oplinkStatus.RxMissed = radio_stats.rx_missed; - oplinkStatus.RxFailure = radio_stats.rx_failure; - oplinkStatus.TxDropped = radio_stats.tx_dropped; - oplinkStatus.TxFailure = radio_stats.tx_failure; - oplinkStatus.Resets = radio_stats.resets; - oplinkStatus.Timeouts = radio_stats.timeouts; + oplinkStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id); + oplinkStatus.RxGood = radio_stats.rx_good; + oplinkStatus.RxCorrected = radio_stats.rx_corrected; + oplinkStatus.RxErrors = radio_stats.rx_error; + oplinkStatus.RxMissed = radio_stats.rx_missed; + oplinkStatus.RxFailure = radio_stats.rx_failure; + oplinkStatus.TxDropped = radio_stats.tx_dropped; + oplinkStatus.TxFailure = radio_stats.tx_failure; + oplinkStatus.Resets = radio_stats.resets; + oplinkStatus.Timeouts = radio_stats.timeouts; oplinkStatus.RSSI = radio_stats.rssi; - oplinkStatus.LinkQuality = radio_stats.link_quality; + oplinkStatus.LinkQuality = radio_stats.link_quality; + oplinkStatus.AFCCorrection = radio_stats.afc_correction; if (first_time) { first_time = false; } else { @@ -241,6 +249,23 @@ void vApplicationMallocFailedHook(void) #endif } +/** + * Called whenever OPLink settings changed + */ +static void oplinkSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) +{ + uint8_t currentRFXtalCap; + + OPLinkSettingsRFXtalCapGet(¤tRFXtalCap); + + // Check if RFXtalCap value changed + if (currentRFXtalCap != previousRFXtalCap) { + PIOS_RFM22B_SetXtalCap(pios_rfm22b_id, currentRFXtalCap); + PIOS_RFM22B_Reinit(pios_rfm22b_id); + previousRFXtalCap = currentRFXtalCap; + } +} + /** * @} * @} diff --git a/flight/modules/System/systemmod.c b/flight/modules/System/systemmod.c index 2cf86e751..a09a77fa3 100644 --- a/flight/modules/System/systemmod.c +++ b/flight/modules/System/systemmod.c @@ -16,7 +16,7 @@ * @{ * * @file systemmod.c - * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015. + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015. * @brief System module * @@ -129,6 +129,11 @@ static void updateWDGstats(); static uint8_t i2c_error_activity[PIOS_I2C_ERROR_COUNT_NUMELEM]; #endif +#ifdef PIOS_INCLUDE_RFM22B +static uint8_t previousRFXtalCap; +static void oplinkSettingsUpdatedCb(UAVObjEvent *ev); +#endif + extern uintptr_t pios_uavo_settings_fs_id; extern uintptr_t pios_user_fs_id; @@ -231,6 +236,12 @@ static void systemTask(__attribute__((unused)) void *parameters) HwSettingsConnectCallback(checkSettingsUpdatedCb); SystemSettingsConnectCallback(checkSettingsUpdatedCb); +#ifdef PIOS_INCLUDE_RFM22B + // Initialize previousRFXtalCap used by callback + OPLinkSettingsRFXtalCapGet(&previousRFXtalCap); + OPLinkSettingsConnectCallback(oplinkSettingsUpdatedCb); +#endif + #ifdef DIAG_TASKS TaskInfoData taskInfoData; CallbackInfoData callbackInfoData; @@ -292,18 +303,19 @@ static void systemTask(__attribute__((unused)) void *parameters) static uint16_t prev_tx_seq = 0; static uint16_t prev_rx_seq = 0; - oplinkStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id); - oplinkStatus.RxGood = radio_stats.rx_good; - oplinkStatus.RxCorrected = radio_stats.rx_corrected; - oplinkStatus.RxErrors = radio_stats.rx_error; - oplinkStatus.RxMissed = radio_stats.rx_missed; - oplinkStatus.RxFailure = radio_stats.rx_failure; - oplinkStatus.TxDropped = radio_stats.tx_dropped; - oplinkStatus.TxFailure = radio_stats.tx_failure; - oplinkStatus.Resets = radio_stats.resets; - oplinkStatus.Timeouts = radio_stats.timeouts; + oplinkStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id); + oplinkStatus.RxGood = radio_stats.rx_good; + oplinkStatus.RxCorrected = radio_stats.rx_corrected; + oplinkStatus.RxErrors = radio_stats.rx_error; + oplinkStatus.RxMissed = radio_stats.rx_missed; + oplinkStatus.RxFailure = radio_stats.rx_failure; + oplinkStatus.TxDropped = radio_stats.tx_dropped; + oplinkStatus.TxFailure = radio_stats.tx_failure; + oplinkStatus.Resets = radio_stats.resets; + oplinkStatus.Timeouts = radio_stats.timeouts; oplinkStatus.RSSI = radio_stats.rssi; - oplinkStatus.LinkQuality = radio_stats.link_quality; + oplinkStatus.LinkQuality = radio_stats.link_quality; + oplinkStatus.AFCCorrection = radio_stats.afc_correction; if (first_time) { first_time = false; } else { @@ -453,6 +465,25 @@ static void checkSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) } } +#ifdef PIOS_INCLUDE_RFM22B +/** + * Called whenever OPLink settings changed + */ +static void oplinkSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) +{ + uint8_t currentRFXtalCap; + + OPLinkSettingsRFXtalCapGet(¤tRFXtalCap); + + // Check if RFXtalCap value changed + if (currentRFXtalCap != previousRFXtalCap) { + PIOS_RFM22B_SetXtalCap(pios_rfm22b_id, currentRFXtalCap); + PIOS_RFM22B_Reinit(pios_rfm22b_id); + previousRFXtalCap = currentRFXtalCap; + } +} +#endif /* ifdef PIOS_INCLUDE_RFM22B */ + #ifdef DIAG_TASKS static void taskMonitorForEachCallback(uint16_t task_id, const struct pios_task_info *task_info, void *context) { diff --git a/flight/pios/common/pios_rfm22b.c b/flight/pios/common/pios_rfm22b.c index 1bc83015a..665d0a13a 100644 --- a/flight/pios/common/pios_rfm22b.c +++ b/flight/pios/common/pios_rfm22b.c @@ -66,54 +66,56 @@ #include /* Local Defines */ -#define STACK_SIZE_BYTES 200 -#define TASK_PRIORITY (tskIDLE_PRIORITY + 4) // flight control relevant device driver (ppm link) -#define ISR_TIMEOUT 1 // ms -#define EVENT_QUEUE_SIZE 5 -#define RFM22B_DEFAULT_RX_DATARATE RFM22_datarate_9600 -#define RFM22B_DEFAULT_TX_POWER RFM22_tx_pwr_txpow_0 -#define RFM22B_NOMINAL_CARRIER_FREQUENCY 430000000 -#define RFM22B_LINK_QUALITY_THRESHOLD 20 -#define RFM22B_DEFAULT_MIN_CHANNEL 0 -#define RFM22B_DEFAULT_MAX_CHANNEL 250 -#define RFM22B_PPM_ONLY_DATARATE RFM22_datarate_9600 +#define STACK_SIZE_BYTES 200 +#define TASK_PRIORITY (tskIDLE_PRIORITY + 4) // flight control relevant device driver (ppm link) +#define ISR_TIMEOUT 1 // ms +#define EVENT_QUEUE_SIZE 5 +#define RFM22B_DEFAULT_RX_DATARATE RFM22_datarate_9600 +#define RFM22B_DEFAULT_TX_POWER RFM22_tx_pwr_txpow_0 +#define RFM22B_NOMINAL_CARRIER_FREQUENCY_433 430000000 +#define RFM22B_NOMINAL_CARRIER_FREQUENCY_868 860000000 +#define RFM22B_NOMINAL_CARRIER_FREQUENCY_915 900000000 +#define RFM22B_LINK_QUALITY_THRESHOLD 20 +#define RFM22B_DEFAULT_MIN_CHANNEL 0 +#define RFM22B_DEFAULT_MAX_CHANNEL 250 +#define RFM22B_PPM_ONLY_DATARATE RFM22_datarate_9600 // PPM encoding limits -#define RFM22B_PPM_MIN 1 -#define RFM22B_PPM_MAX 511 -#define RFM22B_PPM_INVALID 0 -#define RFM22B_PPM_SCALE 2 -#define RFM22B_PPM_MIN_US 990 -#define RFM22B_PPM_MAX_US (RFM22B_PPM_MIN_US + (RFM22B_PPM_MAX - RFM22B_PPM_MIN) * RFM22B_PPM_SCALE) +#define RFM22B_PPM_MIN 1 +#define RFM22B_PPM_MAX 511 +#define RFM22B_PPM_INVALID 0 +#define RFM22B_PPM_SCALE 2 +#define RFM22B_PPM_MIN_US 990 +#define RFM22B_PPM_MAX_US (RFM22B_PPM_MIN_US + (RFM22B_PPM_MAX - RFM22B_PPM_MIN) * RFM22B_PPM_SCALE) // The maximum amount of time without activity before initiating a reset. -#define PIOS_RFM22B_SUPERVISOR_TIMEOUT 150 // ms +#define PIOS_RFM22B_SUPERVISOR_TIMEOUT 150 // ms // this is too adjust the RF module so that it is on frequency -#define OSC_LOAD_CAP 0x7F // cap = 12.5pf .. default +#define OSC_LOAD_CAP 0x7F // cap = 12.5pf .. default -#define TX_PREAMBLE_NIBBLES 12 // 7 to 511 (number of nibbles) -#define RX_PREAMBLE_NIBBLES 6 // 5 to 31 (number of nibbles) -#define SYNC_BYTES 4 -#define HEADER_BYTES 4 -#define LENGTH_BYTES 1 +#define TX_PREAMBLE_NIBBLES 12 // 7 to 511 (number of nibbles) +#define RX_PREAMBLE_NIBBLES 6 // 5 to 31 (number of nibbles) +#define SYNC_BYTES 4 +#define HEADER_BYTES 4 +#define LENGTH_BYTES 1 // the size of the rf modules internal FIFO buffers -#define FIFO_SIZE 64 +#define FIFO_SIZE 64 -#define TX_FIFO_HI_WATERMARK 62 // 0-63 -#define TX_FIFO_LO_WATERMARK 32 // 0-63 +#define TX_FIFO_HI_WATERMARK 62 // 0-63 +#define TX_FIFO_LO_WATERMARK 32 // 0-63 -#define RX_FIFO_HI_WATERMARK 32 // 0-63 +#define RX_FIFO_HI_WATERMARK 32 // 0-63 // preamble byte (preceeds SYNC_BYTE's) -#define PREAMBLE_BYTE 0x55 +#define PREAMBLE_BYTE 0x55 // RF sync bytes (32-bit in all) -#define SYNC_BYTE_1 0x2D -#define SYNC_BYTE_2 0xD4 -#define SYNC_BYTE_3 0x4B -#define SYNC_BYTE_4 0x59 +#define SYNC_BYTE_1 0x2D +#define SYNC_BYTE_2 0xD4 +#define SYNC_BYTE_3 0x4B +#define SYNC_BYTE_4 0x59 #ifndef RX_LED_ON #define RX_LED_ON @@ -187,7 +189,7 @@ static enum pios_radio_event rfm22_timeout(struct pios_rfm22b_dev *rfm22b_dev); static enum pios_radio_event rfm22_error(struct pios_rfm22b_dev *rfm22b_dev); static enum pios_radio_event rfm22_fatal_error(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 void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint8_t init_chan); +static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint8_t init_chan, uint32_t frequency_hz); static bool rfm22_setFreqHopChannel(struct pios_rfm22b_dev *rfm22b_dev, uint8_t channel); static void rfm22_generateDeviceID(struct pios_rfm22b_dev *rfm22b_dev); static void rfm22_updatePairStatus(struct pios_rfm22b_dev *radio_dev); @@ -391,7 +393,7 @@ static struct pios_rfm22b_dev *g_rfm22b_dev = NULL; * @param[in] slave_num The SPI bus slave number. * @param[in] cfg The device configuration. */ -int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_num, const struct pios_rfm22b_cfg *cfg) +int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_num, const struct pios_rfm22b_cfg *cfg, OPLinkSettingsRFBandOptions band) { PIOS_DEBUG_Assert(rfm22b_id); PIOS_DEBUG_Assert(cfg); @@ -425,16 +427,31 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu rfm22b_dev->stats.packets_per_sec = 0; rfm22b_dev->stats.rx_good = 0; rfm22b_dev->stats.rx_corrected = 0; - rfm22b_dev->stats.rx_error = 0; - rfm22b_dev->stats.rx_missed = 0; - rfm22b_dev->stats.tx_dropped = 0; - rfm22b_dev->stats.resets = 0; - rfm22b_dev->stats.timeouts = 0; - rfm22b_dev->stats.link_quality = 0; + rfm22b_dev->stats.rx_error = 0; + rfm22b_dev->stats.rx_missed = 0; + rfm22b_dev->stats.tx_dropped = 0; + rfm22b_dev->stats.resets = 0; + rfm22b_dev->stats.timeouts = 0; + rfm22b_dev->stats.link_quality = 0; rfm22b_dev->stats.rssi = 0; - rfm22b_dev->stats.tx_seq = 0; - rfm22b_dev->stats.rx_seq = 0; - rfm22b_dev->stats.tx_failure = 0; + rfm22b_dev->stats.afc_correction = 0; + rfm22b_dev->stats.tx_seq = 0; + rfm22b_dev->stats.rx_seq = 0; + rfm22b_dev->stats.tx_failure = 0; + + // Set the frequency band + switch (band) { + case OPLINKSETTINGS_RFBAND_915MHZ: + rfm22b_dev->base_freq = RFM22B_NOMINAL_CARRIER_FREQUENCY_915; + break; + case OPLINKSETTINGS_RFBAND_868MHZ: + rfm22b_dev->base_freq = RFM22B_NOMINAL_CARRIER_FREQUENCY_868; + break; + case OPLINKSETTINGS_RFBAND_433MHZ: + default: + rfm22b_dev->base_freq = RFM22B_NOMINAL_CARRIER_FREQUENCY_433; + break; + } // Initialize the channels. PIOS_RFM22B_SetChannelConfig(*rfm22b_id, RFM22B_DEFAULT_RX_DATARATE, RFM22B_DEFAULT_MIN_CHANNEL, @@ -635,6 +652,21 @@ void PIOS_RFM22B_SetChannelConfig(uint32_t rfm22b_id, enum rfm22b_datarate datar } } +/** + * Set a XtalCap + * + * @param[in] rfm22b_id The RFM22B device index. + * @param[in] XtalCap Value. + */ +void PIOS_RFM22B_SetXtalCap(uint32_t rfm22b_id, uint8_t xtal_cap) +{ + struct pios_rfm22b_dev *rfm22b_dev = (struct pios_rfm22b_dev *)rfm22b_id; + + if (PIOS_RFM22B_Validate(rfm22b_dev)) { + rfm22b_dev->cfg.RFXtalCap = xtal_cap; + } +} + /** * Set a modem to be a coordinator or not. * @@ -1056,13 +1088,13 @@ pios_rfm22b_int_result PIOS_RFM22B_ProcessRx(uint32_t rfm22b_id) // read the 10-bit signed afc correction value // bits 9 to 2 - uint16_t afc_correction = (uint16_t)rfm22_read(rfm22b_dev, RFM22_afc_correction_read) << 8; + int16_t afc_correction = (uint16_t)rfm22_read(rfm22b_dev, RFM22_afc_correction_read) << 8; // bits 1 & 0 - afc_correction |= (uint16_t)rfm22_read(rfm22b_dev, RFM22_ook_counter_value1) & 0x00c0; + afc_correction |= (int16_t)rfm22_read(rfm22b_dev, RFM22_ook_counter_value1) & 0x00c0; afc_correction >>= 6; // convert the afc value to Hz int32_t afc_corr = (int32_t)(rfm22b_dev->frequency_step_size * afc_correction + 0.5f); - rfm22b_dev->afc_correction_Hz = (afc_corr < -127) ? -127 : ((afc_corr > 127) ? 127 : afc_corr); + rfm22b_dev->afc_correction_Hz = afc_corr; // read rx signal strength .. 45 = -100dBm, 205 = -20dBm uint8_t rssi = rfm22_read(rfm22b_dev, RFM22_rssi); @@ -1556,8 +1588,13 @@ static enum pios_radio_event rfm22_init(struct pios_rfm22b_dev *rfm22b_dev) // RX FIFO Almost Full Threshold (0 - 63) rfm22_write(rfm22b_dev, RFM22_rx_fifo_control, RX_FIFO_HI_WATERMARK); - // Set the frequency calibration - rfm22_write(rfm22b_dev, RFM22_xtal_osc_load_cap, rfm22b_dev->cfg.RFXtalCap); + // Set the xtal capacitor for frequency calibration + // Cint = 1.8 pF + 0.085 pF x xlc[6:0] + 3.7 pF x xlc[7] (xtalshift) + // cfg.RFXtalCap 0 to 171 range give Cint = 1.8pF to 16.295pF range + // Default is 127, equal to 12.595pF + rfm22_write(rfm22b_dev, + RFM22_xtal_osc_load_cap, + (rfm22b_dev->cfg.RFXtalCap < 128) ? rfm22b_dev->cfg.RFXtalCap : (rfm22b_dev->cfg.RFXtalCap + 84)); // Release the bus rfm22_releaseBus(rfm22b_dev); @@ -1566,7 +1603,7 @@ static enum pios_radio_event rfm22_init(struct pios_rfm22b_dev *rfm22b_dev) vTaskDelay(1 + (1 / (portTICK_RATE_MS + 1))); // Initialize the frequency and datarate to te default. - rfm22_setNominalCarrierFrequency(rfm22b_dev, 0); + rfm22_setNominalCarrierFrequency(rfm22b_dev, 0, rfm22b_dev->base_freq); pios_rfm22_setDatarate(rfm22b_dev); return RADIO_EVENT_INITIALIZED; @@ -1656,10 +1693,8 @@ static void pios_rfm22_setDatarate(struct pios_rfm22b_dev *rfm22b_dev) * @param[in] rfm33b_dev The device structure pointer. * @param[in] init_chan The initial channel to tune to. */ -static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint8_t init_chan) +static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, uint8_t init_chan, uint32_t frequency_hz) { - // Set the frequency channels to start at 430MHz - uint32_t frequency_hz = RFM22B_NOMINAL_CARRIER_FREQUENCY; // The step size is 10MHz / 250 = 40khz, and the step size is specified in 10khz increments. uint8_t freq_hop_step_size = 4; @@ -1682,11 +1717,11 @@ static void rfm22_setNominalCarrierFrequency(struct pios_rfm22b_dev *rfm22b_dev, // Claim the SPI bus. rfm22_claimBus(rfm22b_dev); - // Setthe frequency hopping step size. + // Set the frequency hopping step size. rfm22_write(rfm22b_dev, RFM22_frequency_hopping_step_size, freq_hop_step_size); - // frequency hopping channel (0-255) - rfm22b_dev->frequency_step_size = 156.25f * hbsel; + // frequency step + rfm22b_dev->frequency_step_size = 156.25f * (hbsel + 1); // frequency hopping channel (0-255) rfm22b_dev->channel = init_chan; @@ -2049,9 +2084,10 @@ static enum pios_radio_event radio_receivePacket(struct pios_rfm22b_dev *radio_d radio_dev->rx_destination_id == rfm22_destinationID(radio_dev)) { rfm22_synchronizeClock(radio_dev); } - radio_dev->stats.link_state = OPLINKSTATUS_LINKSTATE_CONNECTED; - radio_dev->last_contact = xTaskGetTickCount(); + radio_dev->stats.link_state = OPLINKSTATUS_LINKSTATE_CONNECTED; + radio_dev->last_contact = xTaskGetTickCount(); radio_dev->stats.rssi = radio_dev->rssi_dBm; + radio_dev->stats.afc_correction = radio_dev->afc_correction_Hz; } else { ret_event = RADIO_EVENT_RX_COMPLETE; } diff --git a/flight/pios/inc/pios_rfm22b.h b/flight/pios/inc/pios_rfm22b.h index 16dd460b2..696532839 100644 --- a/flight/pios/inc/pios_rfm22b.h +++ b/flight/pios/inc/pios_rfm22b.h @@ -96,15 +96,16 @@ struct rfm22b_stats { uint8_t timeouts; uint8_t link_quality; int8_t rssi; - int8_t afc_correction; + int32_t afc_correction; uint8_t link_state; }; /* 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 int32_t PIOS_RFM22B_Init(uint32_t *rfb22b_id, uint32_t spi_id, uint32_t slave_num, const struct pios_rfm22b_cfg *cfg, OPLinkSettingsRFBandOptions band); 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_SetChannelConfig(uint32_t rfm22b_id, enum rfm22b_datarate datarate, uint8_t min_chan, uint8_t max_chan, bool coordinator, bool ppm_mode, bool ppm_only); +extern void PIOS_RFM22B_SetXtalCap(uint32_t rfm22b_id, uint8_t xtal_cap); extern void PIOS_RFM22B_SetCoordinatorID(uint32_t rfm22b_id, uint32_t coord_id); extern void PIOS_RFM22B_SetDeviceID(uint32_t rfm22b_id, uint32_t device_id); extern uint32_t PIOS_RFM22B_DeviceID(uint32_t rfb22b_id); diff --git a/flight/pios/inc/pios_rfm22b_priv.h b/flight/pios/inc/pios_rfm22b_priv.h index 953c90fc0..9d267d7d6 100644 --- a/flight/pios/inc/pios_rfm22b_priv.h +++ b/flight/pios/inc/pios_rfm22b_priv.h @@ -283,6 +283,9 @@ struct pios_rfm22b_dev { // Are we sending / receiving only PPM data? bool ppm_only_mode; + // The base freq in Hertz + uint32_t base_freq; + // The channel list uint8_t channels[RFM22B_NUM_CHANNELS]; // The number of frequency hopping channels. @@ -294,7 +297,7 @@ struct pios_rfm22b_dev { // current frequency hop channel index uint8_t channel_index; // afc correction reading (in Hz) - int8_t afc_correction_Hz; + int32_t afc_correction_Hz; // The packet timers. portTickType packet_start_ticks; diff --git a/flight/targets/boards/discoveryf4bare/firmware/pios_board.c b/flight/targets/boards/discoveryf4bare/firmware/pios_board.c index a58fd1d31..fe2559b32 100644 --- a/flight/targets/boards/discoveryf4bare/firmware/pios_board.c +++ b/flight/targets/boards/discoveryf4bare/firmware/pios_board.c @@ -761,10 +761,10 @@ void PIOS_Board_Init(void) } /* hwsettings_rm_flexiport */ - /* Initalize the RFM22B radio COM device. */ + /* Initialize the RFM22B radio COM device. */ #if defined(PIOS_INCLUDE_RFM22B) - /* Fetch the OPinkSettings object. */ + /* Fetch the OPLinkSettings object. */ OPLinkSettingsData oplinkSettings; OPLinkSettingsGet(&oplinkSettings); @@ -784,7 +784,7 @@ void PIOS_Board_Init(void) if (oplinkSettings.MaxRFPower != OPLINKSETTINGS_MAXRFPOWER_0) { /* Configure the RFM22B device. */ const struct pios_rfm22b_cfg *rfm22b_cfg = PIOS_BOARD_HW_DEFS_GetRfm22Cfg(bdinfo->board_rev); - if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg)) { + if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg, oplinkSettings.RFBand)) { PIOS_Assert(0); } @@ -825,8 +825,9 @@ void PIOS_Board_Init(void) /* Set the radio configuration parameters. */ PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); - PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, is_oneway, ppm_mode, ppm_only); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); + PIOS_RFM22B_SetXtalCap(pios_rfm22b_id, oplinkSettings.RFXtalCap); + PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, data_mode, ppm_mode); /* Set the PPM callback if we should be receiving PPM. */ if (ppm_mode || (ppm_only && !is_coordinator)) { diff --git a/flight/targets/boards/oplinkmini/firmware/pios_board.c b/flight/targets/boards/oplinkmini/firmware/pios_board.c index a6f7574ca..f1e3b78a5 100644 --- a/flight/targets/boards/oplinkmini/firmware/pios_board.c +++ b/flight/targets/boards/oplinkmini/firmware/pios_board.c @@ -396,7 +396,7 @@ void PIOS_Board_Init(void) PIOS_SYS_SerialNumberGetBinary(oplinkStatus.CPUSerial); oplinkStatus.BoardRevision = bdinfo->board_rev; - /* Initalize the RFM22B radio COM device. */ + /* Initialize the RFM22B radio COM device. */ if (is_enabled) { if (openlrs) { #if defined(PIOS_INCLUDE_OPENLRS) @@ -413,7 +413,8 @@ void PIOS_Board_Init(void) // Configure the RFM22B device const struct pios_rfm22b_cfg *rfm22b_cfg = PIOS_BOARD_HW_DEFS_GetRfm22Cfg(bdinfo->board_rev); - if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg)) { + + if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg, oplinkSettings.RFBand)) { PIOS_Assert(0); } @@ -485,6 +486,7 @@ void PIOS_Board_Init(void) // Set the radio configuration parameters. PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); + PIOS_RFM22B_SetXtalCap(pios_rfm22b_id, oplinkSettings.RFXtalCap); PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, data_mode, ppm_mode); /* Set the PPM callback if we should be receiving PPM. */ diff --git a/flight/targets/boards/revolution/firmware/pios_board.c b/flight/targets/boards/revolution/firmware/pios_board.c index 7f7ddee07..15b0a2f9b 100644 --- a/flight/targets/boards/revolution/firmware/pios_board.c +++ b/flight/targets/boards/revolution/firmware/pios_board.c @@ -867,10 +867,10 @@ void PIOS_Board_Init(void) GPIO_WriteBit(pios_sbus_cfg.inv.gpio, pios_sbus_cfg.inv.init.GPIO_Pin, pios_sbus_cfg.gpio_inv_disable); } - /* Initalize the RFM22B radio COM device. */ + /* Initialize the RFM22B radio COM device. */ #if defined(PIOS_INCLUDE_RFM22B) - /* Fetch the OPinkSettings object. */ + /* Fetch the OPLinkSettings object. */ OPLinkSettingsData oplinkSettings; OPLinkSettingsGet(&oplinkSettings); @@ -912,7 +912,8 @@ void PIOS_Board_Init(void) } else { /* Configure the RFM22B device. */ const struct pios_rfm22b_cfg *rfm22b_cfg = PIOS_BOARD_HW_DEFS_GetRfm22Cfg(bdinfo->board_rev); - if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg)) { + + if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg, oplinkSettings.RFBand)) { PIOS_Assert(0); } @@ -955,6 +956,7 @@ void PIOS_Board_Init(void) /* Set the radio configuration parameters. */ PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); + PIOS_RFM22B_SetXtalCap(pios_rfm22b_id, oplinkSettings.RFXtalCap); PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, data_mode, ppm_mode); /* Set the PPM callback if we should be receiving PPM. */ diff --git a/flight/targets/boards/sparky2/firmware/pios_board.c b/flight/targets/boards/sparky2/firmware/pios_board.c index e8a82a2f4..c73b96aea 100644 --- a/flight/targets/boards/sparky2/firmware/pios_board.c +++ b/flight/targets/boards/sparky2/firmware/pios_board.c @@ -807,10 +807,10 @@ void PIOS_Board_Init(void) } /* hwsettings_spk2_mainport */ - /* Initalize the RFM22B radio COM device. */ + /* Initialize the RFM22B radio COM device. */ #if defined(PIOS_INCLUDE_RFM22B) - /* Fetch the OPinkSettings object. */ + /* Fetch the OPLinkSettings object. */ OPLinkSettingsData oplinkSettings; OPLinkSettingsGet(&oplinkSettings); @@ -852,7 +852,8 @@ void PIOS_Board_Init(void) } else { /* Configure the RFM22B device. */ const struct pios_rfm22b_cfg *rfm22b_cfg = PIOS_BOARD_HW_DEFS_GetRfm22Cfg(bdinfo->board_rev); - if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg)) { + + if (PIOS_RFM22B_Init(&pios_rfm22b_id, PIOS_RFM22_SPI_PORT, rfm22b_cfg->slave_num, rfm22b_cfg, oplinkSettings.RFBand)) { PIOS_Assert(0); } @@ -895,6 +896,7 @@ void PIOS_Board_Init(void) /* Set the radio configuration parameters. */ PIOS_RFM22B_SetDeviceID(pios_rfm22b_id, oplinkSettings.CustomDeviceID); PIOS_RFM22B_SetCoordinatorID(pios_rfm22b_id, oplinkSettings.CoordID); + PIOS_RFM22B_SetXtalCap(pios_rfm22b_id, oplinkSettings.RFXtalCap); PIOS_RFM22B_SetChannelConfig(pios_rfm22b_id, datarate, oplinkSettings.MinChannel, oplinkSettings.MaxChannel, is_coordinator, data_mode, ppm_mode); /* Set the PPM callback if we should be receiving PPM. */ diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.cpp b/ground/gcs/src/plugins/config/configoplinkwidget.cpp index 611cb7a17..634cab08d 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.cpp +++ b/ground/gcs/src/plugins/config/configoplinkwidget.cpp @@ -41,7 +41,6 @@ // Channel range and Frequency display static const int MAX_CHANNEL_NUM = 250; static const int MIN_CHANNEL_RANGE = 10; -static const float FIRST_FREQUENCY = 430.000; static const float FREQUENCY_STEP = 0.040; ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(parent, false), statusUpdated(false) @@ -76,6 +75,7 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("OPLinkSettings", "LinkType", m_oplink->LinkType); addWidgetBinding("OPLinkSettings", "CoordID", m_oplink->CoordID); addWidgetBinding("OPLinkSettings", "CustomDeviceID", m_oplink->CustomDeviceID); + addWidgetBinding("OPLinkSettings", "RFBand", m_oplink->RFBand); addWidgetBinding("OPLinkSettings", "MinChannel", m_oplink->MinimumChannel); addWidgetBinding("OPLinkSettings", "MaxChannel", m_oplink->MaximumChannel); addWidgetBinding("OPLinkSettings", "MaxRFPower", m_oplink->MaxRFTxPower); @@ -84,6 +84,9 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("OPLinkSettings", "FlexiPort", m_oplink->FlexiPort); addWidgetBinding("OPLinkSettings", "VCPPort", m_oplink->VCPPort); + addWidgetBinding("OPLinkSettings", "RFXtalCap", m_oplink->RFXtalCapValue); + addWidgetBinding("OPLinkSettings", "RFXtalCap", m_oplink->RFXtalCapSlider); + addWidgetBinding("OPLinkStatus", "DeviceID", m_oplink->DeviceID); addWidgetBinding("OPLinkStatus", "RxGood", m_oplink->Good); addWidgetBinding("OPLinkStatus", "RxCorrected", m_oplink->Corrected); @@ -104,6 +107,7 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("OPLinkStatus", "TXRate", m_oplink->TXRate); addWidgetBinding("OPLinkStatus", "RXPacketRate", m_oplink->RXPacketRate); addWidgetBinding("OPLinkStatus", "TXPacketRate", m_oplink->TXPacketRate); + addWidgetBinding("OPLinkStatus", "AFCCorrection", m_oplink->AFCCorrection); // initially hide port combo boxes setPortsVisible(false); @@ -111,6 +115,7 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren // Connect the selection changed signals. connect(m_oplink->Protocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolChanged())); connect(m_oplink->LinkType, SIGNAL(currentIndexChanged(int)), this, SLOT(linkTypeChanged())); + connect(m_oplink->RFBand, SIGNAL(currentIndexChanged(int)), this, SLOT(rfBandChanged())); connect(m_oplink->MinimumChannel, SIGNAL(valueChanged(int)), this, SLOT(minChannelChanged())); connect(m_oplink->MaximumChannel, SIGNAL(valueChanged(int)), this, SLOT(maxChannelChanged())); connect(m_oplink->MainPort, SIGNAL(currentIndexChanged(int)), this, SLOT(mainPortChanged())); @@ -169,7 +174,10 @@ void ConfigOPLinkWidget::updateStatus() bool linkConnected = (oplinkStatusObj->linkState() == OPLinkStatus_LinkState::Connected); m_oplink->PairSignalStrengthBar1->setValue(linkConnected ? m_oplink->RSSI->text().toInt() : -127); - m_oplink->PairSignalStrengthLabel1->setText(QString("%1dB").arg(m_oplink->PairSignalStrengthBar1->value())); + m_oplink->PairSignalStrengthLabel1->setText(QString("%1dBm").arg(m_oplink->PairSignalStrengthBar1->value())); + + int afc_valueKHz = m_oplink->AFCCorrection->text().toInt() / 1000; + m_oplink->AFCCorrectionBar->setValue(afc_valueKHz); // Enable components based on the board type connected. switch (oplinkStatusObj->boardType()) { @@ -256,6 +264,7 @@ void ConfigOPLinkWidget::updateSettings() m_oplink->UnbindButton->setEnabled(is_enabled && is_bound && !is_coordinator); m_oplink->CustomDeviceID->setEnabled(is_coordinator); + m_oplink->RFBand->setEnabled(is_receiver || is_coordinator); m_oplink->MinimumChannel->setEnabled(is_receiver || is_coordinator); m_oplink->MaximumChannel->setEnabled(is_receiver || is_coordinator); @@ -289,6 +298,27 @@ void ConfigOPLinkWidget::maxChannelChanged() channelChanged(true); } +void ConfigOPLinkWidget::rfBandChanged() +{ + switch (getComboboxSelectedOption(m_oplink->RFBand)) { + case OPLinkSettings::RFBAND_915MHZ: + frequency_base = 900.0f; + frequency_step = FREQUENCY_STEP * 2.0f; + break; + case OPLinkSettings::RFBAND_868MHZ: + frequency_base = 860.0f; + frequency_step = FREQUENCY_STEP * 2.0f; + break; + case OPLinkSettings::RFBAND_433MHZ: + frequency_base = 430.0f; + frequency_step = FREQUENCY_STEP; + break; + } + + // Update frequency display according to the RF band change + updateFrequencyDisplay(); +} + void ConfigOPLinkWidget::channelChanged(bool isMax) { int minChannel = m_oplink->MinimumChannel->value(); @@ -315,9 +345,14 @@ void ConfigOPLinkWidget::channelChanged(bool isMax) m_oplink->MaximumChannel->setValue(maxChannel); m_oplink->MinimumChannel->setValue(minChannel); + updateFrequencyDisplay(); +} + +void ConfigOPLinkWidget::updateFrequencyDisplay() +{ // Calculate and Display frequency in MHz - float minFrequency = FIRST_FREQUENCY + (minChannel * FREQUENCY_STEP); - float maxFrequency = FIRST_FREQUENCY + (maxChannel * FREQUENCY_STEP); + float minFrequency = frequency_base + (m_oplink->MinimumChannel->value() * frequency_step); + float maxFrequency = frequency_base + (m_oplink->MaximumChannel->value() * frequency_step); m_oplink->MinFreq->setText("(" + QString::number(minFrequency, 'f', 3) + " MHz)"); m_oplink->MaxFreq->setText("(" + QString::number(maxFrequency, 'f', 3) + " MHz)"); diff --git a/ground/gcs/src/plugins/config/configoplinkwidget.h b/ground/gcs/src/plugins/config/configoplinkwidget.h index 70043e257..959e28b7d 100644 --- a/ground/gcs/src/plugins/config/configoplinkwidget.h +++ b/ground/gcs/src/plugins/config/configoplinkwidget.h @@ -51,6 +51,10 @@ private: OPLinkStatus *oplinkStatusObj; OPLinkSettings *oplinkSettingsObj; + // Frequency display settings + float frequency_base; + float frequency_step; + // Is the status current? bool statusUpdated; @@ -68,7 +72,9 @@ private slots: void minChannelChanged(); void maxChannelChanged(); + void rfBandChanged(); void channelChanged(bool isMax); + void updateFrequencyDisplay(); void mainPortChanged(); void flexiPortChanged(); diff --git a/ground/gcs/src/plugins/config/oplink.ui b/ground/gcs/src/plugins/config/oplink.ui index 546fd0a37..5e6dfca6f 100644 --- a/ground/gcs/src/plugins/config/oplink.ui +++ b/ground/gcs/src/plugins/config/oplink.ui @@ -16,6 +16,9 @@ + + Qt::NoFocus + OPLink Configuration @@ -38,6 +41,9 @@ + + Qt::NoFocus + QFrame::NoFrame @@ -95,22 +101,6 @@ Configuration - - - - - 50 - false - - - - Flexi Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -148,345 +138,6 @@ The device must be rebooted for the binding to take place. - - - - Clear the binding/coordinator ID - - - Unbind - - - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 440.000 (MHz) - - - - - - - - - - 50 - false - - - - VCP Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 50 - false - - - - Max Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 50 - false - - - - Min Chan - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the flexi port. - - - - - - - - 16777215 - 16777215 - - - - Set the modem protocol - - - Qt::LeftToRight - - - 0 - - - - - - - - 16777215 - 16777215 - - - - Choose the function for the USB virtual com port. - - - - - - - Com speed in bps. - - - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - 50 - false - - - - Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. - - - 250 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 430.000 (MHz) - - - - - - - - - - 50 - false - - - - Protocol - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Com Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Set the maximum TX output power the modem will use (mW) -0 to disable the modem. - - - Qt::LeftToRight - - - 0 - - - - - - - - 50 - false - - - - Link Type - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Device ID - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Configure what type of packets will be sent over the link - - - Qt::LeftToRight - - - 0 - - - @@ -545,6 +196,82 @@ Leave blank to use autogenerated Device ID. + + + + + 50 + false + + + + Main Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 50 + false + + + + Max Chan + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the modem protocol + + + Qt::LeftToRight + + + 0 + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the main port. + + + @@ -567,24 +294,72 @@ Leave blank to use autogenerated Device ID. - - - - - 50 - false - + + + + Qt::Horizontal - - Main Port + + + 40 + 20 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + - - + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 440.000 (MHz) + + + + + + + 16777215 @@ -592,7 +367,186 @@ Leave blank to use autogenerated Device ID. - Choose the function for the main port. + Choose the function for the flexi port. + + + + + + + Qt::NoFocus + + + Clear the binding/coordinator ID + + + Unbind + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + 50 + false + + + + Min Chan + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Protocol + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Com Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Com speed in bps. + + + + + + + + 50 + false + + + + Link Type + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + 50 + false + + + + Channel 0 is 430 MHz, channel 250 is 440 MHz, and the channel spacing is 40 KHz. + + + 250 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 430.000 (MHz) + + + + + + + + + + 50 + false + + + + Device ID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Flexi Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -615,18 +569,108 @@ Leave blank to use autogenerated Device ID. - - - - Qt::Horizontal - - + + + - 40 - 20 + 16777215 + 16777215 - + + Configure what type of packets will be sent over the link + + + Qt::LeftToRight + + + 0 + + + + + + + + 16777215 + 16777215 + + + + Set the maximum TX output power the modem will use (mW) +0 to disable the modem. + + + Qt::LeftToRight + + + 0 + + + + + + + + 50 + false + + + + RF Band + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 90 + 16777215 + + + + Set the RF Band used. + + + Qt::LeftToRight + + + 0 + + + + + + + + 50 + false + + + + VCP Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Choose the function for the USB virtual com port. + + @@ -673,7 +717,7 @@ Leave blank to use autogenerated Device ID. - -100dB + -100dBm Qt::AlignCenter @@ -741,7 +785,7 @@ Leave blank to use autogenerated Device ID. - + Qt::Vertical @@ -754,7 +798,7 @@ Leave blank to use autogenerated Device ID. - + @@ -837,6 +881,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -874,6 +921,12 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + + + true + 8 @@ -933,6 +986,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The modems current state. @@ -999,6 +1055,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1027,6 +1086,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1071,6 +1133,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1121,6 +1186,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The percentage of packets that were corrected with error correction @@ -1162,6 +1230,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1196,6 +1267,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The percentage of packets that were corrected with error correction @@ -1221,6 +1295,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1297,6 +1374,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + true @@ -1318,6 +1398,22 @@ Leave blank to use autogenerated Device ID. + + + + + 50 + false + + + + RSSI + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -1348,6 +1444,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1356,22 +1455,6 @@ Leave blank to use autogenerated Device ID. - - - - - 50 - false - - - - RSSI - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -1424,6 +1507,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1452,6 +1538,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The percentage of packets that could not be corrected with error correction @@ -1489,6 +1578,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The percentage of packets that were not received at all @@ -1514,6 +1606,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1536,6 +1631,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + true @@ -1593,6 +1691,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The number of packets that were unable to be transmitted @@ -1662,6 +1763,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + The percentage of packets that were not received at all @@ -1709,6 +1813,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1731,6 +1838,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1785,6 +1895,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1807,6 +1920,9 @@ Leave blank to use autogenerated Device ID. false + + Qt::NoFocus + false @@ -1831,10 +1947,33 @@ Leave blank to use autogenerated Device ID. + + + + AFC Correction + + + + + + + + 101 + 16777215 + + + + Qt::NoFocus + + + The automatic frequency correction in Hz. + + + - + Qt::Horizontal @@ -1847,6 +1986,101 @@ Leave blank to use autogenerated Device ID. + + + + Frequency Tuning + + + + 9 + + + 9 + + + 9 + + + 9 + + + + + Qt::NoFocus + + + Adjust the xtal capacitor value to fine tune frequency and +get an AFC value close to zero. Default value is 127. + + + 171 + + + 1 + + + 127 + + + Qt::Horizontal + + + + + + + Adjust the xtal capacitor value to fine tune frequency and +get an AFC value close to zero. Default value is 127. + + + 171 + + + + + + + Xtal Capacitor + + + + + + + The Automatic Frequency Correction: How much the modem will correct +a frequency misalignement between the two modems. + + + -50 + + + 50 + + + 0 + + + Qt::AlignCenter + + + true + + + %v KHz + + + + + + + AFC Correction + + + + + + @@ -1893,6 +2127,9 @@ Leave blank to use autogenerated Device ID. 25 + + Qt::NoFocus + @@ -1950,8 +2187,20 @@ Leave blank to use autogenerated Device ID. - FirmwareVersion - SerialNumber + Protocol + MaxRFTxPower + LinkType + ComSpeed + CustomDeviceID + CoordID + UnbindButton + RFBand + MaximumChannel + MinimumChannel + MainPort + FlexiPort + VCPPort + RFXtalCapValue applyButton saveButton diff --git a/shared/uavobjectdefinition/oplinksettings.xml b/shared/uavobjectdefinition/oplinksettings.xml index dbf450360..1e538934e 100644 --- a/shared/uavobjectdefinition/oplinksettings.xml +++ b/shared/uavobjectdefinition/oplinksettings.xml @@ -9,26 +9,28 @@ + + - + - + - + diff --git a/shared/uavobjectdefinition/oplinkstatus.xml b/shared/uavobjectdefinition/oplinkstatus.xml index fdb3d5053..7d9605c61 100644 --- a/shared/uavobjectdefinition/oplinkstatus.xml +++ b/shared/uavobjectdefinition/oplinkstatus.xml @@ -19,6 +19,7 @@ +