From 2d4e0b397a242a11a23633cb27f535b5fa359efe Mon Sep 17 00:00:00 2001 From: Brian Webb Date: Tue, 2 Oct 2012 20:59:43 -0700 Subject: [PATCH] RFM22B: Removed setting register 0x58 in the rfm22_setDatarate call, which was breaking all data rates < 100000 bps. Also temporatily fixed the datarate at 64kbps. --- flight/PiOS/Common/pios_rfm22b.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flight/PiOS/Common/pios_rfm22b.c b/flight/PiOS/Common/pios_rfm22b.c index 2235f64e5..3c9398694 100644 --- a/flight/PiOS/Common/pios_rfm22b.c +++ b/flight/PiOS/Common/pios_rfm22b.c @@ -1137,6 +1137,7 @@ void rfm22_setDatarate(uint32_t datarate_bps, bool data_whitening) int lookup_index = 0; while (lookup_index < (LOOKUP_SIZE - 1) && data_rate[lookup_index] < datarate_bps) lookup_index++; + lookup_index = 10; datarate_bps = data_rate[lookup_index]; @@ -1166,12 +1167,14 @@ void rfm22_setDatarate(uint32_t datarate_bps, bool data_whitening) // rfm22_afc_limiter rfm22_write(0x2A, reg_2A[lookup_index]); +/* This breaks all bit rates < 100000! if (datarate_bps < 100000) // rfm22_chargepump_current_trimming_override rfm22_write(0x58, 0x80); else // rfm22_chargepump_current_trimming_override rfm22_write(0x58, 0xC0); +*/ // rfm22_tx_data_rate1 rfm22_write(0x6E, reg_6E[lookup_index]); @@ -1550,7 +1553,7 @@ static enum pios_rfm22b_event rfm22_txData(struct pios_rfm22b_dev *rfm22b_dev) } // Packet has been sent - if (rfm22b_dev->int_status1 & RFM22_is1_ipksent) + else if (rfm22b_dev->int_status1 & RFM22_is1_ipksent) { // Free the tx packet PHReleaseTXPacket(pios_packet_handler, rfm22b_dev->tx_packet);