1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

Fixed firmware description in PipX status.

This commit is contained in:
Brian Webb 2012-05-17 20:35:17 -07:00
parent 6fbc3339d5
commit 68d66d4181
3 changed files with 36 additions and 35 deletions

View File

@ -291,7 +291,7 @@ static void comUAVTalkTask(void *parameters)
data->txBytes++;
// Get a TX packet from the packet handler if required.
if ((p == NULL) && !PIOS_COM_TRANS_COM)
if (p == NULL)
{
// Wait until we receive a sync.
@ -320,8 +320,7 @@ static void comUAVTalkTask(void *parameters)
}
// Insert this byte.
if(p)
p->data[p->header.data_size++] = rx_byte;
p->data[p->header.data_size++] = rx_byte;
// Keep reading until we receive a completed packet.
UAVTalkRxState state = UAVTalkProcessInputStreamQuiet(data->inUAVTalkCon, rx_byte);
@ -391,14 +390,12 @@ static void comUAVTalkTask(void *parameters)
}
// Release the packet, since we don't need it.
if(p)
PHReleaseTXPacket(pios_packet_handler, p);
PHReleaseTXPacket(pios_packet_handler, p);
}
else
{
// Otherwise, queue the packet for transmission if we're using UAVTalk comms.
if(p)
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
// Otherwise, queue the packet for transmission.
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
}
}
else
@ -428,15 +425,13 @@ static void comUAVTalkTask(void *parameters)
}
// Release the packet, since we don't need it.
if(p)
PHReleaseTXPacket(pios_packet_handler, p);
PHReleaseTXPacket(pios_packet_handler, p);
}
}
else
{
// Queue the packet for transmission if we're using UAVTalk comms.
if(p)
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
// Queue the packet for transmission.
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
}
p = NULL;
@ -454,14 +449,12 @@ static void comUAVTalkTask(void *parameters)
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
// Release the packet and start over again.
if(p)
PHReleaseTXPacket(pios_packet_handler, p);
PHReleaseTXPacket(pios_packet_handler, p);
}
else
{
// Transmit the packet anyway...
if(p)
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
}
p = NULL;
}
@ -637,7 +630,7 @@ static void transparentCommTask(void * parameters)
// Receive data from the com port
uint32_t cur_rx_bytes = PIOS_COM_ReceiveBuffer(PIOS_COM_TRANS_COM, p->data + p->header.data_size,
PH_MAX_DATA - p->header.data_size, timeout);
PH_MAX_DATA - p->header.data_size, timeout);
// Do we have an data to send?
p->header.data_size += cur_rx_bytes;
@ -698,6 +691,7 @@ static void radioStatusTask(void *parameters)
PipXSettingsPairIDGet(&pairID);
// Update the status
PIOS_BL_HELPER_FLASH_Read_Description(pipxStatus.Description, PIPXSTATUS_DESCRIPTION_NUMELEM);
pipxStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id);
pipxStatus.RSSI = PIOS_RFM22B_RSSI(pios_rfm22b_id);
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_pwm.c
SRC += $(PIOSSTM32F10X)/pios_eeprom.c
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
# PIOS USB related files (separated to make code maintenance more easy)
SRC += $(PIOSSTM32F10X)/pios_usb.c

View File

@ -188,10 +188,29 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object)
// Update the Description field
UAVObjectField* descField = object->getField("Description");
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];
for (unsigned int i = 0; i < PipXStatus::DESCRIPTION_NUMELEM; ++i)
buf[i] = descField->getValue(i).toChar().toAscii();
m_pipx->FirmwareVersion->setText(buf);
for (unsigned int i = 0; i < 26; ++i)
buf[i] = descField->getValue(i + 14).toChar().toAscii();
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 {
qDebug() << "PipXtremeGadgetWidget: Count not read Description field.";
}
@ -224,20 +243,7 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object)
// Update the link state
UAVObjectField* linkField = object->getField("LinkState");
if (linkField) {
const char *msg = "Unknown";
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);
m_pipx->LinkState->setText(linkField->getValue().toString());
} else {
qDebug() << "PipXtremeGadgetWidget: Count not read link state field.";
}