diff --git a/flight/PipXtreme/api_config.c b/flight/PipXtreme/api_config.c index 525e3f9bd..834c6a783 100644 --- a/flight/PipXtreme/api_config.c +++ b/flight/PipXtreme/api_config.c @@ -79,6 +79,7 @@ typedef struct uint8_t link_state; int16_t rssi; int32_t afc; + uint16_t retries; } __attribute__((__packed__)) t_pipx_config_state; typedef struct @@ -176,6 +177,7 @@ int apiconfig_sendStatePacket(void) state->link_state = ph_getCurrentLinkState(0); state->rssi = ph_getLastRSSI(0); state->afc = ph_getLastAFC(0); + state->retries = ph_getRetries(0); header->data_crc = updateCRC32Data(0xffffffff, state, header->data_size); header->header_crc = 0; diff --git a/flight/PipXtreme/inc/packet_handler.h b/flight/PipXtreme/inc/packet_handler.h index db39901bd..9f7c9a163 100644 --- a/flight/PipXtreme/inc/packet_handler.h +++ b/flight/PipXtreme/inc/packet_handler.h @@ -47,6 +47,8 @@ uint16_t ph_getData(const int connection_index, void *data, uint16_t len); void ph_setFastPing(bool fast); +uint16_t ph_getRetries(const int connection_index); + uint8_t ph_getCurrentLinkState(const int connection_index); int16_t ph_getLastRSSI(const int connection_index); diff --git a/flight/PipXtreme/packet_handler.c b/flight/PipXtreme/packet_handler.c index 054c7338c..352a64bfc 100644 --- a/flight/PipXtreme/packet_handler.c +++ b/flight/PipXtreme/packet_handler.c @@ -1233,13 +1233,13 @@ void ph_processLinks(int 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 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; 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) return 0; - t_connection *conn = &connection[connection_index]; - return conn->link_state; + return connection[connection_index].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) return 0; - t_connection *conn = &connection[connection_index]; - return conn->rx_rssi_dBm; + return connection[connection_index].rx_rssi_dBm; } 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) return 0; - t_connection *conn = &connection[connection_index]; - return conn->rx_afc_Hz; + return connection[connection_index].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) return; - t_connection *conn = &connection[connection_index]; - ph_set_AES128_key(key); - conn->send_encrypted = enabled; + + connection[connection_index].send_encrypted = enabled; } // ***************************************************************************** diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.ui b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.ui index 58e58320c..669796b04 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.ui +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.ui @@ -744,6 +744,36 @@ + + + + Retries + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + QLineEdit { + border: none; + border-radius: 1px; + padding: 0 8px; + background: rgba(0, 0, 0, 16); +/* background: transparent; */ +/* selection-background-color: darkgray;*/ +} + + + false + + + true + + + diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.cpp b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.cpp index 278f288a0..e48aa1758 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.cpp @@ -132,9 +132,11 @@ PipXtremeGadgetWidget::PipXtremeGadgetWidget(QWidget *parent) : m_widget->comboBox_SerialBaudrate->addItem("38400", 38400); m_widget->comboBox_SerialBaudrate->addItem("57600", 57600); m_widget->comboBox_SerialBaudrate->addItem("115200", 115200); -// m_widget->comboBox_SerialBaudrate->addItem("230400", 230400); -// m_widget->comboBox_SerialBaudrate->addItem("460800", 460800); -// m_widget->comboBox_SerialBaudrate->addItem("921600", 921600); + #if (defined Q_OS_WIN) + m_widget->comboBox_SerialBaudrate->addItem("230400", 230400); + 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_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) + "]"); 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_Retries->setText(QString::number(pipx_config_state.retries)); } break; @@ -1039,6 +1048,7 @@ void PipXtremeGadgetWidget::disconnectPort(bool enable_telemetry, bool lock_stuf m_widget->lineEdit_LinkState->setText(""); m_widget->progressBar_RSSI->setValue(m_widget->progressBar_RSSI->minimum()); m_widget->lineEdit_RxAFC->setText(""); + m_widget->lineEdit_Retries->setText(""); m_widget->lineEdit_PairedSerialNumber->setText(""); m_widget->spinBox_FrequencyCalibration->setValue(0); m_widget->doubleSpinBox_Frequency->setValue(0); @@ -1113,6 +1123,11 @@ void PipXtremeGadgetWidget::connectPort() case 115200: bdt = BAUD115200; break; case 128000: bdt = BAUD128000; 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; diff --git a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.h b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.h index 7a62c5bff..d7969199b 100644 --- a/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.h @@ -84,6 +84,7 @@ typedef struct uint8_t link_state; int16_t rssi; int32_t afc; + uint16_t retries; } t_pipx_config_state; typedef struct