From 649667d3383ae6ff87435114875333b33d9df7c8 Mon Sep 17 00:00:00 2001 From: Brian Webb Date: Sun, 19 May 2013 12:56:23 -0700 Subject: [PATCH 1/5] Addes ifdef PIOS_INCLUDE_WDG around several calls to the wathdog functions for the Revolution firmware (allows you to turn off the watchdog). --- flight/modules/Attitude/revolution/attitude.c | 4 ++++ flight/modules/Sensors/sensors.c | 8 ++++++++ flight/targets/boards/revolution/firmware/pios_board.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index 43f060c92..bf8aa5d5b 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -219,7 +219,9 @@ int32_t AttitudeStart(void) // Start main task xTaskCreate(AttitudeTask, (signed char *)"Attitude", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY, &attitudeTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_ATTITUDE, attitudeTaskHandle); +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_RegisterFlag(PIOS_WDG_ATTITUDE); +#endif GyrosConnectQueue(gyroQueue); AccelsConnectQueue(accelQueue); @@ -277,7 +279,9 @@ static void AttitudeTask(__attribute__((unused)) void *parameters) initialization_required = true; } +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_UpdateFlag(PIOS_WDG_ATTITUDE); +#endif } } diff --git a/flight/modules/Sensors/sensors.c b/flight/modules/Sensors/sensors.c index ddfbf29c7..52ed09855 100644 --- a/flight/modules/Sensors/sensors.c +++ b/flight/modules/Sensors/sensors.c @@ -136,7 +136,9 @@ int32_t SensorsStart(void) // Start main task xTaskCreate(SensorsTask, (signed char *)"Sensors", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY, &sensorsTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_SENSORS, sensorsTaskHandle); +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_RegisterFlag(PIOS_WDG_SENSORS); +#endif return 0; } @@ -206,7 +208,9 @@ static void SensorsTask(__attribute__((unused)) void *parameters) if (accel_test < 0 || gyro_test < 0 || mag_test < 0) { AlarmsSet(SYSTEMALARMS_ALARM_SENSORS, SYSTEMALARMS_ALARM_CRITICAL); while (1) { +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_UpdateFlag(PIOS_WDG_SENSORS); +#endif vTaskDelay(10); } } @@ -221,7 +225,9 @@ static void SensorsTask(__attribute__((unused)) void *parameters) timeval = PIOS_DELAY_GetRaw(); if (error) { +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_UpdateFlag(PIOS_WDG_SENSORS); +#endif lastSysTime = xTaskGetTickCount(); vTaskDelayUntil(&lastSysTime, SENSOR_PERIOD / portTICK_RATE_MS); AlarmsSet(SYSTEMALARMS_ALARM_SENSORS, SYSTEMALARMS_ALARM_CRITICAL); @@ -419,7 +425,9 @@ static void SensorsTask(__attribute__((unused)) void *parameters) } #endif /* if defined(PIOS_INCLUDE_HMC5883) */ +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_UpdateFlag(PIOS_WDG_SENSORS); +#endif lastSysTime = xTaskGetTickCount(); } diff --git a/flight/targets/boards/revolution/firmware/pios_board.c b/flight/targets/boards/revolution/firmware/pios_board.c index 0e3cdf02d..b4ea2d7be 100644 --- a/flight/targets/boards/revolution/firmware/pios_board.c +++ b/flight/targets/boards/revolution/firmware/pios_board.c @@ -391,7 +391,9 @@ void PIOS_Board_Init(void) PIOS_IAP_WriteBootCmd(1, 0); PIOS_IAP_WriteBootCmd(2, 0); } +#ifdef PIOS_INCLUDE_WDG PIOS_WDG_Init(); +#endif /* Initialize UAVObject libraries */ EventDispatcherInitialize(); UAVObjInitialize(); From 864300d9755870a5b9835889a7dc42a7c84b8dc1 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Sun, 19 May 2013 13:08:50 +0200 Subject: [PATCH 2/5] OP-893 Added Auto Update functionality to the firmware page. --- .../setupwizard/pages/autoupdatepage.cpp | 2 +- .../src/plugins/uploader/uploader.ui | 451 +++++++++++------- .../plugins/uploader/uploadergadgetwidget.cpp | 67 +++ .../plugins/uploader/uploadergadgetwidget.h | 5 + 4 files changed, 349 insertions(+), 176 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp index 6506fde34..ca67102fa 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp @@ -77,7 +77,7 @@ void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant valu getWizard()->setWindowIcon(qApp->windowIcon()); enableButtons(true); getWizard()->show(); - ui->statusLabel->setText("Something went wrong, you will have to manualy upgrade the board using the uploader plugin"); + ui->statusLabel->setText("Something went wrong, you will have to manually upgrade the board using the uploader plugin"); break; } } diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.ui b/ground/openpilotgcs/src/plugins/uploader/uploader.ui index 3a8d21c8a..253d579b3 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.ui +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.ui @@ -7,7 +7,7 @@ 0 0 822 - 350 + 523 @@ -15,215 +15,316 @@ - - - - - false - - - Tells the mainboard to go down + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 804 + 505 + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + 0 + + + + 0 + + + 0 + + + + + + + false + + + Start a guided procedure to manually +recover a system which does not boot. + +Rescue is possible in USB mode only. + + + Auto Update + + + + + + + false + + + Tells the mainboard to go down to bootloader mode. (Only enabled if telemetry link is established, either through serial or USB) - - - Halt - - - - - - - true - - - Boots the system. + + + Halt + + + + + + + false + + + Reset the system. +(Only enabled if telemetry link is established, either +through serial or USB) + + + Reset + + + + + + + true + + + Boots the system. Only useful if the system is halted (mainboard blue LED blinking slowly, green LED on) If telemetry is not running, select the link using the dropdown menu on the right. - - - Boot - - - - - - - true - - - Boots the system into safe mode (ie. default HwSettings). + + + Boot + + + + + + + true + + + Boots the system into safe mode (ie. default HwSettings). Only useful if the system is halted (mainboard blue LED blinking slowly, orange LED off) If telemetry is not running, select the link using the dropdown menu on the right. - - - Safe Boot - - - - - - - true - - - <html><head/><body><p>Reboot the board and clear its settings memory.</p><p> Useful if the board cannot boot properly.</p><p> Blue led starts blinking quick for 20-30 seconds than the board will start normally</p><p><br/></p><p>If telemetry is not running, select the link using the dropdown</p><p>menu on the right.</p><p>PLEASE NOTE: Supported with bootloader versions 4.0 and earlier</p></body></html> - - - Erase settings - - - - - - - false - - - Reset the system. -(Only enabled if telemetry link is established, either -through serial or USB) - - - Reset - - - - - - - Start a guided procedure to manually + + + Safe Boot + + + + + + + Start a guided procedure to manually recover a system which does not boot. Rescue is possible in USB mode only. - - - Rescue - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - When telemetry is not connected, select the communication + + + Rescue + + + + + + + true + + + <html><head/><body><p>Reboot the board and clear its settings memory.</p><p> Useful if the board cannot boot properly.</p><p> Blue led starts blinking quick for 20-30 seconds than the board will start normally</p><p><br/></p><p>If telemetry is not running, select the link using the dropdown</p><p>menu on the right.</p><p>PLEASE NOTE: Supported with bootloader versions 4.0 and earlier</p></body></html> + + + Erase settings + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + When telemetry is not connected, select the communication method using this combo box. You can use this to force a communication channel when doing a "Boot" (button on the left). It is updated automatically when halting a running board. - - - - - - - Refresh the list of serial ports - - - ... - - - - - - - - 75 - true - - - - Running - - - - - - - - - - - :/core/images/helpicon.svg:/core/images/helpicon.svg - - - - 30 - 30 - - - - true - - - - - - - - - Qt::Vertical - - - - 0 - - - - Mainboard - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + + + Refresh the list of serial ports + + + ... + + + + + + + + 75 + true + + + + Running + + + + + + + + + + + :/core/images/helpicon.svg:/core/images/helpicon.svg + + + + 30 + 30 + + + + true + + + + + + + + + + + + Auto update + + + + + + OK + + + + + + + 0 + + + false + + + + + + + Progress + + + + + + + + + + Qt::Vertical + + + + 0 + + + + Mainboard + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">To upgrade the firmware in your boards, proceed as follows:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">To upgrade the firmware in your boards,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">press Auto Update and follow instructions</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">or</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">proceed as follows:</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- Connect telemetry</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- Once telemetry is running, press &quot;Halt&quot; above</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- You will get a list of devices.</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- You can then upload/download to/from each board as you wish</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">- You can resume operations by pressing &quot;Boot&quot;</span></p></body></html> - + + + + + - - - - - - - Qt::ScrollBarAlwaysOff - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + Qt::ScrollBarAlwaysOff + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html> - + + + + + diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index 7ecc1cf91..2ac6de747 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -60,6 +60,11 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent) connect(cm, SIGNAL(deviceConnected(QIODevice *)), this, SLOT(onPhisicalHWConnect())); getSerialPorts(); + m_config->autoUpdateButton->setEnabled(autoUpdateCapable()); + connect(m_config->autoUpdateButton, SIGNAL(clicked()), this, SLOT(startAutoUpdate())); + connect(m_config->autoUpdateOkButton, SIGNAL(clicked()), this, SLOT(closeAutoUpdate())); + m_config->autoUpdateGroupBox->setVisible(false); + QIcon rbi; rbi.addFile(QString(":uploader/images/view-refresh.svg")); m_config->refreshPorts->setIcon(rbi); @@ -816,6 +821,68 @@ void UploaderGadgetWidget::downloadEnded(bool succeed) m_config->rescueButton->setEnabled(true); } +void UploaderGadgetWidget::startAutoUpdate() +{ + m_config->buttonFrame->setEnabled(false); + m_config->splitter->setEnabled(false); + m_config->autoUpdateGroupBox->setVisible(true); + m_config->autoUpdateOkButton->setEnabled(false); + connect(this, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(autoUpdateStatus(uploader::AutoUpdateStep, QVariant))); + autoUpdate(); +} + +void UploaderGadgetWidget::finishAutoUpdate() +{ + disconnect(this, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(autoUpdateStatus(uploader::AutoUpdateStep, QVariant))); + m_config->autoUpdateOkButton->setEnabled(true); +} + +void UploaderGadgetWidget::closeAutoUpdate() +{ + m_config->autoUpdateGroupBox->setVisible(false); + m_config->buttonFrame->setEnabled(true); + m_config->splitter->setEnabled(true); +} + +void UploaderGadgetWidget::autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value) +{ + switch(status) + { + case uploader::WAITING_DISCONNECT: + m_config->autoUpdateLabel->setText("Waiting for all OpenPilot boards to be disconnected from USB."); + break; + case uploader::WAITING_CONNECT: + m_config->autoUpdateLabel->setText("Please connect the OpenPilot board to the USB port."); + m_config->autoUpdateProgressBar->setValue(value.toInt()); + break; + case uploader::JUMP_TO_BL: + m_config->autoUpdateProgressBar->setValue(0); + m_config->autoUpdateLabel->setText("Bringing the board into boot loader mode."); + break; + case uploader::LOADING_FW: + m_config->autoUpdateLabel->setText("Preparing to upload firmware to the board."); + break; + case uploader::UPLOADING_FW: + m_config->autoUpdateLabel->setText("Uploading firmware to the board."); + m_config->autoUpdateProgressBar->setValue(value.toInt()); + break; + case uploader::UPLOADING_DESC: + m_config->autoUpdateLabel->setText("Uploading description of the new firmware to the board."); + break; + case uploader::BOOTING: + m_config->autoUpdateLabel->setText("Rebooting the board."); + break; + case uploader::SUCCESS: + m_config->autoUpdateLabel->setText("Board was updated successfully, press OK to finish."); + finishAutoUpdate(); + break; + case uploader::FAILURE: + m_config->autoUpdateLabel->setText("Something went wrong, you will have to manually upgrade the board. Press OK to continue."); + finishAutoUpdate(); + break; + } +} + /** Update log entry */ diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h index 4f088c9aa..faea5678d 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h @@ -118,6 +118,11 @@ private slots: void uploadEnded(bool succeed); void downloadStarted(); void downloadEnded(bool succeed); + void startAutoUpdate(); + void finishAutoUpdate(); + void closeAutoUpdate(); + void autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value); + }; #endif // UPLOADERGADGETWIDGET_H From a408d9748cadc79fce5f792f6971a74a67d357dd Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 20 May 2013 00:02:34 +0300 Subject: [PATCH 3/5] Uncrustification --- .../openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp | 3 +-- .../openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index 2ac6de747..1bdc0e4ef 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -846,8 +846,7 @@ void UploaderGadgetWidget::closeAutoUpdate() void UploaderGadgetWidget::autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value) { - switch(status) - { + switch (status) { case uploader::WAITING_DISCONNECT: m_config->autoUpdateLabel->setText("Waiting for all OpenPilot boards to be disconnected from USB."); break; diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h index faea5678d..5a3032230 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h @@ -122,7 +122,6 @@ private slots: void finishAutoUpdate(); void closeAutoUpdate(); void autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value); - }; #endif // UPLOADERGADGETWIDGET_H From 0798d8e33096bf096ea9892d27cb8a92df116185 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Mon, 20 May 2013 01:12:45 +0300 Subject: [PATCH 4/5] OP-891: move firmware_info template under flight directory --- .../templates/firmware_info.c.template | 40 +++++++++---------- make/.gitattributes | 4 +- make/firmware-defs.mk | 4 +- 3 files changed, 21 insertions(+), 27 deletions(-) rename {make => flight}/templates/firmware_info.c.template (78%) diff --git a/make/templates/firmware_info.c.template b/flight/templates/firmware_info.c.template similarity index 78% rename from make/templates/firmware_info.c.template rename to flight/templates/firmware_info.c.template index e686ac2b4..babc4eff3 100644 --- a/make/templates/firmware_info.c.template +++ b/flight/templates/firmware_info.c.template @@ -44,15 +44,15 @@ */ struct __attribute__((packed)) fw_version_info { - uint8_t magic[4]; - uint32_t commit_hash_prefix; - uint32_t timestamp; - uint8_t board_type; - uint8_t board_revision; - uint8_t commit_tag_name[26]; - uint8_t sha1sum[20]; - uint8_t uavosha1[20]; - uint8_t pad[20]; + uint8_t magic[4]; + uint32_t commit_hash_prefix; + uint32_t timestamp; + uint8_t board_type; + uint8_t board_revision; + uint8_t commit_tag_name[26]; + uint8_t sha1sum[20]; + uint8_t uavosha1[20]; + uint8_t pad[20]; }; #if (defined(__MACH__) && defined(__APPLE__)) @@ -60,16 +60,12 @@ const struct fw_version_info fw_version_blob __attribute__((used)) __attribute__ #else const struct fw_version_info fw_version_blob __attribute__((used)) __attribute__((__section__(".fw_version_blob"))) = { #endif - .magic = { 'O','p','F','w' }, - .commit_hash_prefix = 0x${HASH8}, - .timestamp = ${UNIXTIME}, - .board_type = ${BOARD_TYPE}, - .board_revision = ${BOARD_REVISION}, - .commit_tag_name = "${FWTAG}", - .sha1sum = { ${SHA1} }, - .uavosha1 = { ${UAVOSHA1} }, -}; - -/** - * @} - */ + .magic = { 'O','p','F','w' }, + .commit_hash_prefix = 0x${HASH8}, + .timestamp = ${UNIXTIME}, + .board_type = ${BOARD_TYPE}, + .board_revision = ${BOARD_REVISION}, + .commit_tag_name = "${FWTAG}", + .sha1sum = { ${SHA1} }, + .uavosha1 = { ${UAVOSHA1} }, +}; diff --git a/make/.gitattributes b/make/.gitattributes index fe48df9c1..f02d5b2be 100644 --- a/make/.gitattributes +++ b/make/.gitattributes @@ -6,8 +6,6 @@ *.py text eol=lf *.sh text eol=lf -/doxygen/*.cfg text eol=lf -/templates/firmware_info.c.template text eol=lf -/templates/gcs_version_info.h.template text eol=crlf +/doxygen/* text eol=lf /templates/*.txt text eol=crlf /uncrustify/*.cfg text eol=lf diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index dbda89b26..e0c5f6cc3 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -133,10 +133,10 @@ endef define OPFW_TEMPLATE FORCE: -$(1).firmware_info.c: $(1) $(ROOT_DIR)/make/templates/firmware_info.c.template FORCE +$(1).firmware_info.c: $(1) $(ROOT_DIR)/flight/templates/firmware_info.c.template FORCE @$(ECHO) $(MSG_FWINFO) $$(call toprel, $$@) $(V1) $(VERSION_INFO) \ - --template=$(ROOT_DIR)/make/templates/firmware_info.c.template \ + --template=$(ROOT_DIR)/flight/templates/firmware_info.c.template \ --outfile=$$@ \ --image=$(1) \ --type=$(2) \ From 1236bf3ed9470f945e20d3b14783f33ed6285f17 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Mon, 20 May 2013 10:33:02 +0200 Subject: [PATCH 5/5] renamed Magneto to Mag --- flight/modules/Attitude/revolution/attitude.c | 42 +++++++++---------- flight/modules/Extensions/MagBaro/magbaro.c | 8 ++-- flight/modules/Sensors/sensors.c | 14 +++---- flight/modules/Sensors/simulated/sensors.c | 22 +++++----- flight/targets/boards/osd/firmware/Makefile | 2 +- .../boards/revolution/firmware/UAVObjects.inc | 4 +- .../revolution/firmware/pios_board_sim.c | 4 +- .../boards/revoproto/firmware/UAVObjects.inc | 4 +- .../revoproto/firmware/pios_board_sim.c | 4 +- .../boards/simposix/firmware/UAVObjects.inc | 4 +- .../default_configurations/Developer.xml | 6 +-- .../default_configurations/OpenPilotGCS.xml | 6 +-- .../OpenPilotGCS_wide.xml | 6 +-- .../src/plugins/config/configrevowidget.cpp | 34 +++++++-------- .../src/plugins/config/configrevowidget.h | 2 +- .../src/plugins/uavobjects/uavobjects.pro | 8 ++-- .../{magnetosensor.xml => magsensor.xml} | 2 +- .../{magnetostate.xml => magstate.xml} | 2 +- 18 files changed, 87 insertions(+), 87 deletions(-) rename shared/uavobjectdefinition/{magnetosensor.xml => magsensor.xml} (87%) rename shared/uavobjectdefinition/{magnetostate.xml => magstate.xml} (87%) diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index aa72bab88..2a3b38d3d 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -64,8 +64,8 @@ #include "gyrostate.h" #include "gyrosensor.h" #include "homelocation.h" -#include "magnetosensor.h" -#include "magnetostate.h" +#include "magsensor.h" +#include "magstate.h" #include "positionstate.h" #include "ekfconfiguration.h" #include "ekfstatevariance.h" @@ -125,7 +125,7 @@ static void settingsUpdatedCb(UAVObjEvent *objEv); static int32_t getNED(GPSPositionData *gpsPosition, float *NED); -static void magOffsetEstimation(MagnetoSensorData *mag); +static void magOffsetEstimation(MagSensorData *mag); // check for invalid values static inline bool invalid(float data) @@ -167,8 +167,8 @@ int32_t AttitudeInitialize(void) GyroStateInitialize(); AccelSensorInitialize(); AccelStateInitialize(); - MagnetoSensorInitialize(); - MagnetoStateInitialize(); + MagSensorInitialize(); + MagStateInitialize(); AirspeedSensorInitialize(); AirspeedStateInitialize(); BaroSensorInitialize(); @@ -230,7 +230,7 @@ int32_t AttitudeStart(void) GyroSensorConnectQueue(gyroQueue); AccelSensorConnectQueue(accelQueue); - MagnetoSensorConnectQueue(magQueue); + MagSensorConnectQueue(magQueue); AirspeedSensorConnectQueue(airspeedQueue); BaroSensorConnectQueue(baroQueue); GPSPositionConnectQueue(gpsQueue); @@ -335,10 +335,10 @@ static int32_t updateAttitudeComplementary(bool first_run) if (xQueueReceive(magQueue, &ev, 0 / portTICK_RATE_MS) != pdTRUE) { return -1; } - MagnetoSensorData magData; - MagnetoSensorGet(&magData); + MagSensorData magData; + MagSensorGet(&magData); #else - MagnetoSensorData magData; + MagSensorData magData; magData.x = 100.0f; magData.y = 0.0f; magData.z = 0.0f; @@ -434,20 +434,20 @@ static int32_t updateAttitudeComplementary(bool first_run) // Rotate gravity to body frame and cross with accels float brot[3]; float Rbe[3][3]; - MagnetoSensorData mag; + MagSensorData mag; Quaternion2R(q, Rbe); - MagnetoSensorGet(&mag); + MagSensorGet(&mag); // TODO: separate filter! if (revoCalibration.MagBiasNullingRate > 0) { magOffsetEstimation(&mag); } - MagnetoStateData mags; + MagStateData mags; mags.x = mag.x; mags.y = mag.y; mags.z = mag.z; - MagnetoStateSet(&mags); + MagStateSet(&mags); // If the mag is producing bad data don't use it (normally bad calibration) if (!isnan(mag.x) && !isinf(mag.x) && !isnan(mag.y) && !isinf(mag.y) && !isnan(mag.z) && !isinf(mag.z)) { @@ -612,7 +612,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) UAVObjEvent ev; GyroSensorData gyroSensorData; AccelSensorData accelSensorData; - MagnetoStateData magData; + MagStateData magData; AirspeedSensorData airspeedData; BaroSensorData baroData; GPSPositionData gpsData; @@ -694,17 +694,17 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) AccelSensorGet(&accelSensorData); // TODO: separate filter! if (mag_updated) { - MagnetoSensorData mags; - MagnetoSensorGet(&mags); + MagSensorData mags; + MagSensorGet(&mags); if (revoCalibration.MagBiasNullingRate > 0) { magOffsetEstimation(&mags); } magData.x = mags.x; magData.y = mags.y; magData.z = mags.z; - MagnetoStateSet(&magData); + MagStateSet(&magData); } - MagnetoStateGet(&magData); + MagStateGet(&magData); BaroSensorGet(&baroData); AirspeedSensorGet(&airspeedData); @@ -860,7 +860,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) } // xQueueReceive(magQueue, &ev, 100 / portTICK_RATE_MS); - // MagnetoSensorGet(&magData); + // MagSensorGet(&magData); AttitudeStateData attitudeState; AttitudeStateGet(&attitudeState); @@ -1162,10 +1162,10 @@ static void settingsUpdatedCb(UAVObjEvent *ev) /** * Perform an update of the @ref MagBias based on - * Magnetometer Offset Cancellation: Theory and Implementation, + * Magmeter Offset Cancellation: Theory and Implementation, * revisited William Premerlani, October 14, 2011 */ -static void magOffsetEstimation(MagnetoSensorData *mag) +static void magOffsetEstimation(MagSensorData *mag) { #if 0 // Constants, to possibly go into a UAVO diff --git a/flight/modules/Extensions/MagBaro/magbaro.c b/flight/modules/Extensions/MagBaro/magbaro.c index 3bff3cbca..927482f3f 100644 --- a/flight/modules/Extensions/MagBaro/magbaro.c +++ b/flight/modules/Extensions/MagBaro/magbaro.c @@ -41,7 +41,7 @@ #include "hwsettings.h" #include "magbaro.h" #include "barosensor.h" // object that will be updated by the module -#include "magnetosensor.h" +#include "magsensor.h" #include "taskinfo.h" // Private constants @@ -109,7 +109,7 @@ int32_t MagBaroInitialize() if (magbaroEnabled) { #if defined(PIOS_INCLUDE_HMC5883) - MagnetoSensorInitialize(); + MagSensorInitialize(); #endif #if defined(PIOS_INCLUDE_BMP085) @@ -149,7 +149,7 @@ static void magbaroTask(__attribute__((unused)) void *parameters) #endif #if defined(PIOS_INCLUDE_HMC5883) - MagnetoSensorData mag; + MagSensorData mag; PIOS_HMC5883_Init(&pios_hmc5883_cfg); uint32_t mag_update_time = PIOS_DELAY_GetRaw(); #endif @@ -207,7 +207,7 @@ static void magbaroTask(__attribute__((unused)) void *parameters) mag.x = mags[0]; mag.y = mags[1]; mag.z = mags[2]; - MagnetoSensorSet(&mag); + MagSensorSet(&mag); mag_update_time = PIOS_DELAY_GetRaw(); } #endif diff --git a/flight/modules/Sensors/sensors.c b/flight/modules/Sensors/sensors.c index 5a1041c93..b95d77bdf 100644 --- a/flight/modules/Sensors/sensors.c +++ b/flight/modules/Sensors/sensors.c @@ -4,7 +4,7 @@ * @{ * @addtogroup Sensors * @brief Acquires sensor data - * Specifically updates the the @ref GyroSensor, @ref AccelSensor, and @ref MagnetoSensor objects + * Specifically updates the the @ref GyroSensor, @ref AccelSensor, and @ref MagSensor objects * @{ * * @file sensors.c @@ -32,7 +32,7 @@ /** * Input objects: None, takes sensor data via pios - * Output objects: @ref GyroSensor @ref AccelSensor @ref MagnetoSensor + * Output objects: @ref GyroSensor @ref AccelSensor @ref MagSensor * * The module executes in its own thread. * @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include #include @@ -73,7 +73,7 @@ // Private functions static void SensorsTask(void *parameters); static void settingsUpdatedCb(UAVObjEvent *objEv); -// static void magOffsetEstimation(MagnetoSensorData *mag); +// static void magOffsetEstimation(MagSensorData *mag); // Private variables static xTaskHandle sensorsTaskHandle; @@ -110,7 +110,7 @@ int32_t SensorsInitialize(void) { GyroSensorInitialize(); AccelSensorInitialize(); - MagnetoSensorInitialize(); + MagSensorInitialize(); RevoCalibrationInitialize(); AttitudeSettingsInitialize(); @@ -383,7 +383,7 @@ static void SensorsTask(__attribute__((unused)) void *parameters) // and make it average zero (weakly) #if defined(PIOS_INCLUDE_HMC5883) - MagnetoSensorData mag; + MagSensorData mag; if (PIOS_HMC5883_NewDataAvailable() || PIOS_DELAY_DiffuS(mag_update_time) > 150000) { int16_t values[3]; PIOS_HMC5883_ReadMag(values); @@ -402,7 +402,7 @@ static void SensorsTask(__attribute__((unused)) void *parameters) mag.z = mags[2]; } - MagnetoSensorSet(&mag); + MagSensorSet(&mag); mag_update_time = PIOS_DELAY_GetRaw(); } #endif /* if defined(PIOS_INCLUDE_HMC5883) */ diff --git a/flight/modules/Sensors/simulated/sensors.c b/flight/modules/Sensors/simulated/sensors.c index fdd58abf0..b236f6cd0 100644 --- a/flight/modules/Sensors/simulated/sensors.c +++ b/flight/modules/Sensors/simulated/sensors.c @@ -4,7 +4,7 @@ * @{ * @addtogroup Sensors * @brief Acquires sensor data - * Specifically updates the the @ref GyroSensor, @ref AccelSensor, and @ref MagnetoSensor objects + * Specifically updates the the @ref GyroSensor, @ref AccelSensor, and @ref MagSensor objects * @{ * * @file sensors.c @@ -32,7 +32,7 @@ /** * Input objects: None, takes sensor data via pios - * Output objects: @ref GyroSensor @ref AccelSensor @ref MagnetoSensor + * Output objects: @ref GyroSensor @ref AccelSensor @ref MagSensor * * The module executes in its own thread. * @@ -113,7 +113,7 @@ int32_t SensorsInitialize(void) // GyrosBiasInitialize(); GPSPositionInitialize(); GPSVelocityInitialize(); - MagnetoSensorInitialize(); + MagSensorInitialize(); MagBiasInitialize(); RevoCalibrationInitialize(); @@ -252,11 +252,11 @@ static void simulateConstant() // Because most crafts wont get enough information from gravity to zero yaw gyro, we try // and make it average zero (weakly) - MagnetoSensorData mag; + MagSensorData mag; mag.x = 400; mag.y = 0; mag.z = 800; - MagnetoSensorSet(&mag); + MagSensorSet(&mag); } static void simulateModelAgnostic() @@ -314,11 +314,11 @@ static void simulateModelAgnostic() // Because most crafts wont get enough information from gravity to zero yaw gyro, we try // and make it average zero (weakly) - MagnetoSensorData mag; + MagSensorData mag; mag.x = 400; mag.y = 0; mag.z = 800; - MagnetoSensorSet(&mag); + MagSensorSet(&mag); } float thrustToDegs = 50; @@ -528,12 +528,12 @@ static void simulateModelQuadcopter() // Update mag periodically static uint32_t last_mag_time = 0; if (PIOS_DELAY_DiffuS(last_mag_time) / 1.0e6 > MAG_PERIOD) { - MagnetoSensorData mag; + MagSensorData mag; mag.x = homeLocation.Be[0] * Rbe[0][0] + homeLocation.Be[1] * Rbe[0][1] + homeLocation.Be[2] * Rbe[0][2]; mag.y = homeLocation.Be[0] * Rbe[1][0] + homeLocation.Be[1] * Rbe[1][1] + homeLocation.Be[2] * Rbe[1][2]; mag.z = homeLocation.Be[0] * Rbe[2][0] + homeLocation.Be[1] * Rbe[2][1] + homeLocation.Be[2] * Rbe[2][2]; - MagnetoSensorSet(&mag); + MagSensorSet(&mag); last_mag_time = PIOS_DELAY_GetRaw(); } @@ -811,11 +811,11 @@ static void simulateModelAirplane() // Update mag periodically static uint32_t last_mag_time = 0; if (PIOS_DELAY_DiffuS(last_mag_time) / 1.0e6 > MAG_PERIOD) { - MagnetoSensorData mag; + MagSensorData mag; mag.x = 100 + homeLocation.Be[0] * Rbe[0][0] + homeLocation.Be[1] * Rbe[0][1] + homeLocation.Be[2] * Rbe[0][2]; mag.y = 100 + homeLocation.Be[0] * Rbe[1][0] + homeLocation.Be[1] * Rbe[1][1] + homeLocation.Be[2] * Rbe[1][2]; mag.z = 100 + homeLocation.Be[0] * Rbe[2][0] + homeLocation.Be[1] * Rbe[2][1] + homeLocation.Be[2] * Rbe[2][2]; - MagnetoSensorSet(&mag); + MagSensorSet(&mag); last_mag_time = PIOS_DELAY_GetRaw(); } diff --git a/flight/targets/boards/osd/firmware/Makefile b/flight/targets/boards/osd/firmware/Makefile index 524a4baad..7c88af224 100644 --- a/flight/targets/boards/osd/firmware/Makefile +++ b/flight/targets/boards/osd/firmware/Makefile @@ -93,7 +93,7 @@ ifndef TESTAPP SRC += $(OPUAVSYNTHDIR)/gpstime.c SRC += $(OPUAVSYNTHDIR)/osdsettings.c SRC += $(OPUAVSYNTHDIR)/barosensor.c - SRC += $(OPUAVSYNTHDIR)/magnetosensor.c + SRC += $(OPUAVSYNTHDIR)/magsensor.c else ## Test Code SRC += $(OPTESTS)/test_common.c diff --git a/flight/targets/boards/revolution/firmware/UAVObjects.inc b/flight/targets/boards/revolution/firmware/UAVObjects.inc index 34f387250..1ee34b95d 100644 --- a/flight/targets/boards/revolution/firmware/UAVObjects.inc +++ b/flight/targets/boards/revolution/firmware/UAVObjects.inc @@ -30,8 +30,8 @@ UAVOBJSRCFILENAMES += gyrostate UAVOBJSRCFILENAMES += gyrosensor UAVOBJSRCFILENAMES += accelstate UAVOBJSRCFILENAMES += accelsensor -UAVOBJSRCFILENAMES += magnetosensor -UAVOBJSRCFILENAMES += magnetostate +UAVOBJSRCFILENAMES += magsensor +UAVOBJSRCFILENAMES += magstate UAVOBJSRCFILENAMES += barosensor UAVOBJSRCFILENAMES += airspeedsensor UAVOBJSRCFILENAMES += airspeedsettings diff --git a/flight/targets/boards/revolution/firmware/pios_board_sim.c b/flight/targets/boards/revolution/firmware/pios_board_sim.c index ca2c3de98..9cf758199 100644 --- a/flight/targets/boards/revolution/firmware/pios_board_sim.c +++ b/flight/targets/boards/revolution/firmware/pios_board_sim.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include void Stack_Change() {} @@ -138,7 +138,7 @@ void PIOS_Board_Init(void) AccelSensorInitialize(); BaroSensorInitialize(); - MagnetoSensorInitialize(); + MagSensorInitialize(); GPSPositionInitialize(); GyroSensorInitialize(); diff --git a/flight/targets/boards/revoproto/firmware/UAVObjects.inc b/flight/targets/boards/revoproto/firmware/UAVObjects.inc index 02169d2b8..5742838ba 100644 --- a/flight/targets/boards/revoproto/firmware/UAVObjects.inc +++ b/flight/targets/boards/revoproto/firmware/UAVObjects.inc @@ -35,8 +35,8 @@ UAVOBJSRCFILENAMES += gyrostate UAVOBJSRCFILENAMES += gyrosensor UAVOBJSRCFILENAMES += accelstate UAVOBJSRCFILENAMES += accelsensor -UAVOBJSRCFILENAMES += magnetostate -UAVOBJSRCFILENAMES += magnetosensor +UAVOBJSRCFILENAMES += magstate +UAVOBJSRCFILENAMES += magsensor UAVOBJSRCFILENAMES += barosensor UAVOBJSRCFILENAMES += airspeedsensor UAVOBJSRCFILENAMES += airspeedsettings diff --git a/flight/targets/boards/revoproto/firmware/pios_board_sim.c b/flight/targets/boards/revoproto/firmware/pios_board_sim.c index 0b026b530..27d998798 100644 --- a/flight/targets/boards/revoproto/firmware/pios_board_sim.c +++ b/flight/targets/boards/revoproto/firmware/pios_board_sim.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include void Stack_Change() {} @@ -138,7 +138,7 @@ void PIOS_Board_Init(void) AccelSensorInitialize(); BaroSensorInitialize(); - MagnetoSensorInitialize(); + MagSensorInitialize(); GPSPositionInitialize(); GyroStatInitialize(); GyroSensorInitialize(); diff --git a/flight/targets/boards/simposix/firmware/UAVObjects.inc b/flight/targets/boards/simposix/firmware/UAVObjects.inc index c5a401d52..9e9661152 100644 --- a/flight/targets/boards/simposix/firmware/UAVObjects.inc +++ b/flight/targets/boards/simposix/firmware/UAVObjects.inc @@ -35,8 +35,8 @@ UAVOBJSRCFILENAMES += gyrostate UAVOBJSRCFILENAMES += gyrosensor UAVOBJSRCFILENAMES += accelstate UAVOBJSRCFILENAMES += accelsensor -UAVOBJSRCFILENAMES += magnetosensor -UAVOBJSRCFILENAMES += magnetostate +UAVOBJSRCFILENAMES += magsensor +UAVOBJSRCFILENAMES += magstate UAVOBJSRCFILENAMES += barosensor UAVOBJSRCFILENAMES += airspeedsensor UAVOBJSRCFILENAMES += airspeedsettings diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml index 5b1282f5e..233061c29 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml @@ -2233,7 +2233,7 @@ 4294901760 None x - MagnetoState + MagState 6.92916505601691e-310 1 3.86203233966055e-312 @@ -2243,7 +2243,7 @@ 4283782655 None y - MagnetoState + MagState 1.72723371101889e-77 1 -1 @@ -2253,7 +2253,7 @@ 4283804160 None z - MagnetoState + MagState 1.72723371102028e-77 1 7.21478569792807e-313 diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml index f00c303fe..4ad20f5da 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml @@ -2264,7 +2264,7 @@ 4294901760 None x - MagnetoState + MagState 0 1 0 @@ -2274,7 +2274,7 @@ 4283782655 None y - MagnetoState + MagState 0 1 0 @@ -2284,7 +2284,7 @@ 4283804160 None z - MagnetoState + MagState 0 1 0 diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml index 916b88152..4273cf797 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml @@ -2242,7 +2242,7 @@ 4294901760 None x - MagnetoState + MagState 0 1 0 @@ -2252,7 +2252,7 @@ 4283782655 None y - MagnetoState + MagState 0 1 0 @@ -2262,7 +2262,7 @@ 4283804160 None z - MagnetoState + MagState 0 1 0 diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp index c3dcbba6a..9d22339cc 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #define GRAVITY 9.81f #include "assertions.h" @@ -585,10 +585,10 @@ void ConfigRevoWidget::doStartSixPointCalibration() #endif /* Need to get as many mag updates as possible */ - MagnetoState *mag = MagnetoState::GetInstance(getObjectManager()); + MagState *mag = MagState::GetInstance(getObjectManager()); Q_ASSERT(mag); - initialMagnetoStateMdata = mag->getMetadata(); - mdata = initialMagnetoStateMdata; + initialMagStateMdata = mag->getMetadata(); + mdata = initialMagStateMdata; UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 100; mag->setMetadata(mdata); @@ -624,7 +624,7 @@ void ConfigRevoWidget::savePositionData() AccelState *accelState = AccelState::GetInstance(getObjectManager()); Q_ASSERT(accelState); - MagnetoState *mag = MagnetoState::GetInstance(getObjectManager()); + MagState *mag = MagState::GetInstance(getObjectManager()); Q_ASSERT(mag); connect(accelState, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(doGetSixPointCalibrationMeasurement(UAVObject *))); @@ -653,10 +653,10 @@ void ConfigRevoWidget::doGetSixPointCalibrationMeasurement(UAVObject *obj) accel_accum_y.append(accelStateData.y); accel_accum_z.append(accelStateData.z); #endif - } else if (obj->getObjID() == MagnetoState::OBJID) { - MagnetoState *mag = MagnetoState::GetInstance(getObjectManager()); + } else if (obj->getObjID() == MagState::OBJID) { + MagState *mag = MagState::GetInstance(getObjectManager()); Q_ASSERT(mag); - MagnetoState::DataFields magData = mag->getData(); + MagState::DataFields magData = mag->getData(); mag_accum_x.append(magData.x); mag_accum_y.append(magData.y); mag_accum_z.append(magData.z); @@ -685,7 +685,7 @@ void ConfigRevoWidget::doGetSixPointCalibrationMeasurement(UAVObject *obj) #endif // Store the mean for this position for the mag - MagnetoState *mag = MagnetoState::GetInstance(getObjectManager()); + MagState *mag = MagState::GetInstance(getObjectManager()); Q_ASSERT(mag); disconnect(mag, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(doGetSixPointCalibrationMeasurement(UAVObject *))); mag_data_x[position] = listMean(mag_accum_x); @@ -722,7 +722,7 @@ void ConfigRevoWidget::doGetSixPointCalibrationMeasurement(UAVObject *obj) #ifdef SIX_POINT_CAL_ACCEL accelState->setMetadata(initialAccelStateMdata); #endif - mag->setMetadata(initialMagnetoStateMdata); + mag->setMetadata(initialMagStateMdata); // Recall saved board rotation recallBoardRotation(); @@ -928,7 +928,7 @@ void ConfigRevoWidget::doStartNoiseMeasurement() Q_ASSERT(accelState); GyroState *gyroState = GyroState::GetInstance(getObjectManager()); Q_ASSERT(gyroState); - MagnetoState *mag = MagnetoState::GetInstance(getObjectManager()); + MagState *mag = MagState::GetInstance(getObjectManager()); Q_ASSERT(mag); UAVObject::Metadata mdata; @@ -945,8 +945,8 @@ void ConfigRevoWidget::doStartNoiseMeasurement() mdata.flightTelemetryUpdatePeriod = 100; gyroState->setMetadata(mdata); - initialMagnetoStateMdata = mag->getMetadata(); - mdata = initialMagnetoStateMdata; + initialMagStateMdata = mag->getMetadata(); + mdata = initialMagStateMdata; UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 100; mag->setMetadata(mdata); @@ -990,11 +990,11 @@ void ConfigRevoWidget::doGetNoiseSample(UAVObject *obj) accel_accum_z.append(accelStateData.z); break; } - case MagnetoState::OBJID: + case MagState::OBJID: { - MagnetoState *mags = MagnetoState::GetInstance(getObjectManager()); + MagState *mags = MagState::GetInstance(getObjectManager()); Q_ASSERT(mags); - MagnetoState::DataFields magData = mags->getData(); + MagState::DataFields magData = mags->getData(); mag_accum_x.append(magData.x); mag_accum_y.append(magData.y); mag_accum_z.append(magData.z); @@ -1017,7 +1017,7 @@ void ConfigRevoWidget::doGetNoiseSample(UAVObject *obj) gyro_accum_x.length() >= NOISE_SAMPLES && accel_accum_x.length() >= NOISE_SAMPLES) { // No need to for more updates - MagnetoState *mags = MagnetoState::GetInstance(getObjectManager()); + MagState *mags = MagState::GetInstance(getObjectManager()); AccelState *accelState = AccelState::GetInstance(getObjectManager()); GyroState *gyroState = GyroState::GetInstance(getObjectManager()); disconnect(accelState, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(doGetNoiseSample(UAVObject *))); diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.h b/ground/openpilotgcs/src/plugins/config/configrevowidget.h index 2e3789025..6e26abf91 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.h +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.h @@ -92,7 +92,7 @@ private: UAVObject::Metadata initialAccelStateMdata; UAVObject::Metadata initialGyroStateMdata; - UAVObject::Metadata initialMagnetoStateMdata; + UAVObject::Metadata initialMagStateMdata; UAVObject::Metadata initialBaroSensorMdata; float initialMagCorrectionRate; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro index 745b0b935..4ff9d4050 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro @@ -42,8 +42,8 @@ HEADERS += $$UAVOBJECT_SYNTHETICS/accessorydesired.h \ $$UAVOBJECT_SYNTHETICS/gyrosensor.h \ $$UAVOBJECT_SYNTHETICS/accelsensor.h \ $$UAVOBJECT_SYNTHETICS/accelstate.h \ - $$UAVOBJECT_SYNTHETICS/magnetosensor.h \ - $$UAVOBJECT_SYNTHETICS/magnetostate.h \ + $$UAVOBJECT_SYNTHETICS/magsensor.h \ + $$UAVOBJECT_SYNTHETICS/magstate.h \ $$UAVOBJECT_SYNTHETICS/camerastabsettings.h \ $$UAVOBJECT_SYNTHETICS/flighttelemetrystats.h \ $$UAVOBJECT_SYNTHETICS/systemstats.h \ @@ -126,8 +126,8 @@ SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \ $$UAVOBJECT_SYNTHETICS/accelstate.cpp \ $$UAVOBJECT_SYNTHETICS/gyrostate.cpp \ $$UAVOBJECT_SYNTHETICS/gyrosensor.cpp \ - $$UAVOBJECT_SYNTHETICS/magnetosensor.cpp \ - $$UAVOBJECT_SYNTHETICS/magnetostate.cpp \ + $$UAVOBJECT_SYNTHETICS/magsensor.cpp \ + $$UAVOBJECT_SYNTHETICS/magstate.cpp \ $$UAVOBJECT_SYNTHETICS/camerastabsettings.cpp \ $$UAVOBJECT_SYNTHETICS/flighttelemetrystats.cpp \ $$UAVOBJECT_SYNTHETICS/systemstats.cpp \ diff --git a/shared/uavobjectdefinition/magnetosensor.xml b/shared/uavobjectdefinition/magsensor.xml similarity index 87% rename from shared/uavobjectdefinition/magnetosensor.xml rename to shared/uavobjectdefinition/magsensor.xml index 5974636f6..1681713b6 100644 --- a/shared/uavobjectdefinition/magnetosensor.xml +++ b/shared/uavobjectdefinition/magsensor.xml @@ -1,5 +1,5 @@ - + The mag data. diff --git a/shared/uavobjectdefinition/magnetostate.xml b/shared/uavobjectdefinition/magstate.xml similarity index 87% rename from shared/uavobjectdefinition/magnetostate.xml rename to shared/uavobjectdefinition/magstate.xml index 546b52d69..85b2bb458 100644 --- a/shared/uavobjectdefinition/magnetostate.xml +++ b/shared/uavobjectdefinition/magstate.xml @@ -1,5 +1,5 @@ - + The mag data.