redpine: add packet rate based lqi
#define REDPINE_CHANNEL_START 3
#define REDPINE_CRC16_POLY 0x8005
+#define LQI_FPS 500
extern uint8_t rx_buffer[RX_BUFF_SIZE];
extern uint8_t rx_data[RX_BUFF_SIZE];
@@ -75,12 +76,8 @@ void rx_serial_process_redpine() {
}
// packet lost flag
- if ((rx_data[0] & 0xc0) == 0x40) {
- rx_lqi_lost_packet();
- return;
- } else {
+ if ((rx_data[0] & 0xc0) != 0x40) {
rx_lqi_got_packet();
- }
const uint16_t channels[4] = {
(uint16_t)((rx_data[REDPINE_CHANNEL_START + 1] << 8) & 0x700) | rx_data[REDPINE_CHANNEL_START],
@@ -121,9 +118,17 @@ void rx_serial_process_redpine() {
state.aux[AUX_CHANNEL_9] = (rx_data[REDPINE_CHANNEL_START + 6] & 0x20) ? 1 : 0;
state.aux[AUX_CHANNEL_10] = (rx_data[REDPINE_CHANNEL_START + 6] & 0x40) ? 1 : 0;
state.aux[AUX_CHANNEL_11] = (rx_data[REDPINE_CHANNEL_START + 6] & 0x80) ? 1 : 0;
+ } else {
+ rx_lqi_lost_packet();
+ }
- rx_lqi_update_fps(0);
+ if (profile.channel.lqi_source == RX_LQI_SOURCE_PACKET_RATE) {
+ rx_lqi_update_fps(LQI_FPS);
+ rx_lqi_update_rssi_from_lqi(LQI_FPS);
+ }
+ if (profile.channel.lqi_source == RX_LQI_SOURCE_DIRECT) {
rx_lqi_update_rssi_direct(rx_data[REDPINE_CHANNEL_START + 7]);
+ }
frame_status = FRAME_TX; //We're done with this frame now.
