1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-20 05:52:11 +01:00

Mostly complete PipX configuration GUI.

This commit is contained in:
Brian Webb 2012-05-11 17:51:18 -07:00
parent 513c014f5a
commit 1f5dbcf57c
13 changed files with 655 additions and 396 deletions

View File

@ -100,6 +100,10 @@ typedef struct {
uint32_t radioTxErrors; uint32_t radioTxErrors;
uint32_t radioTxRetries; uint32_t radioTxRetries;
uint32_t radioRxErrors; uint32_t radioRxErrors;
uint32_t UAVTalkErrors;
uint32_t packetErrors;
uint16_t txBytes;
uint16_t rxBytes;
// The destination ID // The destination ID
uint32_t destination_id; uint32_t destination_id;
@ -214,6 +218,8 @@ static int32_t RadioComBridgeInitialize(void)
data->comTxErrors = 0; data->comTxErrors = 0;
data->comTxRetries = 0; data->comTxRetries = 0;
data->comRxErrors = 0; data->comRxErrors = 0;
data->UAVTalkErrors = 0;
data->packetErrors = 0;
// Register the callbacks with the packet handler // Register the callbacks with the packet handler
PHRegisterOutputStream(pios_packet_handler, transmitPacket); PHRegisterOutputStream(pios_packet_handler, transmitPacket);
@ -236,6 +242,7 @@ static int32_t RadioComBridgeInitialize(void)
// Configure our UAVObjects for updates. // Configure our UAVObjects for updates.
UAVObjConnectQueue(UAVObjGetByName("PipXStatus"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ); UAVObjConnectQueue(UAVObjGetByName("PipXStatus"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
UAVObjConnectQueue(UAVObjGetByName("GCSReceiver"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ); UAVObjConnectQueue(UAVObjGetByName("GCSReceiver"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ);
UAVObjConnectQueue(UAVObjGetByName("ObjectPersistence"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL);
return 0; return 0;
} }
@ -270,6 +277,7 @@ static void comUAVTalkTask(void *parameters)
uint8_t rx_byte; uint8_t rx_byte;
if(!BufferedRead(f, &rx_byte, MAX_PORT_DELAY)) if(!BufferedRead(f, &rx_byte, MAX_PORT_DELAY))
continue; continue;
data->txBytes++;
// Get a TX packet from the packet handler if required. // Get a TX packet from the packet handler if required.
if (p == NULL) if (p == NULL)
@ -307,61 +315,76 @@ static void comUAVTalkTask(void *parameters)
UAVTalkRxState state = UAVTalkProcessInputStreamQuiet(data->inUAVTalkCon, rx_byte); UAVTalkRxState state = UAVTalkProcessInputStreamQuiet(data->inUAVTalkCon, rx_byte);
UAVTalkConnectionData *connection = (UAVTalkConnectionData*)(data->inUAVTalkCon); UAVTalkConnectionData *connection = (UAVTalkConnectionData*)(data->inUAVTalkCon);
UAVTalkInputProcessor *iproc = &(connection->iproc); UAVTalkInputProcessor *iproc = &(connection->iproc);
if (state == UAVTALK_STATE_COMPLETE) { if (state == UAVTALK_STATE_COMPLETE) {
// Is this a local UAVObject? // Is this a local UAVObject?
if (iproc->obj != NULL) if (iproc->obj != NULL)
{ {
// We treat the ObjectPersistance object differently // We treat the ObjectPersistence object differently
if(iproc->objId == OBJECTPERSISTENCE_OBJID) if(iproc->objId == OBJECTPERSISTENCE_OBJID)
{ {
// Unpack object, if the instance does not exist it will be created! // Unpack object, if the instance does not exist it will be created!
UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer); UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer);
// Get the ObjectPersistance object. // Get the ObjectPersistence object.
ObjectPersistenceData obj_per; ObjectPersistenceData obj_per;
ObjectPersistenceGet(&obj_per); ObjectPersistenceGet(&obj_per);
// Is this concerning or setting object? // Is this concerning or setting object?
if (obj_per.ObjectID == PIPXSETTINGS_OBJID) if (obj_per.ObjectID == PIPXSETTINGS_OBJID)
{ {
// Queue up the ACK.
UAVObjEvent ev; UAVObjEvent ev;
ev.obj = iproc->obj; ev.obj = iproc->obj;
ev.instId = 0; ev.instId = iproc->instId;
ev.event = EV_SEND_ACK; ev.event = EV_SEND_ACK;
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
// Is this a save, load, or delete? // Is this a save, load, or delete?
bool success = true;
switch (obj_per.Operation) switch (obj_per.Operation)
{ {
case OBJECTPERSISTENCE_OPERATION_LOAD: case OBJECTPERSISTENCE_OPERATION_LOAD:
DEBUG_PRINTF(2, "Load\n\r");
break;
case OBJECTPERSISTENCE_OPERATION_SAVE:
#if defined(PIOS_INCLUDE_FLASH_EEPROM)
{ {
#if defined(PIOS_INCLUDE_FLASH_EEPROM)
// Load the settings.
PipXSettingsData pipxSettings;
if (PIOS_EEPROM_Load((uint8_t*)&pipxSettings, sizeof(PipXSettingsData)) == 0)
PipXSettingsSet(&pipxSettings);
else
success = false;
#endif
break;
}
case OBJECTPERSISTENCE_OPERATION_SAVE:
{
#if defined(PIOS_INCLUDE_FLASH_EEPROM)
// Save the settings. // Save the settings.
PipXSettingsData pipxSettings; PipXSettingsData pipxSettings;
PipXSettingsGet(&pipxSettings); PipXSettingsGet(&pipxSettings);
if (PIOS_EEPROM_Save((uint8_t*)&pipxSettings, sizeof(PipXSettingsData)) != 0) int32_t ret = PIOS_EEPROM_Save((uint8_t*)&pipxSettings, sizeof(PipXSettingsData));
ev.event = EV_SEND_NACK; if (ret != 0)
success = false;
#endif
break; break;
} }
#endif
case OBJECTPERSISTENCE_OPERATION_DELETE:
DEBUG_PRINTF(2, "Delete\n\r");
break;
default: default:
DEBUG_PRINTF(2, "Other\n\r");
break; break;
} }
if (success == true)
{
obj_per.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
ObjectPersistenceSet(&obj_per);
}
// Queue up the ACK/NACK // Release the packet, since we don't need it.
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); PHReleaseTXPacket(pios_packet_handler, p);
} }
else { else
{
// Otherwise, queue the packet for transmission. // Otherwise, queue the packet for transmission.
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
p = NULL;
} }
} }
else else
@ -381,36 +404,48 @@ static void comUAVTalkTask(void *parameters)
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
break; break;
case UAVTALK_TYPE_OBJ_ACK: case UAVTALK_TYPE_OBJ_ACK:
if (UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer) == 0)
{
// Queue up an ACK // Queue up an ACK
ev.event = EV_SEND_ACK; ev.event = EV_SEND_ACK;
UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer); xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
}
break; break;
} }
// Release the packet, since we don't need it.
PHReleaseTXPacket(pios_packet_handler, p);
} }
} }
else else
{ {
// Queue the packet for transmission. // Queue the packet for transmission.
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
p = NULL;
} }
p = NULL;
} else if(state == UAVTALK_STATE_ERROR) { } else if(state == UAVTALK_STATE_ERROR) {
DEBUG_PRINTF(1, "UAVTalk FAILED!\n\r"); DEBUG_PRINTF(1, "UAVTalk FAILED!\n\r");
data->UAVTalkErrors++;
// Send a NACK if required.
if((iproc->obj) && (iproc->type == UAVTALK_TYPE_OBJ_ACK))
{
// Queue up a NACK
UAVObjEvent ev;
ev.obj = iproc->obj;
ev.event = EV_SEND_NACK;
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
// Release the packet and start over again. // Release the packet and start over again.
PHReleaseTXPacket(pios_packet_handler, p); PHReleaseTXPacket(pios_packet_handler, p);
p = NULL;
// Send a NACK if required.
if((iproc->obj) && (iproc->type == UAVTALK_TYPE_ACK))
{
UAVObjEvent ev;
ev.obj = iproc->obj;
// Queue up a NACK
ev.event = EV_SEND_NACK;
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
} }
else
{
// Transmit the packet anyway...
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
}
p = NULL;
} }
} }
} }
@ -445,6 +480,7 @@ static void radioReceiveTask(void *parameters)
rx_bytes = PIOS_COM_ReceiveBuffer(data->radio_port, (uint8_t*)p, PIOS_PH_MAX_PACKET, MAX_PORT_DELAY); rx_bytes = PIOS_COM_ReceiveBuffer(data->radio_port, (uint8_t*)p, PIOS_PH_MAX_PACKET, MAX_PORT_DELAY);
if(rx_bytes == 0) if(rx_bytes == 0)
continue; continue;
data->rxBytes += rx_bytes;
// Verify that the packet is valid and pass it on. // Verify that the packet is valid and pass it on.
if(PHVerifyPacket(pios_packet_handler, p, rx_bytes) > 0) { if(PHVerifyPacket(pios_packet_handler, p, rx_bytes) > 0) {
@ -453,7 +489,10 @@ static void radioReceiveTask(void *parameters)
ev.event = EV_PACKET_RECEIVED; ev.event = EV_PACKET_RECEIVED;
xQueueSend(data->objEventQueue, &ev, portMAX_DELAY); xQueueSend(data->objEventQueue, &ev, portMAX_DELAY);
} else } else
{
data->packetErrors++;
PHReceivePacket(pios_packet_handler, p, false); PHReceivePacket(pios_packet_handler, p, false);
}
p = NULL; p = NULL;
} }
} }
@ -632,6 +671,12 @@ static void radioStatusTask(void *parameters)
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.Resets = PIOS_RFM22B_Resets(pios_rfm22b_id); pipxStatus.Resets = PIOS_RFM22B_Resets(pios_rfm22b_id);
pipxStatus.Errors = data->packetErrors;
pipxStatus.UAVTalkErrors = data->UAVTalkErrors;
pipxStatus.TXRate = (uint16_t)((float)(data->txBytes * 1000) / STATS_UPDATE_PERIOD_MS);
data->txBytes = 0;
pipxStatus.RXRate = (uint16_t)((float)(data->rxBytes * 1000) / STATS_UPDATE_PERIOD_MS);
data->rxBytes = 0;
// Update the potential pairing contacts // Update the potential pairing contacts
for (uint8_t i = 0; i < PIPXSTATUS_PAIRIDS_NUMELEM; ++i) for (uint8_t i = 0; i < PIPXSTATUS_PAIRIDS_NUMELEM; ++i)
@ -678,7 +723,7 @@ static int32_t transmitData(uint8_t *buf, int32_t length)
if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB) if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB)
outputPort = PIOS_COM_TELEM_USB; outputPort = PIOS_COM_TELEM_USB;
#endif /* PIOS_INCLUDE_USB */ #endif /* PIOS_INCLUDE_USB */
return PIOS_COM_SendBufferNonBlocking(outputPort, buf, length); return PIOS_COM_SendBuffer(outputPort, buf, length);
} }
/** /**

View File

@ -73,7 +73,7 @@ int32_t PIOS_EEPROM_Save(uint8_t *data, uint32_t len)
// See if we have to write the data. // See if we have to write the data.
if ((memcmp(data, (uint8_t*)config.base_address, len) == 0) && if ((memcmp(data, (uint8_t*)config.base_address, len) == 0) &&
(memcmp((uint8_t*)crc, (uint8_t*)config.base_address + size - 4, 4) == 0)) (memcmp((uint8_t*)&crc, (uint8_t*)config.base_address + size - 4, 4) == 0))
return 0; return 0;
// TODO: Check that the area isn't already erased // TODO: Check that the area isn't already erased

View File

@ -180,7 +180,13 @@ void PIOS_Board_Init(void) {
#endif /* PIOS_INCLUDE_USB */ #endif /* PIOS_INCLUDE_USB */
/* Configure USART1 */ /* Configure USART1 (telemetry port) */
switch (pipxSettings.TelemetryConfig)
{
case PIPXSETTINGS_TELEMETRYCONFIG_SERIAL:
case PIPXSETTINGS_TELEMETRYCONFIG_UAVTALK:
case PIPXSETTINGS_TELEMETRYCONFIG_DEBUG:
case PIPXSETTINGS_TELEMETRYCONFIG_DISABLED:
{ {
uint32_t pios_usart1_id; uint32_t pios_usart1_id;
if (PIOS_USART_Init(&pios_usart1_id, &pios_usart_serial_cfg)) { if (PIOS_USART_Init(&pios_usart1_id, &pios_usart_serial_cfg)) {
@ -196,9 +202,20 @@ void PIOS_Board_Init(void) {
tx_buffer, PIOS_COM_SERIAL_TX_BUF_LEN)) { tx_buffer, PIOS_COM_SERIAL_TX_BUF_LEN)) {
PIOS_Assert(0); PIOS_Assert(0);
} }
break;
}
case PIPXSETTINGS_TELEMETRYCONFIG_PPM_IN:
case PIPXSETTINGS_TELEMETRYCONFIG_PPM_OUT:
case PIPXSETTINGS_TELEMETRYCONFIG_RSSI:
break;
} }
/* Configure USART3 */ /* Configure USART3 */
switch (pipxSettings.FlexiConfig)
{
case PIPXSETTINGS_FLEXICONFIG_SERIAL:
case PIPXSETTINGS_FLEXICONFIG_UAVTALK:
case PIPXSETTINGS_FLEXICONFIG_DEBUG:
{ {
uint32_t pios_usart3_id; uint32_t pios_usart3_id;
if (PIOS_USART_Init(&pios_usart3_id, &pios_usart_telem_flexi_cfg)) { if (PIOS_USART_Init(&pios_usart3_id, &pios_usart_telem_flexi_cfg)) {
@ -213,6 +230,13 @@ void PIOS_Board_Init(void) {
tx_buffer, PIOS_COM_FLEXI_TX_BUF_LEN)) { tx_buffer, PIOS_COM_FLEXI_TX_BUF_LEN)) {
PIOS_Assert(0); PIOS_Assert(0);
} }
break;
}
case PIPXSETTINGS_FLEXICONFIG_PPM_IN:
case PIPXSETTINGS_FLEXICONFIG_PPM_OUT:
case PIPXSETTINGS_FLEXICONFIG_RSSI:
case PIPXSETTINGS_FLEXICONFIG_DISABLED:
break;
} }
#if defined(PIOS_INCLUDE_RFM22B) #if defined(PIOS_INCLUDE_RFM22B)

View File

@ -45,9 +45,45 @@ ConfigPipXtremeWidget::ConfigPipXtremeWidget(QWidget *parent) : ConfigTaskWidget
qDebug() << "Error: Object is unknown (PipXStatus)."; qDebug() << "Error: Object is unknown (PipXStatus).";
} }
// Connect to the PipXSettings object updates
pipxSettingsObj = dynamic_cast<UAVDataObject*>(objManager->getObject("PipXSettings"));
if (pipxSettingsObj != NULL ) {
connect(pipxSettingsObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateSettings(UAVObject*)));
} else {
qDebug() << "Error: Object is unknown (PipXSettings).";
}
addApplySaveButtons(m_pipx->Apply, m_pipx->Save); addApplySaveButtons(m_pipx->Apply, m_pipx->Save);
connect(m_pipx->Apply, SIGNAL(clicked()), this, SLOT(applySettings())); //connect(m_pipx->Apply, SIGNAL(clicked()), this, SLOT(applySettings()));
connect(m_pipx->Save, SIGNAL(clicked()), this, SLOT(saveSettings())); //connect(m_pipx->Save, SIGNAL(clicked()), this, SLOT(saveSettings()));
addUAVObjectToWidgetRelation("PipXSettings", "TelemetryConfig", m_pipx->TelemPortConfig);
addUAVObjectToWidgetRelation("PipXSettings", "TelemetrySpeed", m_pipx->TelemPortSpeed);
addUAVObjectToWidgetRelation("PipXSettings", "FlexiConfig", m_pipx->FlexiPortConfig);
addUAVObjectToWidgetRelation("PipXSettings", "FlexiSpeed", m_pipx->FlexiPortSpeed);
addUAVObjectToWidgetRelation("PipXSettings", "VCPConfig", m_pipx->VCPConfig);
addUAVObjectToWidgetRelation("PipXSettings", "VCPSpeed", m_pipx->VCPSpeed);
addUAVObjectToWidgetRelation("PipXSettings", "RFSpeed", m_pipx->MaxRFDatarate);
addUAVObjectToWidgetRelation("PipXSettings", "MaxRFPower", m_pipx->MaxRFTxPower);
addUAVObjectToWidgetRelation("PipXSettings", "SendTimeout", m_pipx->SendTimeout);
addUAVObjectToWidgetRelation("PipXSettings", "MinPacketSize", m_pipx->MinPacketSize);
addUAVObjectToWidgetRelation("PipXSettings", "FrequencyCalibration", m_pipx->FrequencyCalibration);
addUAVObjectToWidgetRelation("PipXSettings", "Frequency", m_pipx->Frequency);
addUAVObjectToWidgetRelation("PipXStatus", "MinFrequency", m_pipx->MinFrequency);
addUAVObjectToWidgetRelation("PipXStatus", "MaxFrequency", m_pipx->MaxFrequency);
addUAVObjectToWidgetRelation("PipXStatus", "FrequencyStepSize", m_pipx->FrequencyStepSize);
addUAVObjectToWidgetRelation("PipXStatus", "AFC", m_pipx->RxAFC);
addUAVObjectToWidgetRelation("PipXStatus", "Retries", m_pipx->Retries);
addUAVObjectToWidgetRelation("PipXStatus", "Errors", m_pipx->Errors);
addUAVObjectToWidgetRelation("PipXStatus", "UAVTalkErrors", m_pipx->UAVTalkErrors);
addUAVObjectToWidgetRelation("PipXStatus", "Resets", m_pipx->Resets);
addUAVObjectToWidgetRelation("PipXStatus", "RXRate", m_pipx->RXRate);
addUAVObjectToWidgetRelation("PipXStatus", "TXRate", m_pipx->TXRate);
// Request and update of the setting object.
settingsUpdated = false;
pipxSettingsObj->requestUpdate();
} }
ConfigPipXtremeWidget::~ConfigPipXtremeWidget() ConfigPipXtremeWidget::~ConfigPipXtremeWidget()
@ -81,7 +117,7 @@ void ConfigPipXtremeWidget::applySettings()
void ConfigPipXtremeWidget::saveSettings() void ConfigPipXtremeWidget::saveSettings()
{ {
applySettings(); //applySettings();
UAVObject *obj = PipXSettings::GetInstance(getObjectManager()); UAVObject *obj = PipXSettings::GetInstance(getObjectManager());
saveObjectToSD(obj); saveObjectToSD(obj);
} }
@ -91,9 +127,9 @@ void ConfigPipXtremeWidget::saveSettings()
*/ */
void ConfigPipXtremeWidget::updateStatus(UAVObject *object) { void ConfigPipXtremeWidget::updateStatus(UAVObject *object) {
// Get the settings object. // Request and update of the setting object if we haven't received it yet.
PipXSettings *pipxSettings = PipXSettings::GetInstance(getObjectManager()); if (!settingsUpdated)
PipXSettings::DataFields pipxSettingsData = pipxSettings->getData(); pipxSettingsObj->requestUpdate();
// Update the detected devices. // Update the detected devices.
UAVObjectField* pairIdField = object->getField("PairIDs"); UAVObjectField* pairIdField = object->getField("PairIDs");
@ -101,22 +137,22 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object) {
quint32 pairid1 = pairIdField->getValue(0).toUInt(); quint32 pairid1 = pairIdField->getValue(0).toUInt();
m_pipx->PairID1->setText(QString::number(pairid1, 16).toUpper()); m_pipx->PairID1->setText(QString::number(pairid1, 16).toUpper());
m_pipx->PairID1->setEnabled(false); m_pipx->PairID1->setEnabled(false);
m_pipx->PairSelect1->setChecked(pipxSettingsData.PairID == pairid1); m_pipx->PairSelect1->setChecked(pairID == pairid1);
m_pipx->PairSelect1->setEnabled(pairid1); m_pipx->PairSelect1->setEnabled(pairid1);
quint32 pairid2 = pairIdField->getValue(1).toUInt(); quint32 pairid2 = pairIdField->getValue(1).toUInt();
m_pipx->PairID2->setText(QString::number(pairIdField->getValue(1).toUInt(), 16).toUpper()); m_pipx->PairID2->setText(QString::number(pairIdField->getValue(1).toUInt(), 16).toUpper());
m_pipx->PairID2->setEnabled(false); m_pipx->PairID2->setEnabled(false);
m_pipx->PairSelect2->setChecked(pipxSettingsData.PairID == pairid2); m_pipx->PairSelect2->setChecked(pairID == pairid2);
m_pipx->PairSelect2->setEnabled(pairid2); m_pipx->PairSelect2->setEnabled(pairid2);
quint32 pairid3 = pairIdField->getValue(2).toUInt(); quint32 pairid3 = pairIdField->getValue(2).toUInt();
m_pipx->PairID3->setText(QString::number(pairIdField->getValue(2).toUInt(), 16).toUpper()); m_pipx->PairID3->setText(QString::number(pairIdField->getValue(2).toUInt(), 16).toUpper());
m_pipx->PairID3->setEnabled(false); m_pipx->PairID3->setEnabled(false);
m_pipx->PairSelect3->setChecked(pipxSettingsData.PairID == pairid3); m_pipx->PairSelect3->setChecked(pairID == pairid3);
m_pipx->PairSelect3->setEnabled(pairid3); m_pipx->PairSelect3->setEnabled(pairid3);
quint32 pairid4 = pairIdField->getValue(3).toUInt(); quint32 pairid4 = pairIdField->getValue(3).toUInt();
m_pipx->PairID4->setText(QString::number(pairIdField->getValue(3).toUInt(), 16).toUpper()); m_pipx->PairID4->setText(QString::number(pairIdField->getValue(3).toUInt(), 16).toUpper());
m_pipx->PairID4->setEnabled(false); m_pipx->PairID4->setEnabled(false);
m_pipx->PairSelect4->setChecked(pipxSettingsData.PairID == pairid4); m_pipx->PairSelect4->setChecked(pairID == pairid4);
m_pipx->PairSelect4->setEnabled(pairid4); m_pipx->PairSelect4->setEnabled(pairid4);
} else { } else {
qDebug() << "PipXtremeGadgetWidget: Count not read PairID field."; qDebug() << "PipXtremeGadgetWidget: Count not read PairID field.";
@ -187,32 +223,20 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object) {
} else { } else {
qDebug() << "PipXtremeGadgetWidget: Count not read link state field."; qDebug() << "PipXtremeGadgetWidget: Count not read link state field.";
} }
// Update the Retries field
UAVObjectField* retriesField = object->getField("Retries");
if (retriesField) {
m_pipx->Retries->setText(QString::number(retriesField->getValue().toUInt()));
} else {
qDebug() << "PipXtremeGadgetWidget: Count not read Retries field.";
} }
// Update the Errors field /*!
UAVObjectField* errorsField = object->getField("Errors"); \brief Called by updates to @PipXSettings
if (errorsField) { */
m_pipx->Errors->setText(QString::number(errorsField->getValue().toUInt())); void ConfigPipXtremeWidget::updateSettings(UAVObject *object) {
} else { settingsUpdated = true;
qDebug() << "PipXtremeGadgetWidget: Count not read Errors field."; enableControls(true);
}
// Update the Resets field // Get the settings object.
UAVObjectField* resetsField = object->getField("Resets"); PipXSettings *pipxSettings = PipXSettings::GetInstance(getObjectManager());
if (resetsField) { PipXSettings::DataFields pipxSettingsData = pipxSettings->getData();
m_pipx->Retries->setText(QString::number(resetsField->getValue().toUInt())); pairID = pipxSettingsData.PairID;
} else {
qDebug() << "PipXtremeGadgetWidget: Count not read Resets field.";
} }
}
/** /**
@} @}

View File

@ -40,6 +40,7 @@ public:
public slots: public slots:
void updateStatus(UAVObject *object1); void updateStatus(UAVObject *object1);
void updateSettings(UAVObject *object1);
private: private:
Ui_PipXtremeWidget *m_pipx; Ui_PipXtremeWidget *m_pipx;
@ -47,6 +48,12 @@ private:
// The PipXtreme status UAVObject // The PipXtreme status UAVObject
UAVDataObject* pipxStatusObj; UAVDataObject* pipxStatusObj;
// The PipXtreme ssettins UAVObject
UAVDataObject* pipxSettingsObj;
bool settingsUpdated;
quint32 pairID;
private slots: private slots:
void refreshValues(); void refreshValues();
void applySettings(); void applySettings();

759
ground/openpilotgcs/src/plugins/config/pipxtreme.ui Normal file → Executable file
View File

@ -270,16 +270,6 @@
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Frequency Band</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Min Frequency</string> <string>Min Frequency</string>
@ -289,7 +279,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="4" column="1">
<widget class="QLineEdit" name="MinFrequency"> <widget class="QLineEdit" name="MinFrequency">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -330,7 +320,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Max Frequency</string> <string>Max Frequency</string>
@ -340,7 +330,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="5" column="1">
<widget class="QLineEdit" name="MaxFrequency"> <widget class="QLineEdit" name="MaxFrequency">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -381,7 +371,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_12">
<property name="text"> <property name="text">
<string>Frequency Step Size</string> <string>Frequency Step Size</string>
@ -391,7 +381,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="6" column="1">
<widget class="QLineEdit" name="FrequencyStepSize"> <widget class="QLineEdit" name="FrequencyStepSize">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -432,7 +422,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Link State</string> <string>Link State</string>
@ -442,7 +432,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="7" column="1">
<widget class="QLineEdit" name="LinkState"> <widget class="QLineEdit" name="LinkState">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -483,7 +473,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="label_17">
<property name="text"> <property name="text">
<string>Rx AFC</string> <string>Rx AFC</string>
@ -493,7 +483,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="8" column="1">
<widget class="QLineEdit" name="RxAFC"> <widget class="QLineEdit" name="RxAFC">
<property name="font"> <property name="font">
<font> <font>
@ -516,7 +506,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>Retries</string> <string>Retries</string>
@ -526,7 +516,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1"> <item row="9" column="1">
<widget class="QLineEdit" name="Retries"> <widget class="QLineEdit" name="Retries">
<property name="font"> <property name="font">
<font> <font>
@ -552,48 +542,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="10" column="1">
<widget class="QLineEdit" name="FrequencyBand">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>The modems frequency band</string>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="Errors"> <widget class="QLineEdit" name="Errors">
<property name="font"> <property name="font">
<font> <font>
@ -619,7 +568,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0"> <item row="10" column="0">
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="label_19">
<property name="text"> <property name="text">
<string>Errors</string> <string>Errors</string>
@ -629,6 +578,150 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0">
<widget class="QLabel" name="UAVTalkErrorsLabel">
<property name="text">
<string>UAVTalk Errors</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="UAVTalkErrors">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="ResetsLabel">
<property name="text">
<string>Resets</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="Resets">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="TXRateLabel">
<property name="text">
<string>TX Rate (B/s)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLineEdit" name="TXRate">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="RXRateLabel">
<property name="text">
<string>RX Rate (B/s)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLineEdit" name="RXRate">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLineEdit" name="DeviceID"> <widget class="QLineEdit" name="DeviceID">
<property name="font"> <property name="font">
@ -683,10 +776,235 @@
<string>Configuration</string> <string>Configuration</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="9" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="TelemPortConfigLabel">
<property name="text"> <property name="text">
<string>Frequency (MHz)</string> <string>Telemetry Port Configuration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="TelemPortConfig">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the telemetry port configuration</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="TelemPortSpeedLabel">
<property name="text">
<string>Telemetry Port Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="TelemPortSpeed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the telemetry port speed</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="FlexiPortConfigLabel">
<property name="text">
<string>Flexi Port Configuration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="FlexiPortConfig">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the flexi port configuration</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="FlexiPortSpeedConfig">
<property name="text">
<string>Flexi Port Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="FlexiPortSpeed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the flexi port speed</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="VCPConfigLabel">
<property name="text">
<string>VCP Configuration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="VCPConfig">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the virtual serial port configuration</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="VCPSpeedLabel">
<property name="text">
<string>VCP Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="VCPSpeed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the virtual serial port speed</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="MaxRFDatarateLabel">
<property name="text">
<string>Max RF Datarate (bits/s)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="MaxRFDatarate">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the maximum RF datarate/channel bandwidth the modem will use</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="MaxRFTxPowerLabel">
<property name="text">
<string>Max RF Tx Power(mW)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="MaxRFTxPower">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the maximum TX output power the modem will use</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="SendTimeoutLabel">
<property name="text">
<string>Send Timeout (ms)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="SendTimeout">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Calibrate the modems RF carrier frequency</string>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="MinPacketSizeLabel">
<property name="text">
<string>Min Packet Size</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -694,7 +1012,77 @@
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="9" column="1">
<widget class="QDoubleSpinBox" name="Frequency"> <widget class="QSpinBox" name="MinPacketSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Calibrate the modems RF carrier frequency</string>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="FreqCalLabel">
<property name="text">
<string>Frequency Calibration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QSpinBox" name="FrequencyCalibration">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Calibrate the modems RF carrier frequency</string>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Frequency (Hz)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QSpinBox" name="Frequency">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -716,148 +1104,14 @@
<property name="accelerated"> <property name="accelerated">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="decimals">
<number>8</number>
</property>
<property name="minimum"> <property name="minimum">
<double>0.000000000000000</double> <double>0</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>1000.000000000000000</double> <double>1000000000</double>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000001000000000</double> <double>100000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="SerialPortSpeed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the modems serial port speed</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Serial Port Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="MaxRFDatarate">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the maximum RF datarate/channel bandwidth the modem will use</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Max RF Datarate (bits/s)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="MaxRFTxPower">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the maximum TX output power the modem will use</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Max RF Tx Power(mW)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Send Timeout (ms)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Flexi Port Configuration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="FlexiPortSpeed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the modems serial port speed</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="FlexiPortConfig">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set the modems serial port speed</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Flexi Port Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -953,101 +1207,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1">
<widget class="QSpinBox" name="SendTimeout">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Calibrate the modems RF carrier frequency</string>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Min Packet Size</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="MinPacketSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Calibrate the modems RF carrier frequency</string>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="FrequencyCalibration">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Calibrate the modems RF carrier frequency</string>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Frequency Calibration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -150,7 +150,7 @@ void UAVObjectUtilManager::objectPersistenceTransactionCompleted(UAVObject* obj,
// the queue: // the queue:
saveState = AWAITING_COMPLETED; saveState = AWAITING_COMPLETED;
disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool)));
failureTimer.start(1000); // Create a timeout failureTimer.start(2000); // Create a timeout
} else { } else {
// Can be caused by timeout errors on sending. Forget it and send next. // Can be caused by timeout errors on sending. Forget it and send next.
qDebug() << "objectPersistenceTranscationCompleted (error)"; qDebug() << "objectPersistenceTranscationCompleted (error)";

View File

@ -26,12 +26,13 @@
*/ */
#include "configtaskwidget.h" #include "configtaskwidget.h"
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QLineEdit>
#include "uavsettingsimportexport/uavsettingsimportexportfactory.h" #include "uavsettingsimportexport/uavsettingsimportexportfactory.h"
/** /**
* Constructor * Constructor
*/ */
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL) ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);")
{ {
pm = ExtensionSystem::PluginManager::instance(); pm = ExtensionSystem::PluginManager::instance();
objManager = pm->getObject<UAVObjectManager>(); objManager = pm->getObject<UAVObjectManager>();
@ -126,7 +127,7 @@ void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString fiel
Q_ASSERT(obj); Q_ASSERT(obj);
objectUpdates.insert(obj,true); objectUpdates.insert(obj,true);
connect(obj, SIGNAL(objectUpdated(UAVObject*)),this, SLOT(objectUpdated(UAVObject*))); connect(obj, SIGNAL(objectUpdated(UAVObject*)),this, SLOT(objectUpdated(UAVObject*)));
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues(UAVObject*)));
} }
if(!field.isEmpty() && obj) if(!field.isEmpty() && obj)
_field = obj->getField(QString(field)); _field = obj->getField(QString(field));
@ -175,10 +176,6 @@ ConfigTaskWidget::~ConfigTaskWidget()
if(oTw) if(oTw)
delete oTw; delete oTw;
} }
if(timeOut)
{
delete timeOut;
}
} }
void ConfigTaskWidget::saveObjectToSD(UAVObject *obj) void ConfigTaskWidget::saveObjectToSD(UAVObject *obj)
@ -255,7 +252,7 @@ void ConfigTaskWidget::populateWidgets()
* object field added to the framework pool * object field added to the framework pool
* Overwrite this if you need to change the default behavior * Overwrite this if you need to change the default behavior
*/ */
void ConfigTaskWidget::refreshWidgetsValues() void ConfigTaskWidget::refreshWidgetsValues(UAVObject * obj)
{ {
bool dirtyBack=dirty; bool dirtyBack=dirty;
emit refreshWidgetsValuesRequested(); emit refreshWidgetsValuesRequested();
@ -267,8 +264,8 @@ void ConfigTaskWidget::refreshWidgetsValues()
} }
else else
{ {
if(ow->object==obj || obj==NULL)
setWidgetFromField(ow->widget,ow->field,ow->index,ow->scale,ow->isLimited); setWidgetFromField(ow->widget,ow->field,ow->index,ow->scale,ow->isLimited);
} }
} }
@ -465,7 +462,7 @@ void ConfigTaskWidget::enableObjUpdates()
foreach(objectToWidget * obj,objOfInterest) foreach(objectToWidget * obj,objOfInterest)
{ {
if(obj->object) if(obj->object)
connect(obj->object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); connect(obj->object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues(UAVObject*)));
} }
} }
/** /**
@ -784,7 +781,7 @@ void ConfigTaskWidget::reloadButtonClicked()
if(!list) if(!list)
return; return;
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( getObjectManager()->getObject(ObjectPersistence::NAME) ); ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( getObjectManager()->getObject(ObjectPersistence::NAME) );
timeOut=new QTimer(this); QTimer * timeOut=new QTimer(this);
QEventLoop * eventLoop=new QEventLoop(this); QEventLoop * eventLoop=new QEventLoop(this);
connect(timeOut, SIGNAL(timeout()),eventLoop,SLOT(quit())); connect(timeOut, SIGNAL(timeout()),eventLoop,SLOT(quit()));
connect(objper, SIGNAL(objectUpdated(UAVObject*)), eventLoop, SLOT(quit())); connect(objper, SIGNAL(objectUpdated(UAVObject*)), eventLoop, SLOT(quit()));
@ -803,22 +800,13 @@ void ConfigTaskWidget::reloadButtonClicked()
eventLoop->exec(); eventLoop->exec();
if(timeOut->isActive()) if(timeOut->isActive())
{ {
oTw->object->requestUpdate();
setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited); setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited);
} }
timeOut->stop(); timeOut->stop();
} }
} }
if(eventLoop)
{
delete eventLoop; delete eventLoop;
eventLoop=NULL;
}
if(timeOut)
{
delete timeOut; delete timeOut;
timeOut=NULL;
}
} }
/** /**
@ -1004,6 +992,14 @@ bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, dou
cb->setChecked(bvalue); cb->setChecked(bvalue);
return true; return true;
} }
else if(QLineEdit * cb=qobject_cast<QLineEdit *>(widget))
{
if(scale==0)
cb->setText(value.toString());
else
cb->setText(QString::number((value.toDouble()/scale)));
return true;
}
else else
return false; return false;
} }

View File

@ -164,14 +164,13 @@ private:
void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function); void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function);
void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale); void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale);
QString outOfLimitsStyle; QString outOfLimitsStyle;
QTimer * timeOut;
protected slots: protected slots:
virtual void disableObjUpdates(); virtual void disableObjUpdates();
virtual void enableObjUpdates(); virtual void enableObjUpdates();
virtual void clearDirty(); virtual void clearDirty();
virtual void widgetsContentsChanged(); virtual void widgetsContentsChanged();
virtual void populateWidgets(); virtual void populateWidgets();
virtual void refreshWidgetsValues(); virtual void refreshWidgetsValues(UAVObject * obj=NULL);
virtual void updateObjectsFromWidgets(); virtual void updateObjectsFromWidgets();
virtual void helpButtonPressed(); virtual void helpButtonPressed();
protected: protected:

View File

@ -87,7 +87,7 @@ void smartSaveButton::processOperation(QPushButton * button,bool save)
connect(obj,SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(transaction_finished(UAVObject*, bool))); connect(obj,SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(transaction_finished(UAVObject*, bool)));
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit())); connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
obj->updated(); obj->updated();
timer.start(1000); timer.start(2000);
//qDebug()<<"begin loop"; //qDebug()<<"begin loop";
loop.exec(); loop.exec();
//qDebug()<<"end loop"; //qDebug()<<"end loop";
@ -113,7 +113,7 @@ void smartSaveButton::processOperation(QPushButton * button,bool save)
connect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool))); connect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool)));
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit())); connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
utilMngr->saveObjectToSD(obj); utilMngr->saveObjectToSD(obj);
timer.start(1000); timer.start(2000);
loop.exec(); loop.exec();
timer.stop(); timer.stop();
disconnect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool))); disconnect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool)));

4
ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp Normal file → Executable file
View File

@ -27,6 +27,8 @@
#include "telemetry.h" #include "telemetry.h"
#include "qxtlogger.h" #include "qxtlogger.h"
#include "pipxsettings.h"
#include "objectpersistence.h"
#include <QTime> #include <QTime>
#include <QtGlobal> #include <QtGlobal>
#include <stdlib.h> #include <stdlib.h>
@ -393,7 +395,7 @@ void Telemetry::processObjectQueue()
if ( gcsStats.Status != GCSTelemetryStats::STATUS_CONNECTED ) if ( gcsStats.Status != GCSTelemetryStats::STATUS_CONNECTED )
{ {
objQueue.clear(); objQueue.clear();
if ( objInfo.obj->getObjID() != GCSTelemetryStats::OBJID ) if ( objInfo.obj->getObjID() != GCSTelemetryStats::OBJID && objInfo.obj->getObjID() != PipXSettings::OBJID && objInfo.obj->getObjID() != ObjectPersistence::OBJID )
{ {
objInfo.obj->emitTransactionCompleted(false); objInfo.obj->emitTransactionCompleted(false);
return; return;

View File

@ -2,14 +2,14 @@
<object name="PipXSettings" singleinstance="true" settings="true"> <object name="PipXSettings" singleinstance="true" settings="true">
<description>PipXtreme configurations options.</description> <description>PipXtreme configurations options.</description>
<field name="PairID" units="" type="uint32" elements="1" defaultvalue="0"/> <field name="PairID" units="" type="uint32" elements="1" defaultvalue="0"/>
<field name="TelemetryConfig" units="function" type="enum" elements="1" options="Disabled,Serial,UAVTalk,RSSI" defaultvalue="UAVTalk"/> <field name="TelemetryConfig" units="function" type="enum" elements="1" options="Disabled,Serial,UAVTalk,PPM_In,PPM_Out,RSSI,Debug" defaultvalue="UAVTalk"/>
<field name="TelemetrySpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/> <field name="TelemetrySpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>
<field name="FlexiConfig" units="function" type="enum" elements="1" options="Disabled,Serial,UAVTalk,PPM,RSSI" defaultvalue="Disabled"/> <field name="FlexiConfig" units="function" type="enum" elements="1" options="Disabled,Serial,UAVTalk,PPM_In,PPM_Out,RSSI,Debug" defaultvalue="Disabled"/>
<field name="FlexiSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/> <field name="FlexiSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>
<field name="VCPConfig" units="function" type="enum" elements="1" options="Disabled,Serial,UAVTalk" defaultvalue="Disabled"/> <field name="VCPConfig" units="function" type="enum" elements="1" options="Disabled,Serial,UAVTalk" defaultvalue="Disabled"/>
<field name="VCPSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/> <field name="VCPSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>
<field name="RFSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="115200"/> <field name="RFSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="115200"/>
<field name="MaxRFPower" units="mW" type="enum" elements="1" options="1.25,1.6,3.16,6.3,12.6,25,50,100" defaultvalue="1.25"/> <field name="MaxRFPower" units="mW" type="enum" elements="1" options="1.25,1.6,3.16,6.3,12.6,25,50,100" defaultvalue="100"/>
<field name="SendTimeout" units="ms" type="uint16" elements="1" defaultvalue="50"/> <field name="SendTimeout" units="ms" type="uint16" elements="1" defaultvalue="50"/>
<field name="MinPacketSize" units="bytes" type="uint8" elements="1" defaultvalue="50"/> <field name="MinPacketSize" units="bytes" type="uint8" elements="1" defaultvalue="50"/>
<field name="FrequencyCalibration" units="" type="uint8" elements="1" defaultvalue="127"/> <field name="FrequencyCalibration" units="" type="uint8" elements="1" defaultvalue="127"/>

View File

@ -13,7 +13,10 @@
<field name="AFC" units="" type="int32" elements="1" defaultvalue="0"/> <field name="AFC" units="" type="int32" elements="1" defaultvalue="0"/>
<field name="Retries" units="" type="uint16" elements="1" defaultvalue="0"/> <field name="Retries" units="" type="uint16" elements="1" defaultvalue="0"/>
<field name="Errors" units="" type="uint16" elements="1" defaultvalue="0"/> <field name="Errors" units="" type="uint16" elements="1" defaultvalue="0"/>
<field name="UAVTalkErrors" units="" type="uint16" elements="1" defaultvalue="0"/>
<field name="Resets" units="" type="uint16" elements="1" defaultvalue="0"/> <field name="Resets" units="" type="uint16" elements="1" defaultvalue="0"/>
<field name="TXRate" units="Bps" type="uint16" elements="1" defaultvalue="0"/>
<field name="RXRate" units="Bps" type="uint16" elements="1" defaultvalue="0"/>
<field name="RSSI" units="dBm" type="int8" elements="1" defaultvalue="0"/> <field name="RSSI" units="dBm" type="int8" elements="1" defaultvalue="0"/>
<field name="LinkState" units="function" type="enum" elements="1" options="Disconnected,Connecting,Connected" defaultvalue="Disconnected"/> <field name="LinkState" units="function" type="enum" elements="1" options="Disconnected,Connecting,Connected" defaultvalue="Disconnected"/>
<field name="PairIDs" units="" type="uint32" elements="4" defaultvalue="0"/> <field name="PairIDs" units="" type="uint32" elements="4" defaultvalue="0"/>