mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
LP-190: Final testing and bug fixes.
This commit is contained in:
parent
91ea8966da
commit
0738c8a78a
@ -190,8 +190,6 @@ static void systemTask(__attribute__((unused)) void *parameters)
|
||||
oplinkStatus.TXSeq = radio_stats.tx_seq;
|
||||
oplinkStatus.RXSeq = radio_stats.rx_seq;
|
||||
oplinkStatus.LinkState = radio_stats.link_state;
|
||||
} else {
|
||||
oplinkStatus.LinkState = OPLINKSTATUS_LINKSTATE_DISABLED;
|
||||
}
|
||||
|
||||
if (radio_stats.link_state == OPLINKSTATUS_LINKSTATE_CONNECTED) {
|
||||
|
@ -170,13 +170,13 @@ static int32_t RadioComBridgeStart(void)
|
||||
}
|
||||
|
||||
// Configure our UAVObjects for updates.
|
||||
UAVObjConnectQueue(UAVObjGetByID(OPLINKSTATUS_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
|
||||
UAVObjConnectQueue(UAVObjGetByID(OBJECTPERSISTENCE_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL);
|
||||
if (data->isCoordinator) {
|
||||
UAVObjConnectQueue(UAVObjGetByID(OPLINKRECEIVER_OBJID), data->radioEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
|
||||
} else {
|
||||
UAVObjConnectQueue(UAVObjGetByID(OPLINKRECEIVER_OBJID), data->uavtalkEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
|
||||
}
|
||||
registerObject(OPLinkStatusHandle());
|
||||
|
||||
if (data->isCoordinator) {
|
||||
registerObject(RadioComBridgeStatsHandle());
|
||||
|
@ -57,8 +57,6 @@ static uint8_t rfmGetRSSI(struct pios_openlrs_dev *openlrs_dev);
|
||||
static void to_rx_mode(struct pios_openlrs_dev *openlrs_dev);
|
||||
static void tx_packet(struct pios_openlrs_dev *openlrs_dev, uint8_t *pkt, uint8_t size);
|
||||
|
||||
static OPLinkStatusData oplink_status;
|
||||
|
||||
static struct pios_openlrs_dev *pios_openlrs_alloc();
|
||||
static bool pios_openlrs_validate(struct pios_openlrs_dev *openlrs_dev);
|
||||
|
||||
@ -789,6 +787,9 @@ static void pios_openlrs_setup(struct pios_openlrs_dev *openlrs_dev, bool bind)
|
||||
printVersion(OPENLRSNG_VERSION);
|
||||
#endif
|
||||
|
||||
// Get the OPLinkStatus UAVO
|
||||
OPLinkStatusData oplink_status;
|
||||
OPLinkStatusGet(&oplink_status);
|
||||
if (bind) {
|
||||
oplink_status.LinkState = OPLINKSTATUS_LINKSTATE_BINDING;
|
||||
if (pios_openlrs_bind_receive(openlrs_dev, 0)) {
|
||||
@ -817,6 +818,9 @@ static void pios_openlrs_setup(struct pios_openlrs_dev *openlrs_dev, bool bind)
|
||||
openlrs_dev->link_acquired = 0;
|
||||
openlrs_dev->lastPacketTimeUs = micros();
|
||||
|
||||
// Update the OPLinkStatus UAVO
|
||||
OPLinkStatusSet(&oplink_status);
|
||||
|
||||
DEBUG_PRINTF(2, "OpenLRSng RX setup complete\r\n");
|
||||
}
|
||||
|
||||
@ -835,6 +839,13 @@ static void pios_openlrs_rx_loop(struct pios_openlrs_dev *openlrs_dev)
|
||||
to_rx_mode(openlrs_dev);
|
||||
}
|
||||
|
||||
// Get the OPLinkStatus UAVO
|
||||
OPLinkStatusData oplink_status;
|
||||
OPLinkStatusGet(&oplink_status);
|
||||
|
||||
// Update the RSSI
|
||||
oplink_status.RSSI = openlrs_dev->rssi;
|
||||
|
||||
timeUs = micros();
|
||||
timeMs = millis();
|
||||
|
||||
@ -922,7 +933,7 @@ static void pios_openlrs_rx_loop(struct pios_openlrs_dev *openlrs_dev)
|
||||
tx_buf[0] |= (0x37 + bytes);
|
||||
} else {
|
||||
// tx_buf[0] lowest 6 bits left at 0
|
||||
tx_buf[1] = oplink_status.RSSI;
|
||||
tx_buf[1] = openlrs_dev->rssi;
|
||||
if (FlightBatteryStateHandle()) {
|
||||
FlightBatteryStateData bat;
|
||||
FlightBatteryStateGet(&bat);
|
||||
@ -1043,6 +1054,11 @@ static void pios_openlrs_rx_loop(struct pios_openlrs_dev *openlrs_dev)
|
||||
|
||||
uint8_t PIOS_OpenLRS_RSSI_Get(void)
|
||||
{
|
||||
// Get the OPLinkStatus UAVO
|
||||
OPLinkStatusData oplink_status;
|
||||
|
||||
OPLinkStatusGet(&oplink_status);
|
||||
|
||||
if (oplink_status.LinkState != OPLINKSTATUS_LINKSTATE_CONNECTED) {
|
||||
return 0;
|
||||
} else {
|
||||
@ -1286,9 +1302,9 @@ static void pios_openlrs_task(void *parameters)
|
||||
// We timed out to sample RSSI
|
||||
if (openlrs_dev->numberOfLostPackets < 2) {
|
||||
openlrs_dev->lastRSSITimeUs = openlrs_dev->lastPacketTimeUs;
|
||||
oplink_status.RSSI = rfmGetRSSI(openlrs_dev); // Read the RSSI value
|
||||
openlrs_dev->rssi = rfmGetRSSI(openlrs_dev); // Read the RSSI value
|
||||
|
||||
// DEBUG_PRINTF(3, "Sampled RSSI: %d %d\r\n", oplink_status.RSSI, delay);
|
||||
// DEBUG_PRINTF(3, "Sampled RSSI: %d %d\r\n", openlrs_dev->RSSI, delay);
|
||||
}
|
||||
} else {
|
||||
// We timed out because packet was missed
|
||||
|
@ -602,7 +602,6 @@ void PIOS_RFM22B_SetChannelConfig(uint32_t rfm22b_id, enum rfm22b_datarate datar
|
||||
if (!PIOS_RFM22B_Validate(rfm22b_dev)) {
|
||||
return;
|
||||
}
|
||||
ppm_mode = ppm_mode;
|
||||
rfm22b_dev->coordinator = coordinator;
|
||||
rfm22b_dev->ppm_send_mode = ppm_mode && coordinator;
|
||||
rfm22b_dev->ppm_recv_mode = ppm_mode && !coordinator;
|
||||
|
@ -184,6 +184,8 @@ struct pios_openlrs_dev {
|
||||
uint8_t rx_buf[64];
|
||||
uint8_t tx_buf[9];
|
||||
|
||||
int8_t rssi;
|
||||
|
||||
// Variables from OpenLRS for radio control
|
||||
uint8_t hopcount;
|
||||
uint32_t lastPacketTimeUs;
|
||||
|
@ -268,8 +268,8 @@ void ConfigOPLinkWidget::protocolChanged()
|
||||
m_oplink->CustomDeviceID->setEnabled(is_coordinator);
|
||||
m_oplink->MinimumChannel->setEnabled(is_receiver || is_coordinator);
|
||||
m_oplink->MaximumChannel->setEnabled(is_receiver || is_coordinator);
|
||||
m_oplink->MainPort->setEnabled((is_receiver || is_coordinator) && is_oplm);
|
||||
m_oplink->FlexiPort->setEnabled((is_receiver || is_coordinator) && is_oplm);
|
||||
m_oplink->MainPort->setEnabled(is_oplm);
|
||||
m_oplink->FlexiPort->setEnabled(is_oplm);
|
||||
m_oplink->VCPPort->setEnabled((is_receiver || is_coordinator) && is_oplm);
|
||||
m_oplink->LinkType->setEnabled(is_enabled && !is_openlrs);
|
||||
m_oplink->MaxRFTxPower->setEnabled(is_enabled && !is_openlrs);
|
||||
@ -346,7 +346,6 @@ void ConfigOPLinkWidget::updateCustomDeviceID()
|
||||
void ConfigOPLinkWidget::unbind()
|
||||
{
|
||||
if (settingsUpdated) {
|
||||
|
||||
// Clear the coordinator ID
|
||||
oplinkSettingsObj->getField("CoordID")->setValue(0);
|
||||
m_oplink->CoordID->setText("0");
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
<access gcs="readonly" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="throttled" period="500"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="500"/>
|
||||
<logging updatemode="manual" period="0"/>
|
||||
</object>
|
||||
</xml>
|
||||
|
Loading…
Reference in New Issue
Block a user