1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Merge remote-tracking branch 'raid/Brian-PipXtreme-V2' into Brian-PipXtreme-V2

This commit is contained in:
Brian Webb 2012-05-15 20:16:01 -07:00
commit f71630a50a
2 changed files with 15 additions and 7 deletions

View File

@ -238,6 +238,8 @@ static int32_t RadioComBridgeInitialize(void)
data->pairStats[i].resets = 0;
data->pairStats[i].lastContact = 0;
}
// The first slot is reserved for our current pairID
PipXSettingsPairIDGet(&(data->pairStats[0].pairID));
// Configure our UAVObjects for updates.
UAVObjConnectQueue(UAVObjGetByName("PipXStatus"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
@ -683,7 +685,7 @@ static void radioStatusTask(void *parameters)
// Get object data
PipXStatusGet(&pipxStatus);
PipXStatusPairIDsGet(&pairID);
PipXSettingsPairIDGet(&pairID);
// Update the status
pipxStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id);
@ -848,14 +850,20 @@ static void StatusHandler(PHStatusPacketHandle status)
// If we haven't seen it, find a slot to put it in.
if (!found)
{
uint32_t pairID;
PipXSettingsPairIDGet(&pairID);
uint8_t min_idx = 0;
int8_t min_rssi = data->pairStats[0].rssi;
for (id_idx = 1; id_idx < PIPXSTATUS_PAIRIDS_NUMELEM; ++id_idx)
if(id != pairID)
{
if(data->pairStats[id_idx].rssi < min_rssi)
int8_t min_rssi = data->pairStats[0].rssi;
for (id_idx = 1; id_idx < PIPXSTATUS_PAIRIDS_NUMELEM; ++id_idx)
{
min_rssi = data->pairStats[id_idx].rssi;
min_idx = id_idx;
if(data->pairStats[id_idx].rssi < min_rssi)
{
min_rssi = data->pairStats[id_idx].rssi;
min_idx = id_idx;
}
}
}
data->pairStats[min_idx].pairID = id;

View File

@ -94,7 +94,7 @@ void PIOS_Board_Init(void) {
#endif /* PIOS_INCLUDE_LED */
PipXSettingsData pipxSettings;
#if defined(PIOS_INCLUDE_FLASH_EEPROM__NOT)
#if defined(PIOS_INCLUDE_FLASH_EEPROM)
PIOS_EEPROM_Init(&pios_eeprom_cfg);
/* Read the settings from flash. */