diff --git a/flight/Modules/RadioComBridge/RadioComBridge.c b/flight/Modules/RadioComBridge/RadioComBridge.c index 05dd08c52..38331c8f5 100644 --- a/flight/Modules/RadioComBridge/RadioComBridge.c +++ b/flight/Modules/RadioComBridge/RadioComBridge.c @@ -100,6 +100,10 @@ typedef struct { uint32_t radioTxErrors; uint32_t radioTxRetries; uint32_t radioRxErrors; + uint32_t UAVTalkErrors; + uint32_t packetErrors; + uint16_t txBytes; + uint16_t rxBytes; // The destination ID uint32_t destination_id; @@ -214,6 +218,8 @@ static int32_t RadioComBridgeInitialize(void) data->comTxErrors = 0; data->comTxRetries = 0; data->comRxErrors = 0; + data->UAVTalkErrors = 0; + data->packetErrors = 0; // Register the callbacks with the packet handler PHRegisterOutputStream(pios_packet_handler, transmitPacket); @@ -236,6 +242,7 @@ static int32_t RadioComBridgeInitialize(void) // Configure our UAVObjects for updates. 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("ObjectPersistence"), data->objEventQueue, EV_UPDATED | EV_UPDATED_MANUAL); return 0; } @@ -270,6 +277,7 @@ static void comUAVTalkTask(void *parameters) uint8_t rx_byte; if(!BufferedRead(f, &rx_byte, MAX_PORT_DELAY)) continue; + data->txBytes++; // Get a TX packet from the packet handler if required. if (p == NULL) @@ -307,61 +315,76 @@ static void comUAVTalkTask(void *parameters) UAVTalkRxState state = UAVTalkProcessInputStreamQuiet(data->inUAVTalkCon, rx_byte); UAVTalkConnectionData *connection = (UAVTalkConnectionData*)(data->inUAVTalkCon); UAVTalkInputProcessor *iproc = &(connection->iproc); + if (state == UAVTALK_STATE_COMPLETE) { // Is this a local UAVObject? if (iproc->obj != NULL) { - // We treat the ObjectPersistance object differently + // We treat the ObjectPersistence object differently if(iproc->objId == OBJECTPERSISTENCE_OBJID) { // Unpack object, if the instance does not exist it will be created! UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer); - // Get the ObjectPersistance object. + // Get the ObjectPersistence object. ObjectPersistenceData obj_per; ObjectPersistenceGet(&obj_per); // Is this concerning or setting object? if (obj_per.ObjectID == PIPXSETTINGS_OBJID) { + // Queue up the ACK. UAVObjEvent ev; ev.obj = iproc->obj; - ev.instId = 0; + ev.instId = iproc->instId; ev.event = EV_SEND_ACK; + xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); // Is this a save, load, or delete? + bool success = true; switch (obj_per.Operation) { 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. PipXSettingsData pipxSettings; PipXSettingsGet(&pipxSettings); - if (PIOS_EEPROM_Save((uint8_t*)&pipxSettings, sizeof(PipXSettingsData)) != 0) - ev.event = EV_SEND_NACK; + int32_t ret = PIOS_EEPROM_Save((uint8_t*)&pipxSettings, sizeof(PipXSettingsData)); + if (ret != 0) + success = false; +#endif break; } -#endif - case OBJECTPERSISTENCE_OPERATION_DELETE: - DEBUG_PRINTF(2, "Delete\n\r"); - break; default: - DEBUG_PRINTF(2, "Other\n\r"); break; } + if (success == true) + { + obj_per.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED; + ObjectPersistenceSet(&obj_per); + } - // Queue up the ACK/NACK - xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); + // Release the packet, since we don't need it. + PHReleaseTXPacket(pios_packet_handler, p); } - else { + else + { // Otherwise, queue the packet for transmission. xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); - p = NULL; } } else @@ -381,36 +404,48 @@ static void comUAVTalkTask(void *parameters) xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); break; case UAVTALK_TYPE_OBJ_ACK: - // Queue up an ACK - ev.event = EV_SEND_ACK; - UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer); + if (UAVObjUnpack(iproc->obj, iproc->instId, connection->rxBuffer) == 0) + { + // Queue up an ACK + ev.event = EV_SEND_ACK; + xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); + } break; } + + // Release the packet, since we don't need it. + PHReleaseTXPacket(pios_packet_handler, p); } } else { // Queue the packet for transmission. xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); - p = NULL; } + p = NULL; } else if(state == UAVTALK_STATE_ERROR) { DEBUG_PRINTF(1, "UAVTalk FAILED!\n\r"); - - // Release the packet and start over again. - PHReleaseTXPacket(pios_packet_handler, p); - p = NULL; + data->UAVTalkErrors++; // Send a NACK if required. - if((iproc->obj) && (iproc->type == UAVTALK_TYPE_ACK)) + if((iproc->obj) && (iproc->type == UAVTALK_TYPE_OBJ_ACK)) { + // Queue up a NACK UAVObjEvent ev; ev.obj = iproc->obj; - // Queue up a NACK ev.event = EV_SEND_NACK; xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); + + // Release the packet and start over again. + PHReleaseTXPacket(pios_packet_handler, p); } + 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); if(rx_bytes == 0) continue; + data->rxBytes += rx_bytes; // Verify that the packet is valid and pass it on. if(PHVerifyPacket(pios_packet_handler, p, rx_bytes) > 0) { @@ -453,7 +489,10 @@ static void radioReceiveTask(void *parameters) ev.event = EV_PACKET_RECEIVED; xQueueSend(data->objEventQueue, &ev, portMAX_DELAY); } else + { + data->packetErrors++; PHReceivePacket(pios_packet_handler, p, false); + } p = NULL; } } @@ -632,6 +671,12 @@ static void radioStatusTask(void *parameters) pipxStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id); pipxStatus.RSSI = PIOS_RFM22B_RSSI(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 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) outputPort = PIOS_COM_TELEM_USB; #endif /* PIOS_INCLUDE_USB */ - return PIOS_COM_SendBufferNonBlocking(outputPort, buf, length); + return PIOS_COM_SendBuffer(outputPort, buf, length); } /** diff --git a/flight/PiOS/STM32F10x/pios_eeprom.c b/flight/PiOS/STM32F10x/pios_eeprom.c index ef2b24e7e..f604f417b 100644 --- a/flight/PiOS/STM32F10x/pios_eeprom.c +++ b/flight/PiOS/STM32F10x/pios_eeprom.c @@ -73,7 +73,7 @@ int32_t PIOS_EEPROM_Save(uint8_t *data, uint32_t len) // See if we have to write the data. 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; // TODO: Check that the area isn't already erased diff --git a/flight/PipXtreme/System/pios_board.c b/flight/PipXtreme/System/pios_board.c index da9954f26..f7294a178 100755 --- a/flight/PipXtreme/System/pios_board.c +++ b/flight/PipXtreme/System/pios_board.c @@ -180,7 +180,13 @@ void PIOS_Board_Init(void) { #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; 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)) { PIOS_Assert(0); } + break; + } + case PIPXSETTINGS_TELEMETRYCONFIG_PPM_IN: + case PIPXSETTINGS_TELEMETRYCONFIG_PPM_OUT: + case PIPXSETTINGS_TELEMETRYCONFIG_RSSI: + break; } /* Configure USART3 */ + switch (pipxSettings.FlexiConfig) + { + case PIPXSETTINGS_FLEXICONFIG_SERIAL: + case PIPXSETTINGS_FLEXICONFIG_UAVTALK: + case PIPXSETTINGS_FLEXICONFIG_DEBUG: { uint32_t pios_usart3_id; 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)) { 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) diff --git a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp index 57cf28fd8..5aab6488c 100755 --- a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.cpp @@ -45,9 +45,45 @@ ConfigPipXtremeWidget::ConfigPipXtremeWidget(QWidget *parent) : ConfigTaskWidget qDebug() << "Error: Object is unknown (PipXStatus)."; } + // Connect to the PipXSettings object updates + pipxSettingsObj = dynamic_cast(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); - connect(m_pipx->Apply, SIGNAL(clicked()), this, SLOT(applySettings())); - connect(m_pipx->Save, SIGNAL(clicked()), this, SLOT(saveSettings())); + //connect(m_pipx->Apply, SIGNAL(clicked()), this, SLOT(applySettings())); + //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() @@ -81,7 +117,7 @@ void ConfigPipXtremeWidget::applySettings() void ConfigPipXtremeWidget::saveSettings() { - applySettings(); + //applySettings(); UAVObject *obj = PipXSettings::GetInstance(getObjectManager()); saveObjectToSD(obj); } @@ -91,9 +127,9 @@ void ConfigPipXtremeWidget::saveSettings() */ void ConfigPipXtremeWidget::updateStatus(UAVObject *object) { - // Get the settings object. - PipXSettings *pipxSettings = PipXSettings::GetInstance(getObjectManager()); - PipXSettings::DataFields pipxSettingsData = pipxSettings->getData(); + // Request and update of the setting object if we haven't received it yet. + if (!settingsUpdated) + pipxSettingsObj->requestUpdate(); // Update the detected devices. UAVObjectField* pairIdField = object->getField("PairIDs"); @@ -101,22 +137,22 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object) { quint32 pairid1 = pairIdField->getValue(0).toUInt(); m_pipx->PairID1->setText(QString::number(pairid1, 16).toUpper()); m_pipx->PairID1->setEnabled(false); - m_pipx->PairSelect1->setChecked(pipxSettingsData.PairID == pairid1); + m_pipx->PairSelect1->setChecked(pairID == pairid1); m_pipx->PairSelect1->setEnabled(pairid1); quint32 pairid2 = pairIdField->getValue(1).toUInt(); m_pipx->PairID2->setText(QString::number(pairIdField->getValue(1).toUInt(), 16).toUpper()); m_pipx->PairID2->setEnabled(false); - m_pipx->PairSelect2->setChecked(pipxSettingsData.PairID == pairid2); + m_pipx->PairSelect2->setChecked(pairID == pairid2); m_pipx->PairSelect2->setEnabled(pairid2); quint32 pairid3 = pairIdField->getValue(2).toUInt(); m_pipx->PairID3->setText(QString::number(pairIdField->getValue(2).toUInt(), 16).toUpper()); m_pipx->PairID3->setEnabled(false); - m_pipx->PairSelect3->setChecked(pipxSettingsData.PairID == pairid3); + m_pipx->PairSelect3->setChecked(pairID == pairid3); m_pipx->PairSelect3->setEnabled(pairid3); quint32 pairid4 = pairIdField->getValue(3).toUInt(); m_pipx->PairID4->setText(QString::number(pairIdField->getValue(3).toUInt(), 16).toUpper()); m_pipx->PairID4->setEnabled(false); - m_pipx->PairSelect4->setChecked(pipxSettingsData.PairID == pairid4); + m_pipx->PairSelect4->setChecked(pairID == pairid4); m_pipx->PairSelect4->setEnabled(pairid4); } else { qDebug() << "PipXtremeGadgetWidget: Count not read PairID field."; @@ -187,32 +223,20 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object) { } else { 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"); - if (errorsField) { - m_pipx->Errors->setText(QString::number(errorsField->getValue().toUInt())); - } else { - qDebug() << "PipXtremeGadgetWidget: Count not read Errors field."; - } - - // Update the Resets field - UAVObjectField* resetsField = object->getField("Resets"); - if (resetsField) { - m_pipx->Retries->setText(QString::number(resetsField->getValue().toUInt())); - } else { - qDebug() << "PipXtremeGadgetWidget: Count not read Resets field."; - } } +/*! + \brief Called by updates to @PipXSettings + */ +void ConfigPipXtremeWidget::updateSettings(UAVObject *object) { + settingsUpdated = true; + enableControls(true); + + // Get the settings object. + PipXSettings *pipxSettings = PipXSettings::GetInstance(getObjectManager()); + PipXSettings::DataFields pipxSettingsData = pipxSettings->getData(); + pairID = pipxSettingsData.PairID; +} /** @} diff --git a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h old mode 100644 new mode 100755 index 4d8b2e62f..9ab35b4ae --- a/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configpipxtremewidget.h @@ -40,6 +40,7 @@ public: public slots: void updateStatus(UAVObject *object1); + void updateSettings(UAVObject *object1); private: Ui_PipXtremeWidget *m_pipx; @@ -47,6 +48,12 @@ private: // The PipXtreme status UAVObject UAVDataObject* pipxStatusObj; + // The PipXtreme ssettins UAVObject + UAVDataObject* pipxSettingsObj; + + bool settingsUpdated; + quint32 pairID; + private slots: void refreshValues(); void applySettings(); diff --git a/ground/openpilotgcs/src/plugins/config/pipxtreme.ui b/ground/openpilotgcs/src/plugins/config/pipxtreme.ui old mode 100644 new mode 100755 index 0efb01340..06662e450 --- a/ground/openpilotgcs/src/plugins/config/pipxtreme.ui +++ b/ground/openpilotgcs/src/plugins/config/pipxtreme.ui @@ -270,16 +270,6 @@ - - - Frequency Band - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Min Frequency @@ -289,7 +279,7 @@ - + @@ -330,7 +320,7 @@ - + Max Frequency @@ -340,7 +330,7 @@ - + @@ -381,7 +371,7 @@ - + Frequency Step Size @@ -391,7 +381,7 @@ - + @@ -432,7 +422,7 @@ - + Link State @@ -442,7 +432,7 @@ - + @@ -483,7 +473,7 @@ - + Rx AFC @@ -493,7 +483,7 @@ - + @@ -516,7 +506,7 @@ - + Retries @@ -526,7 +516,7 @@ - + @@ -552,48 +542,7 @@ - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 75 - true - - - - The modems frequency band - - - QLineEdit { - border: none; - border-radius: 1px; - padding: 0 8px; - background: rgba(0, 0, 0, 16); -/* background: transparent; */ -/* selection-background-color: darkgray;*/ -} - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - + @@ -619,7 +568,7 @@ - + Errors @@ -629,6 +578,150 @@ + + + + UAVTalk Errors + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 75 + true + + + + QLineEdit { + border: none; + border-radius: 1px; + padding: 0 8px; + background: rgba(0, 0, 0, 16); +/* background: transparent; */ +/* selection-background-color: darkgray;*/ +} + + + false + + + true + + + + + + + Resets + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 75 + true + + + + QLineEdit { + border: none; + border-radius: 1px; + padding: 0 8px; + background: rgba(0, 0, 0, 16); +/* background: transparent; */ +/* selection-background-color: darkgray;*/ +} + + + false + + + true + + + + + + + TX Rate (B/s) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 75 + true + + + + QLineEdit { + border: none; + border-radius: 1px; + padding: 0 8px; + background: rgba(0, 0, 0, 16); +/* background: transparent; */ +/* selection-background-color: darkgray;*/ +} + + + false + + + true + + + + + + + RX Rate (B/s) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 75 + true + + + + QLineEdit { + border: none; + border-radius: 1px; + padding: 0 8px; + background: rgba(0, 0, 0, 16); +/* background: transparent; */ +/* selection-background-color: darkgray;*/ +} + + + false + + + true + + + @@ -683,10 +776,235 @@ Configuration - - + + - Frequency (MHz) + Telemetry Port Configuration + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the telemetry port configuration + + + + + + + Telemetry Port Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the telemetry port speed + + + + + + + Flexi Port Configuration + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the flexi port configuration + + + + + + + Flexi Port Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the flexi port speed + + + + + + + VCP Configuration + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the virtual serial port configuration + + + + + + + VCP Speed + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the virtual serial port speed + + + + + + + Max RF Datarate (bits/s) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the maximum RF datarate/channel bandwidth the modem will use + + + + + + + Max RF Tx Power(mW) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16777215 + + + + Set the maximum TX output power the modem will use + + + Qt::LeftToRight + + + 0 + + + + + + + Send Timeout (ms) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Calibrate the modems RF carrier frequency + + + true + + + 255 + + + + + + + Min Packet Size Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -694,7 +1012,77 @@ - + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Calibrate the modems RF carrier frequency + + + true + + + 255 + + + + + + + Frequency Calibration + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Calibrate the modems RF carrier frequency + + + true + + + 255 + + + + + + + Frequency (Hz) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + 0 @@ -716,148 +1104,14 @@ true - - 8 - - 0.000000000000000 + 0 - 1000.000000000000000 + 1000000000 - 0.000001000000000 - - - - - - - - 16777215 - 16777215 - - - - Set the modems serial port speed - - - - - - - Serial Port Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Set the maximum RF datarate/channel bandwidth the modem will use - - - - - - - Max RF Datarate (bits/s) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Set the maximum TX output power the modem will use - - - Qt::LeftToRight - - - 0 - - - - - - - Max RF Tx Power(mW) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Send Timeout (ms) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Flexi Port Configuration - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16777215 - - - - Set the modems serial port speed - - - - - - - - 16777215 - 16777215 - - - - Set the modems serial port speed - - - - - - - Flexi Port Speed - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + 100000 @@ -953,101 +1207,6 @@ - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Calibrate the modems RF carrier frequency - - - true - - - 255 - - - - - - - Min Packet Size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Calibrate the modems RF carrier frequency - - - true - - - 255 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Calibrate the modems RF carrier frequency - - - true - - - 255 - - - - - - - Frequency Calibration - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp old mode 100644 new mode 100755 index ac64c61d8..1d1d208a9 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -150,7 +150,7 @@ void UAVObjectUtilManager::objectPersistenceTransactionCompleted(UAVObject* obj, // the queue: saveState = AWAITING_COMPLETED; disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); - failureTimer.start(1000); // Create a timeout + failureTimer.start(2000); // Create a timeout } else { // Can be caused by timeout errors on sending. Forget it and send next. qDebug() << "objectPersistenceTranscationCompleted (error)"; diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp old mode 100644 new mode 100755 index 8bd2fe7b5..a891a59d5 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -26,12 +26,13 @@ */ #include "configtaskwidget.h" #include +#include #include "uavsettingsimportexport/uavsettingsimportexportfactory.h" /** * 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(); objManager = pm->getObject(); @@ -126,7 +127,7 @@ void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString fiel Q_ASSERT(obj); objectUpdates.insert(obj,true); 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) _field = obj->getField(QString(field)); @@ -175,10 +176,6 @@ ConfigTaskWidget::~ConfigTaskWidget() if(oTw) delete oTw; } - if(timeOut) - { - delete timeOut; - } } void ConfigTaskWidget::saveObjectToSD(UAVObject *obj) @@ -255,7 +252,7 @@ void ConfigTaskWidget::populateWidgets() * object field added to the framework pool * Overwrite this if you need to change the default behavior */ -void ConfigTaskWidget::refreshWidgetsValues() +void ConfigTaskWidget::refreshWidgetsValues(UAVObject * obj) { bool dirtyBack=dirty; emit refreshWidgetsValuesRequested(); @@ -267,8 +264,8 @@ void ConfigTaskWidget::refreshWidgetsValues() } else { - setWidgetFromField(ow->widget,ow->field,ow->index,ow->scale,ow->isLimited); - + if(ow->object==obj || obj==NULL) + setWidgetFromField(ow->widget,ow->field,ow->index,ow->scale,ow->isLimited); } } @@ -465,7 +462,7 @@ void ConfigTaskWidget::enableObjUpdates() foreach(objectToWidget * obj,objOfInterest) { 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) return; ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) ); - timeOut=new QTimer(this); + QTimer * timeOut=new QTimer(this); QEventLoop * eventLoop=new QEventLoop(this); connect(timeOut, SIGNAL(timeout()),eventLoop,SLOT(quit())); connect(objper, SIGNAL(objectUpdated(UAVObject*)), eventLoop, SLOT(quit())); @@ -803,22 +800,13 @@ void ConfigTaskWidget::reloadButtonClicked() eventLoop->exec(); if(timeOut->isActive()) { - oTw->object->requestUpdate(); setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited); } timeOut->stop(); } } - if(eventLoop) - { - delete eventLoop; - eventLoop=NULL; - } - if(timeOut) - { - delete timeOut; - timeOut=NULL; - } + delete eventLoop; + delete timeOut; } /** @@ -1004,6 +992,14 @@ bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, dou cb->setChecked(bvalue); return true; } + else if(QLineEdit * cb=qobject_cast(widget)) + { + if(scale==0) + cb->setText(value.toString()); + else + cb->setText(QString::number((value.toDouble()/scale))); + return true; + } else return false; } diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h old mode 100644 new mode 100755 index f835a417d..d833069bd --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h @@ -164,14 +164,13 @@ private: void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function); void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale); QString outOfLimitsStyle; - QTimer * timeOut; protected slots: virtual void disableObjUpdates(); virtual void enableObjUpdates(); virtual void clearDirty(); virtual void widgetsContentsChanged(); virtual void populateWidgets(); - virtual void refreshWidgetsValues(); + virtual void refreshWidgetsValues(UAVObject * obj=NULL); virtual void updateObjectsFromWidgets(); virtual void helpButtonPressed(); protected: diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp old mode 100644 new mode 100755 index 260175a26..b618c8ecc --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp @@ -87,7 +87,7 @@ void smartSaveButton::processOperation(QPushButton * button,bool save) connect(obj,SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(transaction_finished(UAVObject*, bool))); connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit())); obj->updated(); - timer.start(1000); + timer.start(2000); //qDebug()<<"begin loop"; loop.exec(); //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(&timer,SIGNAL(timeout()),&loop,SLOT(quit())); utilMngr->saveObjectToSD(obj); - timer.start(1000); + timer.start(2000); loop.exec(); timer.stop(); disconnect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool))); diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp old mode 100644 new mode 100755 index f01c66c43..c1463013a --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp @@ -27,6 +27,8 @@ #include "telemetry.h" #include "qxtlogger.h" +#include "pipxsettings.h" +#include "objectpersistence.h" #include #include #include @@ -393,7 +395,7 @@ void Telemetry::processObjectQueue() if ( gcsStats.Status != GCSTelemetryStats::STATUS_CONNECTED ) { 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); return; diff --git a/shared/uavobjectdefinition/pipxsettings.xml b/shared/uavobjectdefinition/pipxsettings.xml index 6cd51c96b..7a91dcf8e 100644 --- a/shared/uavobjectdefinition/pipxsettings.xml +++ b/shared/uavobjectdefinition/pipxsettings.xml @@ -2,14 +2,14 @@ PipXtreme configurations options. - + - + - + diff --git a/shared/uavobjectdefinition/pipxstatus.xml b/shared/uavobjectdefinition/pipxstatus.xml index 14064b88f..b99a77c88 100755 --- a/shared/uavobjectdefinition/pipxstatus.xml +++ b/shared/uavobjectdefinition/pipxstatus.xml @@ -13,7 +13,10 @@ + + +