diff --git a/flight/PipXtreme/api_config.c b/flight/PipXtreme/api_config.c index 28019fe91..a8a319284 100644 --- a/flight/PipXtreme/api_config.c +++ b/flight/PipXtreme/api_config.c @@ -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 diff --git a/flight/PipXtreme/inc/packet_handler.h b/flight/PipXtreme/inc/packet_handler.h index 16c2efcaf..965b42305 100644 --- a/flight/PipXtreme/inc/packet_handler.h +++ b/flight/PipXtreme/inc/packet_handler.h @@ -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); diff --git a/flight/PipXtreme/inc/rfm22b.h b/flight/PipXtreme/inc/rfm22b.h index fef1104e3..bf40f06ce 100644 --- a/flight/PipXtreme/inc/rfm22b.h +++ b/flight/PipXtreme/inc/rfm22b.h @@ -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); diff --git a/flight/PipXtreme/packet_handler.c b/flight/PipXtreme/packet_handler.c index 6d5be42ac..ba62bfcd8 100644 --- a/flight/PipXtreme/packet_handler.c +++ b/flight/PipXtreme/packet_handler.c @@ -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(); } diff --git a/flight/PipXtreme/rfm22b.c b/flight/PipXtreme/rfm22b.c index 2c8870c3c..cb7c19873 100644 --- a/flight/PipXtreme/rfm22b.c +++ b/flight/PipXtreme/rfm22b.c @@ -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