1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

OP-1067 Invalid value for "LinkState"

Do not retrieve status from rfm22b if not initialized.
This commit is contained in:
Mathieu Rondonneau 2013-08-09 20:14:13 -07:00
parent 40b0682048
commit 114e353acb

View File

@ -253,10 +253,12 @@ static void systemTask(__attribute__((unused)) void *parameters)
int delayTime = SYSTEM_UPDATE_PERIOD_MS / portTICK_RATE_MS / (LED_BLINK_RATE_HZ * 2);
#if defined(PIOS_INCLUDE_RFM22B)
// Update the OPLinkStatus UAVO
OPLinkStatusData oplinkStatus;
OPLinkStatusGet(&oplinkStatus);
if (pios_rfm22b_id) {
// Get the other device stats.
PIOS_RFM2B_GetPairStats(pios_rfm22b_id, oplinkStatus.PairIDs, oplinkStatus.PairSignalStrengths, OPLINKSTATUS_PAIRIDS_NUMELEM);
@ -296,8 +298,13 @@ 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;
}
OPLinkStatusSet(&oplinkStatus);
#endif /* if defined(PIOS_INCLUDE_RFM22B) */
if (xQueueReceive(objectPersistenceQueue, &ev, delayTime) == pdTRUE) {