1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-10 18:24:11 +01:00

Merge branch 'Brian-PipXtreme-V2' of ssh://git.openpilot.org/OpenPilot into Brian-PipXtreme-V2

This commit is contained in:
Brian Webb 2012-05-17 20:36:55 -07:00
commit 09754ffda5
4 changed files with 26 additions and 18 deletions

View File

@ -91,7 +91,7 @@ PHInstHandle PHInitialize(PacketHandlerConfig *cfg)
data->lock = xSemaphoreCreateRecursiveMutex(); data->lock = xSemaphoreCreateRecursiveMutex();
// Initialize the ECC library. // Initialize the ECC library.
initialize_ecc(); initialize_ecc();
// Return the structure. // Return the structure.
return (PHInstHandle)data; return (PHInstHandle)data;

View File

@ -691,6 +691,7 @@ static void radioStatusTask(void *parameters)
PipXSettingsPairIDGet(&pairID); PipXSettingsPairIDGet(&pairID);
// Update the status // Update the status
PIOS_BL_HELPER_FLASH_Read_Description(pipxStatus.Description, PIPXSTATUS_DESCRIPTION_NUMELEM);
pipxStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id); pipxStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id);
pipxStatus.RSSI = PIOS_RFM22B_RSSI(pios_rfm22b_id); pipxStatus.RSSI = PIOS_RFM22B_RSSI(pios_rfm22b_id);
pipxStatus.Retries = data->comTxRetries; pipxStatus.Retries = data->comTxRetries;

1
flight/PipXtreme/Makefile Executable file → Normal file
View File

@ -160,6 +160,7 @@ SRC += $(PIOSSTM32F10X)/pios_wdg.c
SRC += $(PIOSSTM32F10X)/pios_tim.c SRC += $(PIOSSTM32F10X)/pios_tim.c
SRC += $(PIOSSTM32F10X)/pios_pwm.c SRC += $(PIOSSTM32F10X)/pios_pwm.c
SRC += $(PIOSSTM32F10X)/pios_eeprom.c SRC += $(PIOSSTM32F10X)/pios_eeprom.c
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
# PIOS USB related files (separated to make code maintenance more easy) # PIOS USB related files (separated to make code maintenance more easy)
SRC += $(PIOSSTM32F10X)/pios_usb.c SRC += $(PIOSSTM32F10X)/pios_usb.c

View File

@ -188,10 +188,29 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object)
// Update the Description field // Update the Description field
UAVObjectField* descField = object->getField("Description"); UAVObjectField* descField = object->getField("Description");
if (descField) { if (descField) {
/*
* This looks like a binary with a description at the end
* 4 bytes: header: "OpFw"
* 4 bytes: git commit hash (short version of SHA1)
* 4 bytes: Unix timestamp of last git commit
* 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
* 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
* ---- 40 bytes limit ---
* 20 bytes: SHA1 sum of the firmware.
* 40 bytes: free for now.
*/
char buf[PipXStatus::DESCRIPTION_NUMELEM]; char buf[PipXStatus::DESCRIPTION_NUMELEM];
for (unsigned int i = 0; i < PipXStatus::DESCRIPTION_NUMELEM; ++i) for (unsigned int i = 0; i < 26; ++i)
buf[i] = descField->getValue(i).toChar().toAscii(); buf[i] = descField->getValue(i + 14).toChar().toAscii();
m_pipx->FirmwareVersion->setText(buf); buf[26] = '\0';
QString descstr(buf);
quint32 gitDate = descField->getValue(11).toChar().toAscii() & 0xFF;
for (int i = 1; i < 4; i++) {
gitDate = gitDate << 8;
gitDate += descField->getValue(11-i).toChar().toAscii() & 0xFF;
}
QString date = QDateTime::fromTime_t(gitDate).toUTC().toString("yyyy-MM-dd HH:mm");
m_pipx->FirmwareVersion->setText(descstr + " " + date);
} else { } else {
qDebug() << "PipXtremeGadgetWidget: Count not read Description field."; qDebug() << "PipXtremeGadgetWidget: Count not read Description field.";
} }
@ -224,20 +243,7 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object)
// Update the link state // Update the link state
UAVObjectField* linkField = object->getField("LinkState"); UAVObjectField* linkField = object->getField("LinkState");
if (linkField) { if (linkField) {
const char *msg = "Unknown"; m_pipx->LinkState->setText(linkField->getValue().toString());
switch (linkField->getValue().toInt())
{
case PipXStatus::LINKSTATE_DISCONNECTED:
msg = "Disconnected";
break;
case PipXStatus::LINKSTATE_CONNECTING:
msg = "Connecting";
break;
case PipXStatus::LINKSTATE_CONNECTED:
msg = "Connected";
break;
}
m_pipx->LinkState->setText(msg);
} else { } else {
qDebug() << "PipXtremeGadgetWidget: Count not read link state field."; qDebug() << "PipXtremeGadgetWidget: Count not read link state field.";
} }