mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Fixed RSSI when no signal received.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2714 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
ac5155f3d9
commit
3bad7982dd
@ -79,6 +79,7 @@ typedef struct
|
|||||||
uint8_t link_state;
|
uint8_t link_state;
|
||||||
int16_t rssi;
|
int16_t rssi;
|
||||||
int32_t afc;
|
int32_t afc;
|
||||||
|
uint16_t retries;
|
||||||
} __attribute__((__packed__)) t_pipx_config_state;
|
} __attribute__((__packed__)) t_pipx_config_state;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -176,6 +177,7 @@ int apiconfig_sendStatePacket(void)
|
|||||||
state->link_state = ph_getCurrentLinkState(0);
|
state->link_state = ph_getCurrentLinkState(0);
|
||||||
state->rssi = ph_getLastRSSI(0);
|
state->rssi = ph_getLastRSSI(0);
|
||||||
state->afc = ph_getLastAFC(0);
|
state->afc = ph_getLastAFC(0);
|
||||||
|
state->retries = ph_getRetries(0);
|
||||||
|
|
||||||
header->data_crc = updateCRC32Data(0xffffffff, state, header->data_size);
|
header->data_crc = updateCRC32Data(0xffffffff, state, header->data_size);
|
||||||
header->header_crc = 0;
|
header->header_crc = 0;
|
||||||
|
@ -47,6 +47,8 @@ uint16_t ph_getData(const int connection_index, void *data, uint16_t len);
|
|||||||
|
|
||||||
void ph_setFastPing(bool fast);
|
void ph_setFastPing(bool fast);
|
||||||
|
|
||||||
|
uint16_t ph_getRetries(const int connection_index);
|
||||||
|
|
||||||
uint8_t ph_getCurrentLinkState(const int connection_index);
|
uint8_t ph_getCurrentLinkState(const int connection_index);
|
||||||
|
|
||||||
int16_t ph_getLastRSSI(const int connection_index);
|
int16_t ph_getLastRSSI(const int connection_index);
|
||||||
|
@ -1233,13 +1233,13 @@ void ph_processLinks(int connection_index)
|
|||||||
|
|
||||||
t_connection *conn = &connection[connection_index];
|
t_connection *conn = &connection[connection_index];
|
||||||
|
|
||||||
bool canTx = (!rfm22_transmitting() && rfm22_channelIsClear());// TRUE is we are can transmit
|
bool canTx = (!rfm22_transmitting() && rfm22_channelIsClear());// TRUE is we can transmit
|
||||||
|
|
||||||
bool timeToRetry = (rfm22_txReady() && conn->tx_packet_timer >= conn->tx_retry_time);
|
bool timeToRetry = (rfm22_txReady() && conn->tx_packet_timer >= conn->tx_retry_time);
|
||||||
|
|
||||||
bool tomanyRetries = (conn->tx_retry_counter >= RETRY_RECONNECT_COUNT);
|
bool tomanyRetries = (conn->tx_retry_counter >= RETRY_RECONNECT_COUNT);
|
||||||
|
|
||||||
if (conn->tx_retry_counter >= 3)
|
if (conn->tx_retry_counter > 3)
|
||||||
conn->rx_rssi_dBm = -200;
|
conn->rx_rssi_dBm = -200;
|
||||||
|
|
||||||
switch (conn->link_state)
|
switch (conn->link_state)
|
||||||
@ -1406,8 +1406,17 @@ uint8_t ph_getCurrentLinkState(const int connection_index)
|
|||||||
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
t_connection *conn = &connection[connection_index];
|
return connection[connection_index].link_state;
|
||||||
return conn->link_state;
|
}
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
|
||||||
|
uint16_t ph_getRetries(const int connection_index)
|
||||||
|
{
|
||||||
|
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return connection[connection_index].tx_retry_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
@ -1417,8 +1426,7 @@ int16_t ph_getLastRSSI(const int connection_index)
|
|||||||
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
t_connection *conn = &connection[connection_index];
|
return connection[connection_index].rx_rssi_dBm;
|
||||||
return conn->rx_rssi_dBm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ph_getLastAFC(const int connection_index)
|
int32_t ph_getLastAFC(const int connection_index)
|
||||||
@ -1426,8 +1434,7 @@ int32_t ph_getLastAFC(const int connection_index)
|
|||||||
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
t_connection *conn = &connection[connection_index];
|
return connection[connection_index].rx_afc_Hz;
|
||||||
return conn->rx_afc_Hz;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
@ -1515,10 +1522,9 @@ void ph_set_remote_encryption(int connection_index, bool enabled, const void *ke
|
|||||||
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
if (connection_index < 0 || connection_index >= PH_MAX_CONNECTIONS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t_connection *conn = &connection[connection_index];
|
|
||||||
|
|
||||||
ph_set_AES128_key(key);
|
ph_set_AES128_key(key);
|
||||||
conn->send_encrypted = enabled;
|
|
||||||
|
connection[connection_index].send_encrypted = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
|
@ -744,6 +744,36 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="text">
|
||||||
|
<string>Retries</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_Retries">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLineEdit {
|
||||||
|
border: none;
|
||||||
|
border-radius: 1px;
|
||||||
|
padding: 0 8px;
|
||||||
|
background: rgba(0, 0, 0, 16);
|
||||||
|
/* background: transparent; */
|
||||||
|
/* selection-background-color: darkgray;*/
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="frame">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -132,9 +132,11 @@ PipXtremeGadgetWidget::PipXtremeGadgetWidget(QWidget *parent) :
|
|||||||
m_widget->comboBox_SerialBaudrate->addItem("38400", 38400);
|
m_widget->comboBox_SerialBaudrate->addItem("38400", 38400);
|
||||||
m_widget->comboBox_SerialBaudrate->addItem("57600", 57600);
|
m_widget->comboBox_SerialBaudrate->addItem("57600", 57600);
|
||||||
m_widget->comboBox_SerialBaudrate->addItem("115200", 115200);
|
m_widget->comboBox_SerialBaudrate->addItem("115200", 115200);
|
||||||
// m_widget->comboBox_SerialBaudrate->addItem("230400", 230400);
|
#if (defined Q_OS_WIN)
|
||||||
// m_widget->comboBox_SerialBaudrate->addItem("460800", 460800);
|
m_widget->comboBox_SerialBaudrate->addItem("230400", 230400);
|
||||||
// m_widget->comboBox_SerialBaudrate->addItem("921600", 921600);
|
m_widget->comboBox_SerialBaudrate->addItem("460800", 460800);
|
||||||
|
m_widget->comboBox_SerialBaudrate->addItem("921600", 921600);
|
||||||
|
#endif
|
||||||
m_widget->comboBox_SerialBaudrate->setCurrentIndex(m_widget->comboBox_SerialBaudrate->findText("57600"));
|
m_widget->comboBox_SerialBaudrate->setCurrentIndex(m_widget->comboBox_SerialBaudrate->findText("57600"));
|
||||||
|
|
||||||
m_widget->comboBox_Mode->clear();
|
m_widget->comboBox_Mode->clear();
|
||||||
@ -930,8 +932,15 @@ void PipXtremeGadgetWidget::processRxPacket(quint8 *packet, int packet_size)
|
|||||||
m_widget->lineEdit_LinkState->setText("Unknown [" + QString::number(pipx_config_state.link_state) + "]");
|
m_widget->lineEdit_LinkState->setText("Unknown [" + QString::number(pipx_config_state.link_state) + "]");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_widget->progressBar_RSSI->setValue(pipx_config_state.rssi);
|
if (pipx_config_state.rssi < m_widget->progressBar_RSSI->minimum())
|
||||||
|
m_widget->progressBar_RSSI->setValue(m_widget->progressBar_RSSI->minimum());
|
||||||
|
else
|
||||||
|
if (pipx_config_state.rssi > m_widget->progressBar_RSSI->maximum())
|
||||||
|
m_widget->progressBar_RSSI->setValue(m_widget->progressBar_RSSI->maximum());
|
||||||
|
else
|
||||||
|
m_widget->progressBar_RSSI->setValue(pipx_config_state.rssi);
|
||||||
m_widget->lineEdit_RxAFC->setText(QString::number(pipx_config_state.afc) + "Hz");
|
m_widget->lineEdit_RxAFC->setText(QString::number(pipx_config_state.afc) + "Hz");
|
||||||
|
m_widget->lineEdit_Retries->setText(QString::number(pipx_config_state.retries));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1039,6 +1048,7 @@ void PipXtremeGadgetWidget::disconnectPort(bool enable_telemetry, bool lock_stuf
|
|||||||
m_widget->lineEdit_LinkState->setText("");
|
m_widget->lineEdit_LinkState->setText("");
|
||||||
m_widget->progressBar_RSSI->setValue(m_widget->progressBar_RSSI->minimum());
|
m_widget->progressBar_RSSI->setValue(m_widget->progressBar_RSSI->minimum());
|
||||||
m_widget->lineEdit_RxAFC->setText("");
|
m_widget->lineEdit_RxAFC->setText("");
|
||||||
|
m_widget->lineEdit_Retries->setText("");
|
||||||
m_widget->lineEdit_PairedSerialNumber->setText("");
|
m_widget->lineEdit_PairedSerialNumber->setText("");
|
||||||
m_widget->spinBox_FrequencyCalibration->setValue(0);
|
m_widget->spinBox_FrequencyCalibration->setValue(0);
|
||||||
m_widget->doubleSpinBox_Frequency->setValue(0);
|
m_widget->doubleSpinBox_Frequency->setValue(0);
|
||||||
@ -1113,6 +1123,11 @@ void PipXtremeGadgetWidget::connectPort()
|
|||||||
case 115200: bdt = BAUD115200; break;
|
case 115200: bdt = BAUD115200; break;
|
||||||
case 128000: bdt = BAUD128000; break;
|
case 128000: bdt = BAUD128000; break;
|
||||||
case 256000: bdt = BAUD256000; break;
|
case 256000: bdt = BAUD256000; break;
|
||||||
|
#if (defined Q_OS_WIN)
|
||||||
|
case 230400: bdt = BAUD230400; break;
|
||||||
|
case 460800: bdt = BAUD460800; break;
|
||||||
|
case 921600: bdt = BAUD921600; break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PortSettings settings;
|
PortSettings settings;
|
||||||
|
@ -84,6 +84,7 @@ typedef struct
|
|||||||
uint8_t link_state;
|
uint8_t link_state;
|
||||||
int16_t rssi;
|
int16_t rssi;
|
||||||
int32_t afc;
|
int32_t afc;
|
||||||
|
uint16_t retries;
|
||||||
} t_pipx_config_state;
|
} t_pipx_config_state;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
Loading…
x
Reference in New Issue
Block a user