From 524cff1c4083737179ec569f4d8cd1e185577661 Mon Sep 17 00:00:00 2001 From: lilvinz Date: Sun, 16 Sep 2012 21:25:06 +0200 Subject: [PATCH 1/9] pios_mpu6000: fixed masked locals mistake --- flight/PiOS/Common/pios_mpu6000.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/flight/PiOS/Common/pios_mpu6000.c b/flight/PiOS/Common/pios_mpu6000.c index 56e8cccbd..b77a4f6df 100644 --- a/flight/PiOS/Common/pios_mpu6000.c +++ b/flight/PiOS/Common/pios_mpu6000.c @@ -435,9 +435,6 @@ void PIOS_MPU6000_IRQHandler(void) if(PIOS_MPU6000_ClaimBus() != 0) return; - uint8_t mpu6000_send_buf[1+sizeof(struct pios_mpu6000_data)] = {PIOS_MPU6000_FIFO_REG | 0x80, 0, 0, 0, 0, 0, 0, 0, 0}; - uint8_t mpu6000_rec_buf[1+sizeof(struct pios_mpu6000_data)]; - if(PIOS_SPI_TransferBlock(dev->spi_id, &mpu6000_send_buf[0], &mpu6000_rec_buf[0], sizeof(mpu6000_send_buf), NULL) < 0) { PIOS_MPU6000_ReleaseBus(); mpu6000_fails++; From a6a7ed8157e5dc394cbf1ab36fa1a1562348315f Mon Sep 17 00:00:00 2001 From: lilvinz Date: Sun, 16 Sep 2012 21:44:09 +0200 Subject: [PATCH 2/9] pios_exti: added returnvalues to exti handlers which allows to use portEND_SWITCHING_ISR --- flight/PiOS/Common/pios_bma180.c | 5 +-- flight/PiOS/Common/pios_hmc5883.c | 6 ++-- flight/PiOS/Common/pios_l3gd20.c | 7 ++-- flight/PiOS/Common/pios_mpu6000.c | 7 ++-- flight/PiOS/STM32F10x/pios_exti.c | 60 ++++++++++++++++++++++++++++--- flight/PiOS/STM32F4xx/pios_exti.c | 56 +++++++++++++++++++++++++++-- flight/PiOS/inc/pios_bma180.h | 2 +- flight/PiOS/inc/pios_exti.h | 2 +- flight/PiOS/inc/pios_hmc5883.h | 2 +- flight/PiOS/inc/pios_l3gd20.h | 2 +- flight/PiOS/inc/pios_mpu6000.h | 2 +- 11 files changed, 130 insertions(+), 21 deletions(-) diff --git a/flight/PiOS/Common/pios_bma180.c b/flight/PiOS/Common/pios_bma180.c index 2a578dd5d..65b872e2c 100644 --- a/flight/PiOS/Common/pios_bma180.c +++ b/flight/PiOS/Common/pios_bma180.c @@ -434,7 +434,7 @@ int32_t PIOS_BMA180_Test() * @brief IRQ Handler. Read data from the BMA180 FIFO and push onto a local fifo. */ int32_t bma180_irqs = 0; -void PIOS_BMA180_IRQHandler(void) +bool PIOS_BMA180_IRQHandler(void) { bma180_irqs++; @@ -470,7 +470,8 @@ void PIOS_BMA180_IRQHandler(void) data.temperature = pios_bma180_dmabuf[7]; fifoBuf_putData(&dev->fifo, (uint8_t *) &data, sizeof(data)); - + + return false; } #endif /* PIOS_INCLUDE_BMA180 */ diff --git a/flight/PiOS/Common/pios_hmc5883.c b/flight/PiOS/Common/pios_hmc5883.c index 8891709fc..14d4f96fe 100644 --- a/flight/PiOS/Common/pios_hmc5883.c +++ b/flight/PiOS/Common/pios_hmc5883.c @@ -391,9 +391,11 @@ int32_t PIOS_HMC5883_Test(void) /** * @brief IRQ Handler */ -void PIOS_HMC5883_IRQHandler(void) +bool PIOS_HMC5883_IRQHandler(void) { - pios_hmc5883_data_ready = true; + pios_hmc5883_data_ready = true + + return false; } #endif /* PIOS_INCLUDE_HMC5883 */ diff --git a/flight/PiOS/Common/pios_l3gd20.c b/flight/PiOS/Common/pios_l3gd20.c index 3151d26e2..e98a66153 100644 --- a/flight/PiOS/Common/pios_l3gd20.c +++ b/flight/PiOS/Common/pios_l3gd20.c @@ -353,7 +353,7 @@ uint8_t PIOS_L3GD20_Test(void) /** * @brief IRQ Handler. Read all the data from onboard buffer */ -void PIOS_L3GD20_IRQHandler(void) +bool PIOS_L3GD20_IRQHandler(void) { l3gd20_irq++; @@ -375,7 +375,10 @@ void PIOS_L3GD20_IRQHandler(void) memcpy((uint8_t *) &(data.gyro_x), &rec[1], 6); data.temperature = PIOS_L3GD20_GetReg(PIOS_L3GD20_OUT_TEMP); - xQueueSend(dev->queue, (void *) &data, 0); + portBASE_TYPE xHigherPriorityTaskWoken; + xQueueSendToBackFromISR(dev->queue, (void *) &data, &xHigherPriorityTaskWoken); + + return xHigherPriorityTaskWoken == pdTRUE; } #endif /* L3GD20 */ diff --git a/flight/PiOS/Common/pios_mpu6000.c b/flight/PiOS/Common/pios_mpu6000.c index 56e8cccbd..46bd3569e 100644 --- a/flight/PiOS/Common/pios_mpu6000.c +++ b/flight/PiOS/Common/pios_mpu6000.c @@ -461,12 +461,15 @@ void PIOS_MPU6000_IRQHandler(void) data.gyro_y = mpu6000_rec_buf[5] << 8 | mpu6000_rec_buf[6]; data.gyro_z = mpu6000_rec_buf[7] << 8 | mpu6000_rec_buf[8]; #endif - - xQueueSend(dev->queue, (void *) &data, 0); + + portBASE_TYPE xHigherPriorityTaskWoken; + xQueueSendToBackFromISR(dev->queue, (void *) &data, &xHigherPriorityTaskWoken); mpu6000_irq++; mpu6000_time_us = PIOS_DELAY_DiffuS(timeval); + + return xHigherPriorityTaskWoken == pdTRUE; } #endif diff --git a/flight/PiOS/STM32F10x/pios_exti.c b/flight/PiOS/STM32F10x/pios_exti.c index 65a651f6f..41d40f14b 100644 --- a/flight/PiOS/STM32F10x/pios_exti.c +++ b/flight/PiOS/STM32F10x/pios_exti.c @@ -149,7 +149,7 @@ out_fail: return -1; } -static void PIOS_EXTI_generic_irq_handler(uint8_t line_index) +static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) { uint8_t cfg_index = pios_exti_line_to_cfg_map[line_index]; @@ -158,69 +158,119 @@ static void PIOS_EXTI_generic_irq_handler(uint8_t line_index) if (cfg_index > NELEMENTS(pios_exti_line_to_cfg_map) || cfg_index == PIOS_EXTI_INVALID) { /* Unconfigured interrupt just fired! */ - return; + return false; } struct pios_exti_cfg * cfg = &__start__exti + cfg_index; - cfg->vector(); + return cfg->vector(); } -/* Bind Interrupt Handlers */ - +#ifdef PIOS_INCLUDE_FREERTOS +#define PIOS_EXTI_HANDLE_LINE(line) \ + if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ + EXTI_ClearITPendingBit(EXTI_Line##line); \ + xHigherPriorityTaskWoken |= PIOS_EXTI_generic_irq_handler(line); \ + } +#else #define PIOS_EXTI_HANDLE_LINE(line) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ PIOS_EXTI_generic_irq_handler(line); \ } +#endif + +/* Bind Interrupt Handlers */ static void PIOS_EXTI_0_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(0); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI0_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_0_irq_handler"))); static void PIOS_EXTI_1_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(1); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI1_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_1_irq_handler"))); static void PIOS_EXTI_2_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(2); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI2_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_2_irq_handler"))); static void PIOS_EXTI_3_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(3); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI3_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_3_irq_handler"))); static void PIOS_EXTI_4_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(4); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI4_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_4_irq_handler"))); static void PIOS_EXTI_9_5_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(5); PIOS_EXTI_HANDLE_LINE(6); PIOS_EXTI_HANDLE_LINE(7); PIOS_EXTI_HANDLE_LINE(8); PIOS_EXTI_HANDLE_LINE(9); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI9_5_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_9_5_irq_handler"))); static void PIOS_EXTI_15_10_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(10); PIOS_EXTI_HANDLE_LINE(11); PIOS_EXTI_HANDLE_LINE(12); PIOS_EXTI_HANDLE_LINE(13); PIOS_EXTI_HANDLE_LINE(14); PIOS_EXTI_HANDLE_LINE(15); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI15_10_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_15_10_irq_handler"))); diff --git a/flight/PiOS/STM32F4xx/pios_exti.c b/flight/PiOS/STM32F4xx/pios_exti.c index 9f9567d51..8259ce006 100644 --- a/flight/PiOS/STM32F4xx/pios_exti.c +++ b/flight/PiOS/STM32F4xx/pios_exti.c @@ -149,7 +149,7 @@ out_fail: return -1; } -static void PIOS_EXTI_generic_irq_handler(uint8_t line_index) +static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) { uint8_t cfg_index = pios_exti_line_to_cfg_map[line_index]; @@ -158,69 +158,119 @@ static void PIOS_EXTI_generic_irq_handler(uint8_t line_index) if (cfg_index > NELEMENTS(pios_exti_line_to_cfg_map) || cfg_index == PIOS_EXTI_INVALID) { /* Unconfigured interrupt just fired! */ - return; + return false; } struct pios_exti_cfg * cfg = &__start__exti + cfg_index; - cfg->vector(); + return cfg->vector(); } /* Bind Interrupt Handlers */ +#ifdef PIOS_INCLUDE_FREERTOS +#define PIOS_EXTI_HANDLE_LINE(line) \ + if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ + EXTI_ClearITPendingBit(EXTI_Line##line); \ + xHigherPriorityTaskWoken |= PIOS_EXTI_generic_irq_handler(line); \ + } +#else #define PIOS_EXTI_HANDLE_LINE(line) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ PIOS_EXTI_generic_irq_handler(line); \ } +#endif static void PIOS_EXTI_0_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(0); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI0_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_0_irq_handler"))); static void PIOS_EXTI_1_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(1); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI1_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_1_irq_handler"))); static void PIOS_EXTI_2_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(2); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI2_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_2_irq_handler"))); static void PIOS_EXTI_3_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(3); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI3_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_3_irq_handler"))); static void PIOS_EXTI_4_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(4); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI4_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_4_irq_handler"))); static void PIOS_EXTI_9_5_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(5); PIOS_EXTI_HANDLE_LINE(6); PIOS_EXTI_HANDLE_LINE(7); PIOS_EXTI_HANDLE_LINE(8); PIOS_EXTI_HANDLE_LINE(9); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI9_5_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_9_5_irq_handler"))); static void PIOS_EXTI_15_10_irq_handler (void) { +#ifdef PIOS_INCLUDE_FREERTOS + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#endif PIOS_EXTI_HANDLE_LINE(10); PIOS_EXTI_HANDLE_LINE(11); PIOS_EXTI_HANDLE_LINE(12); PIOS_EXTI_HANDLE_LINE(13); PIOS_EXTI_HANDLE_LINE(14); PIOS_EXTI_HANDLE_LINE(15); +#ifdef PIOS_INCLUDE_FREERTOS + portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); +#endif } void EXTI15_10_IRQHandler(void) __attribute__ ((alias ("PIOS_EXTI_15_10_irq_handler"))); diff --git a/flight/PiOS/inc/pios_bma180.h b/flight/PiOS/inc/pios_bma180.h index ef9627f00..51e65a6ec 100644 --- a/flight/PiOS/inc/pios_bma180.h +++ b/flight/PiOS/inc/pios_bma180.h @@ -103,7 +103,7 @@ extern float PIOS_BMA180_GetScale(); extern int32_t PIOS_BMA180_ReadFifo(struct pios_bma180_data * buffer); extern int32_t PIOS_BMA180_ReadAccels(struct pios_bma180_data * data); extern int32_t PIOS_BMA180_Test(); -extern void PIOS_BMA180_IRQHandler(); +extern bool PIOS_BMA180_IRQHandler(); #endif /* PIOS_BMA180_H */ diff --git a/flight/PiOS/inc/pios_exti.h b/flight/PiOS/inc/pios_exti.h index 73a3bb556..4b1203aa2 100644 --- a/flight/PiOS/inc/pios_exti.h +++ b/flight/PiOS/inc/pios_exti.h @@ -36,7 +36,7 @@ #include struct pios_exti_cfg { - void (* vector)(void); + bool (* vector)(void); uint32_t line; /* use EXTI_LineN macros */ struct stm32_gpio pin; struct stm32_irq irq; diff --git a/flight/PiOS/inc/pios_hmc5883.h b/flight/PiOS/inc/pios_hmc5883.h index 037dca788..d9c362e9d 100644 --- a/flight/PiOS/inc/pios_hmc5883.h +++ b/flight/PiOS/inc/pios_hmc5883.h @@ -107,7 +107,7 @@ extern bool PIOS_HMC5883_NewDataAvailable(void); extern int32_t PIOS_HMC5883_ReadMag(int16_t out[3]); extern uint8_t PIOS_HMC5883_ReadID(uint8_t out[4]); extern int32_t PIOS_HMC5883_Test(void); -extern void PIOS_HMC5883_IRQHandler(); +bool void PIOS_HMC5883_IRQHandler(); #endif /* PIOS_HMC5883_H */ /** diff --git a/flight/PiOS/inc/pios_l3gd20.h b/flight/PiOS/inc/pios_l3gd20.h index 83b2070b6..3a2e896fd 100644 --- a/flight/PiOS/inc/pios_l3gd20.h +++ b/flight/PiOS/inc/pios_l3gd20.h @@ -141,7 +141,7 @@ extern int32_t PIOS_L3GD20_SetRange(enum pios_l3gd20_range range); extern float PIOS_L3GD20_GetScale(); extern int32_t PIOS_L3GD20_ReadID(); extern uint8_t PIOS_L3GD20_Test(); -extern void PIOS_L3GD20_IRQHandler(); +bool void PIOS_L3GD20_IRQHandler(); #endif /* PIOS_L3GD20_H */ diff --git a/flight/PiOS/inc/pios_mpu6000.h b/flight/PiOS/inc/pios_mpu6000.h index 2a301bc4c..2c9f0f8bb 100644 --- a/flight/PiOS/inc/pios_mpu6000.h +++ b/flight/PiOS/inc/pios_mpu6000.h @@ -156,7 +156,7 @@ extern int32_t PIOS_MPU6000_ReadID(); extern uint8_t PIOS_MPU6000_Test(); extern float PIOS_MPU6000_GetScale(); extern float PIOS_MPU6000_GetAccelScale(); -extern void PIOS_MPU6000_IRQHandler(void); +extern bool PIOS_MPU6000_IRQHandler(void); #endif /* PIOS_MPU6000_H */ From f532f3cda58be755d6da2bc8cf80203929b6e61e Mon Sep 17 00:00:00 2001 From: Laura Sebesta Date: Thu, 27 Sep 2012 11:45:59 +0200 Subject: [PATCH 3/9] Rewrote uavobjectutilmanager.cpp, such that upon UAVO changes it returns com Updated homelocationutil to remove references to ECEF and RNE. --- .../src/libs/utils/homelocationutil.cpp | 52 +-- .../src/libs/utils/homelocationutil.h | 2 +- .../src/plugins/opmap/opmapgadgetwidget.cpp | 2 +- .../uavobjectutil/uavobjectutilmanager.cpp | 379 +++++++----------- .../uavobjectutil/uavobjectutilmanager.h | 22 +- 5 files changed, 187 insertions(+), 270 deletions(-) diff --git a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp index 18b1fd9af..4700bdb5c 100644 --- a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp +++ b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp @@ -38,40 +38,40 @@ namespace Utils { - HomeLocationUtil::HomeLocationUtil() +HomeLocationUtil::HomeLocationUtil() +{ + // Initialize(); +} + +/* + /*Get world magnetic model + * input params: LLA + * output params: Be + */ + int HomeLocationUtil::getDetails(double LLA[3], double Be[3]) { -// Initialize(); - } + // ************* + // check input parms - // input params: LLA - // - // output params: ECEF, RNE and Be - int HomeLocationUtil::getDetails(double LLA[3], double ECEF[3], double RNE[9], double Be[3]) - { - // ************* - // check input parms + double latitude = LLA[0]; + double longitude = LLA[1]; + double altitude = LLA[2]; - double latitude = LLA[0]; - double longitude = LLA[1]; - double altitude = LLA[2]; + if (latitude != latitude) return -1; // prevent nan error + if (longitude != longitude) return -2; // prevent nan error + if (altitude != altitude) return -3; // prevent nan error - if (latitude != latitude) return -1; // prevent nan error - if (longitude != longitude) return -2; // prevent nan error - if (altitude != altitude) return -3; // prevent nan error + if (latitude < -90 || latitude > 90) return -4; // range checking + if (longitude < -180 || longitude > 180) return -5; // range checking - if (latitude < -90 || latitude > 90) return -4; // range checking - if (longitude < -180 || longitude > 180) return -5; // range checking + // ************* - // ************* + QDateTime dt = QDateTime::currentDateTime().toUTC(); - QDateTime dt = QDateTime::currentDateTime().toUTC(); + //Fetch world magnetic model + Q_ASSERT(WorldMagModel().GetMagVector(LLA, dt.date().month(), dt.date().day(), dt.date().year(), Be) >= 0); - CoordinateConversions().LLA2ECEF(LLA, ECEF); - CoordinateConversions().RneFromLLA(LLA, (double (*)[3])RNE); - if (WorldMagModel().GetMagVector(LLA, dt.date().month(), dt.date().day(), dt.date().year(), Be) < 0) - return -6; - - return 0; // OK + return 0; // OK } } diff --git a/ground/openpilotgcs/src/libs/utils/homelocationutil.h b/ground/openpilotgcs/src/libs/utils/homelocationutil.h index 6448c3e52..acfc43888 100644 --- a/ground/openpilotgcs/src/libs/utils/homelocationutil.h +++ b/ground/openpilotgcs/src/libs/utils/homelocationutil.h @@ -40,7 +40,7 @@ namespace Utils { public: HomeLocationUtil(); - int getDetails(double LLA[3], double ECEF[3], double RNE[9], double Be[3]); + int getDetails(double LLA[3], double Be[3]); private: diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp index 2d8e01506..9cb7a7cc6 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp @@ -46,7 +46,6 @@ #include "uavtalk/telemetrymanager.h" #include "uavobject.h" -#include "uavobjectmanager.h" #include "positionactual.h" #include "homelocation.h" @@ -590,6 +589,7 @@ void OPMapGadgetWidget::updatePosition() VelocityActual *velocityActualObj = VelocityActual::GetInstance(obm); Gyros *gyrosObj = Gyros::GetInstance(obm); + Q_ASSERT(attitudeActualObj); Q_ASSERT(positionActualObj); Q_ASSERT(velocityActualObj); Q_ASSERT(gyrosObj); diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index d68a87d59..70e766823 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -35,7 +35,10 @@ #include #include #include -#include + +#include "firmwareiapobj.h" +#include "homelocation.h" +#include "gpsposition.h" // ****************************** // constructor/destructor @@ -48,6 +51,18 @@ UAVObjectUtilManager::UAVObjectUtilManager() failureTimer.setSingleShot(true); failureTimer.setInterval(1000); connect(&failureTimer, SIGNAL(timeout()),this,SLOT(objectPersistenceOperationFailed())); + + pm = NULL; + obm = NULL; + obum = NULL; + + pm = ExtensionSystem::PluginManager::instance(); + if (pm) + { + obm = pm->getObject(); + obum = pm->getObject(); + } + } UAVObjectUtilManager::~UAVObjectUtilManager() @@ -67,10 +82,8 @@ UAVObjectUtilManager::~UAVObjectUtilManager() UAVObjectManager* UAVObjectUtilManager::getObjectManager() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager * objMngr = pm->getObject(); - Q_ASSERT(objMngr); - return objMngr; + Q_ASSERT(obm); + return obm; } @@ -233,16 +246,7 @@ FirmwareIAPObj::DataFields UAVObjectUtilManager::getFirmwareIap() { FirmwareIAPObj::DataFields dummy; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - Q_ASSERT(pm); - if (!pm) - return dummy; - UAVObjectManager *om = pm->getObject(); - Q_ASSERT(om); - if (!om) - return dummy; - - FirmwareIAPObj *firmwareIap = FirmwareIAPObj::GetInstance(om); + FirmwareIAPObj *firmwareIap = FirmwareIAPObj::GetInstance(obm); Q_ASSERT(firmwareIap); if (!firmwareIap) return dummy; @@ -306,121 +310,48 @@ QByteArray UAVObjectUtilManager::getBoardDescription() int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard) { - double ECEF[3]; - double RNE[9]; - double Be[3]; - UAVObjectField *field; + double Be[3]; - QMutexLocker locker(mutex); + Q_ASSERT (Utils::HomeLocationUtil().getDetails(LLA, Be) >= 0); - if (Utils::HomeLocationUtil().getDetails(LLA, ECEF, RNE, Be) < 0) - return -1; // error + // ****************** + // save the new settings - // ****************** - // save the new settings + HomeLocation *homeLocation = HomeLocation::GetInstance(obm); + Q_ASSERT(homeLocation != NULL); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -2; + HomeLocation::DataFields homeLocationData = homeLocation->getData(); + homeLocationData.Latitude = LLA[0] * 1e7; + homeLocationData.Longitude = LLA[1] * 1e7; + homeLocationData.Altitude = LLA[2] * 1e7; - UAVObjectManager *om = pm->getObject(); - if (!om) return -3; + homeLocationData.Be[0] = Be[0]; + homeLocationData.Be[1] = Be[1]; + homeLocationData.Be[2] = Be[2]; - UAVDataObject *obj = dynamic_cast(om->getObject(QString("HomeLocation"))); - if (!obj) return -4; + homeLocationData.Set = HomeLocation::SET_TRUE; - UAVObjectField *ECEF_field = obj->getField(QString("ECEF")); - if (!ECEF_field) return -5; + homeLocation->setData(homeLocationData); + homeLocation->updated(); - UAVObjectField *RNE_field = obj->getField(QString("RNE")); - if (!RNE_field) return -6; + if (save_to_sdcard) + saveObjectToSD(homeLocation); - UAVObjectField *Be_field = obj->getField(QString("Be")); - if (!Be_field) return -7; - - field = obj->getField("Latitude"); - if (!field) return -8; - field->setDouble(LLA[0] * 10e6); - - field = obj->getField("Longitude"); - if (!field) return -9; - field->setDouble(LLA[1] * 10e6); - - field = obj->getField("Altitude"); - if (!field) return -10; - field->setDouble(LLA[2]); - - for (int i = 0; i < 3; i++) - ECEF_field->setDouble(ECEF[i] * 100, i); - - for (int i = 0; i < 9; i++) - RNE_field->setDouble(RNE[i], i); - - for (int i = 0; i < 3; i++) - Be_field->setDouble(Be[i], i); - - field = obj->getField("Set"); - if (!field) return -11; - field->setValue("TRUE"); - - obj->updated(); - - // ****************** - // save the new setting to SD card - - if (save_to_sdcard) - saveObjectToSD(obj); - - // ****************** - // debug -/* - qDebug() << "setting HomeLocation UAV Object .. " << endl; - QString s; - s = " LAT:" + QString::number(LLA[0], 'f', 7) + " LON:" + QString::number(LLA[1], 'f', 7) + " ALT:" + QString::number(LLA[2], 'f', 1); - qDebug() << s << endl; - s = " ECEF "; for (int i = 0; i < 3; i++) s += " " + QString::number((int)(ECEF[i] * 100)); - qDebug() << s << endl; - s = " RNE "; for (int i = 0; i < 9; i++) s += " " + QString::number(RNE[i], 'f', 7); - qDebug() << s << endl; - s = " Be "; for (int i = 0; i < 3; i++) s += " " + QString::number(Be[i], 'f', 2); - qDebug() << s << endl; -*/ - // ****************** - - return 0; // OK + return 0; } int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3]) { - UAVObjectField *field; + HomeLocation *homeLocation = HomeLocation::GetInstance(obm); + Q_ASSERT(homeLocation != NULL); - QMutexLocker locker(mutex); + HomeLocation::DataFields homeLocationData = homeLocation->getData(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -1; + set = homeLocationData.Set; - UAVObjectManager *om = pm->getObject(); - if (!om) return -2; - - UAVDataObject *obj = dynamic_cast(om->getObject(QString("HomeLocation"))); - if (!obj) return -3; - -// obj->requestUpdate(); - - field = obj->getField("Set"); - if (!field) return -4; - set = field->getValue().toBool(); - - field = obj->getField("Latitude"); - if (!field) return -5; - LLA[0] = field->getDouble() * 1e-7; - - field = obj->getField("Longitude"); - if (!field) return -6; - LLA[1] = field->getDouble() * 1e-7; - - field = obj->getField("Altitude"); - if (!field) return -7; - LLA[2] = field->getDouble(); + LLA[0] = homeLocationData.Latitude; + LLA[1] = homeLocationData.Longitude; + LLA[2] = homeLocationData.Altitude; if (LLA[0] != LLA[0]) LLA[0] = 0; // nan detection else @@ -439,88 +370,70 @@ int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3]) return 0; // OK } -int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3], double ECEF[3], double RNE[9], double Be[3]) -{ - UAVObjectField *field; +//int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3], double ECEF[3], double RNE[9], double Be[3]) +//{ +// UAVObjectField *field; - QMutexLocker locker(mutex); +// QMutexLocker locker(mutex); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -1; +//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); +//// if (!pm) return -1; - UAVObjectManager *om = pm->getObject(); - if (!om) return -2; +// UAVObjectManager *om = pm->getObject(); +// if (!om) return -2; - UAVDataObject *obj = dynamic_cast(om->getObject(QString("HomeLocation"))); - if (!obj) return -3; +// UAVDataObject *obj = dynamic_cast(om->getObject(QString("HomeLocation"))); +// if (!obj) return -3; -// obj->requestUpdate(); +//// obj->requestUpdate(); - field = obj->getField("Set"); - if (!field) return -4; - set = field->getValue().toBool(); +// field = obj->getField("Set"); +// if (!field) return -4; +// set = field->getValue().toBool(); - field = obj->getField("Latitude"); - if (!field) return -5; - LLA[0] = field->getDouble() * 1e-7; +// field = obj->getField("Latitude"); +// if (!field) return -5; +// LLA[0] = field->getDouble() * 1e-7; - field = obj->getField("Longitude"); - if (!field) return -6; - LLA[1] = field->getDouble() * 1e-7; +// field = obj->getField("Longitude"); +// if (!field) return -6; +// LLA[1] = field->getDouble() * 1e-7; - field = obj->getField("Altitude"); - if (!field) return -7; - LLA[2] = field->getDouble(); +// field = obj->getField("Altitude"); +// if (!field) return -7; +// LLA[2] = field->getDouble(); - field = obj->getField(QString("ECEF")); - if (!field) return -8; - for (int i = 0; i < 3; i++) - ECEF[i] = field->getDouble(i); +// field = obj->getField(QString("ECEF")); +// if (!field) return -8; +// for (int i = 0; i < 3; i++) +// ECEF[i] = field->getDouble(i); - field = obj->getField(QString("RNE")); - if (!field) return -9; - for (int i = 0; i < 9; i++) - RNE[i] = field->getDouble(i); +// field = obj->getField(QString("RNE")); +// if (!field) return -9; +// for (int i = 0; i < 9; i++) +// RNE[i] = field->getDouble(i); - field = obj->getField(QString("Be")); - if (!field) return -10; - for (int i = 0; i < 3; i++) - Be[i] = field->getDouble(i); +// field = obj->getField(QString("Be")); +// if (!field) return -10; +// for (int i = 0; i < 3; i++) +// Be[i] = field->getDouble(i); - return 0; // OK -} +// return 0; // OK +//} // ****************************** // GPS int UAVObjectUtilManager::getGPSPosition(double LLA[3]) { - UAVObjectField *field; + GPSPosition *gpsPosition = GPSPosition::GetInstance(obm); + Q_ASSERT(gpsPosition != NULL); - QMutexLocker locker(mutex); + GPSPosition::DataFields gpsPositionData = gpsPosition->getData(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -1; - - UAVObjectManager *om = pm->getObject(); - if (!om) return -2; - - UAVDataObject *obj = dynamic_cast(om->getObject(QString("GPSPosition"))); - if (!obj) return -3; - -// obj->requestUpdate(); - - field = obj->getField(QString("Latitude")); - if (!field) return -4; - LLA[0] = field->getDouble() * 1e-7; - - field = obj->getField(QString("Longitude")); - if (!field) return -5; - LLA[1] = field->getDouble() * 1e-7; - - field = obj->getField(QString("Altitude")); - if (!field) return -6; - LLA[2] = field->getDouble(); + LLA[0] = gpsPositionData.Latitude; + LLA[1] = gpsPositionData.Longitude; + LLA[2] = gpsPositionData.Altitude; if (LLA[0] != LLA[0]) LLA[0] = 0; // nan detection else @@ -539,93 +452,93 @@ int UAVObjectUtilManager::getGPSPosition(double LLA[3]) return 0; // OK } -// ****************************** -// telemetry port +//// ****************************** +//// telemetry port -int UAVObjectUtilManager::setTelemetrySerialPortSpeed(QString speed, bool save_to_sdcard) -{ - UAVObjectField *field; +//int UAVObjectUtilManager::setTelemetrySerialPortSpeed(QString speed, bool save_to_sdcard) +//{ +// UAVObjectField *field; - QMutexLocker locker(mutex); +// QMutexLocker locker(mutex); - // ****************** - // save the new settings +// // ****************** +// // save the new settings - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -1; +//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); +//// if (!pm) return -1; - UAVObjectManager *om = pm->getObject(); - if (!om) return -2; +// UAVObjectManager *om = pm->getObject(); +// if (!om) return -2; - UAVDataObject *obj = dynamic_cast(om->getObject(QString("/*TelemetrySettings*/"))); - if (!obj) return -3; +// UAVDataObject *obj = dynamic_cast(om->getObject(QString("/*TelemetrySettings*/"))); +// if (!obj) return -3; - field = obj->getField(QString("Speed")); - if (!field) return -4; - field->setValue(speed); +// field = obj->getField(QString("Speed")); +// if (!field) return -4; +// field->setValue(speed); - obj->updated(); +// obj->updated(); - // ****************** - // save the new setting to SD card +// // ****************** +// // save the new setting to SD card - if (save_to_sdcard) - saveObjectToSD(obj); +// if (save_to_sdcard) +// saveObjectToSD(obj); - // ****************** +// // ****************** - return 0; // OK -} +// return 0; // OK +//} -int UAVObjectUtilManager::getTelemetrySerialPortSpeed(QString &speed) -{ - UAVObjectField *field; +//int UAVObjectUtilManager::getTelemetrySerialPortSpeed(QString &speed) +//{ +// UAVObjectField *field; - QMutexLocker locker(mutex); +// QMutexLocker locker(mutex); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -1; +//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); +//// if (!pm) return -1; - UAVObjectManager *om = pm->getObject(); - if (!om) return -2; +// UAVObjectManager *om = pm->getObject(); +// if (!om) return -2; - UAVDataObject *obj = dynamic_cast(om->getObject(QString("TelemetrySettings"))); - if (!obj) return -3; +// UAVDataObject *obj = dynamic_cast(om->getObject(QString("TelemetrySettings"))); +// if (!obj) return -3; -// obj->requestUpdate(); +//// obj->requestUpdate(); - field = obj->getField(QString("Speed")); - if (!field) return -4; - speed = field->getValue().toString(); +// field = obj->getField(QString("Speed")); +// if (!field) return -4; +// speed = field->getValue().toString(); - return 0; // OK -} +// return 0; // OK +//} -int UAVObjectUtilManager::getTelemetrySerialPortSpeeds(QComboBox *comboBox) -{ - UAVObjectField *field; +//int UAVObjectUtilManager::getTelemetrySerialPortSpeeds(QComboBox *comboBox) +//{ +// UAVObjectField *field; - QMutexLocker locker(mutex); +// QMutexLocker locker(mutex); - if (!comboBox) return -1; +// if (!comboBox) return -1; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return -2; +//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); +//// if (!pm) return -2; - UAVObjectManager *om = pm->getObject(); - if (!om) return -3; +// UAVObjectManager *om = pm->getObject(); +// if (!om) return -3; - UAVDataObject *obj = dynamic_cast(om->getObject(QString("TelemetrySettings"))); - if (!obj) return -4; +// UAVDataObject *obj = dynamic_cast(om->getObject(QString("TelemetrySettings"))); +// if (!obj) return -4; -// obj->requestUpdate(); +//// obj->requestUpdate(); - field = obj->getField(QString("Speed")); - if (!field) return -5; - comboBox->addItems(field->getOptions()); +// field = obj->getField(QString("Speed")); +// if (!field) return -5; +// comboBox->addItems(field->getOptions()); - return 0; // OK -} +// return 0; // OK +//} deviceDescriptorStruct UAVObjectUtilManager::getBoardDescriptionStruct() { diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h index 11f5f0979..1a4147f94 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h @@ -55,13 +55,13 @@ public: int setHomeLocation(double LLA[3], bool save_to_sdcard); int getHomeLocation(bool &set, double LLA[3]); - int getHomeLocation(bool &set, double LLA[3], double ECEF[3], double RNE[9], double Be[3]); +// int getHomeLocation(bool &set, double LLA[3], double ECEF[3], double RNE[9], double Be[3]); int getGPSPosition(double LLA[3]); - int setTelemetrySerialPortSpeed(QString speed, bool save_to_sdcard); - int getTelemetrySerialPortSpeed(QString &speed); - int getTelemetrySerialPortSpeeds(QComboBox *comboBox); +// int setTelemetrySerialPortSpeed(QString speed, bool save_to_sdcard); +// int getTelemetrySerialPortSpeed(QString &speed); +// int getTelemetrySerialPortSpeeds(QComboBox *comboBox); int getBoardModel(); QByteArray getBoardCPUSerial(); @@ -78,11 +78,15 @@ signals: void saveCompleted(int objectID, bool status); private: - QMutex *mutex; - QQueue queue; - enum {IDLE, AWAITING_ACK, AWAITING_COMPLETED} saveState; - void saveNextObject(); - QTimer failureTimer; + QMutex *mutex; + QQueue queue; + enum {IDLE, AWAITING_ACK, AWAITING_COMPLETED} saveState; + void saveNextObject(); + QTimer failureTimer; + + ExtensionSystem::PluginManager *pm; + UAVObjectManager *obm; + UAVObjectUtilManager *obum; private slots: //void transactionCompleted(UAVObject *obj, bool success); From 9ec05d89284f0ab3b11a1cae0cf31b6742e1ea59 Mon Sep 17 00:00:00 2001 From: Laura Sebesta Date: Thu, 27 Sep 2012 14:42:57 +0200 Subject: [PATCH 4/9] Added dialog to request altitude when settings HomeLocation via the map. Fixed bug in setHomeLocation, by which altitude was scaled inappropriately. --- .../src/libs/utils/homelocationutil.cpp | 2 +- .../src/plugins/opmap/opmapgadgetwidget.cpp | 18 +++++++++++++----- .../uavobjectutil/uavobjectutilmanager.cpp | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp index 4700bdb5c..0b2f4954d 100644 --- a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp +++ b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp @@ -44,7 +44,7 @@ HomeLocationUtil::HomeLocationUtil() } /* - /*Get world magnetic model + /*Get local magnetic field * input params: LLA * output params: Be */ diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp index 9cb7a7cc6..19a2a0426 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp @@ -919,7 +919,7 @@ void OPMapGadgetWidget::setHome(QPointF pos) /** Sets the home position on the map widget */ -void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon,double altitude) +void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon, double altitude) { if (!m_widget || !m_map) return; @@ -941,13 +941,13 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon,double altitu if (longitude > 180) longitude = 180; else if (longitude < -180) longitude = -180; - else if(altitude != altitude) altitude=0; // ********* - m_home_position.coord = internals::PointLatLng(latitude, longitude); + m_home_position.coord = internals::PointLatLng(latitude, longitude); + m_home_position.altitude = altitude; - m_map->Home->SetCoord(m_home_position.coord); + m_map->Home->SetCoord(m_home_position.coord); m_map->Home->SetAltitude(altitude); m_map->Home->RefreshPos(); @@ -1659,7 +1659,15 @@ void OPMapGadgetWidget::onSetHomeAct_triggered() if (!m_widget || !m_map) return; - setHome(m_context_menu_lat_lon,0); + float altitude=0; + bool ok; + + //Get desired HomeLocation altitude from dialog box. + //TODO: Populate box with altitude already in HomeLocation UAVO + altitude = QInputDialog::getDouble(this, tr("Set home altitude"), + tr("In [m], referenced to WGS84:"), altitude, -100, 100000, 2, &ok); + + setHome(m_context_menu_lat_lon, altitude); setHomeLocationObject(); // update the HomeLocation UAVObject } diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 70e766823..63bf6e8d4 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -323,7 +323,7 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard) HomeLocation::DataFields homeLocationData = homeLocation->getData(); homeLocationData.Latitude = LLA[0] * 1e7; homeLocationData.Longitude = LLA[1] * 1e7; - homeLocationData.Altitude = LLA[2] * 1e7; + homeLocationData.Altitude = LLA[2]; homeLocationData.Be[0] = Be[0]; homeLocationData.Be[1] = Be[1]; From 09b898088141ba74a51d73ff7bf7fc99c97a9e51 Mon Sep 17 00:00:00 2001 From: Laura Sebesta Date: Thu, 27 Sep 2012 18:06:48 +0200 Subject: [PATCH 5/9] Fixed copy-pasta error. --- .../src/plugins/uavobjectutil/uavobjectutilmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 63bf6e8d4..5914c9207 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -349,8 +349,8 @@ int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3]) set = homeLocationData.Set; - LLA[0] = homeLocationData.Latitude; - LLA[1] = homeLocationData.Longitude; + LLA[0] = homeLocationData.Latitude*1e-7; + LLA[1] = homeLocationData.Longitude*1e-7; LLA[2] = homeLocationData.Altitude; if (LLA[0] != LLA[0]) LLA[0] = 0; // nan detection From a899c87c56b3a18034d5be1295fbb93e80d0c185 Mon Sep 17 00:00:00 2001 From: Laura Sebesta Date: Thu, 27 Sep 2012 19:21:00 +0200 Subject: [PATCH 6/9] Remove superflous UAVO update call. Add documentation. Remove commented code. --- .../src/libs/utils/homelocationutil.cpp | 9 +- .../uavobjectutil/uavobjectutilmanager.cpp | 141 +----------------- .../uavobjectutil/uavobjectutilmanager.h | 5 - 3 files changed, 6 insertions(+), 149 deletions(-) diff --git a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp index 0b2f4954d..448830573 100644 --- a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp +++ b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp @@ -40,13 +40,14 @@ namespace Utils { HomeLocationUtil::HomeLocationUtil() { - // Initialize(); } /* - /*Get local magnetic field - * input params: LLA - * output params: Be + /** + * @brief Get local magnetic field + * @param[in] LLA The longitude-latitude-altitude coordinate to compute the magnetic field at + * @param[out] Be The resulting magnetic field at that location and time in [mGau](?) + * @returns 0 if successful, -1 otherwise. */ int HomeLocationUtil::getDetails(double LLA[3], double Be[3]) { diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 5914c9207..bacadeb73 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -120,7 +120,7 @@ void UAVObjectUtilManager::saveNextObject() // Get next object from the queue UAVObject* obj = queue.head(); - qDebug() << "Request board to save object " << obj->getName(); + qDebug() << "Send save object request to board " << obj->getName(); ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) ); connect(objper, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); @@ -332,7 +332,6 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard) homeLocationData.Set = HomeLocation::SET_TRUE; homeLocation->setData(homeLocationData); - homeLocation->updated(); if (save_to_sdcard) saveObjectToSD(homeLocation); @@ -370,56 +369,6 @@ int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3]) return 0; // OK } -//int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3], double ECEF[3], double RNE[9], double Be[3]) -//{ -// UAVObjectField *field; - -// QMutexLocker locker(mutex); - -//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); -//// if (!pm) return -1; - -// UAVObjectManager *om = pm->getObject(); -// if (!om) return -2; - -// UAVDataObject *obj = dynamic_cast(om->getObject(QString("HomeLocation"))); -// if (!obj) return -3; - -//// obj->requestUpdate(); - -// field = obj->getField("Set"); -// if (!field) return -4; -// set = field->getValue().toBool(); - -// field = obj->getField("Latitude"); -// if (!field) return -5; -// LLA[0] = field->getDouble() * 1e-7; - -// field = obj->getField("Longitude"); -// if (!field) return -6; -// LLA[1] = field->getDouble() * 1e-7; - -// field = obj->getField("Altitude"); -// if (!field) return -7; -// LLA[2] = field->getDouble(); - -// field = obj->getField(QString("ECEF")); -// if (!field) return -8; -// for (int i = 0; i < 3; i++) -// ECEF[i] = field->getDouble(i); - -// field = obj->getField(QString("RNE")); -// if (!field) return -9; -// for (int i = 0; i < 9; i++) -// RNE[i] = field->getDouble(i); - -// field = obj->getField(QString("Be")); -// if (!field) return -10; -// for (int i = 0; i < 3; i++) -// Be[i] = field->getDouble(i); - -// return 0; // OK -//} // ****************************** // GPS @@ -452,94 +401,6 @@ int UAVObjectUtilManager::getGPSPosition(double LLA[3]) return 0; // OK } -//// ****************************** -//// telemetry port - -//int UAVObjectUtilManager::setTelemetrySerialPortSpeed(QString speed, bool save_to_sdcard) -//{ -// UAVObjectField *field; - -// QMutexLocker locker(mutex); - -// // ****************** -// // save the new settings - -//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); -//// if (!pm) return -1; - -// UAVObjectManager *om = pm->getObject(); -// if (!om) return -2; - -// UAVDataObject *obj = dynamic_cast(om->getObject(QString("/*TelemetrySettings*/"))); -// if (!obj) return -3; - -// field = obj->getField(QString("Speed")); -// if (!field) return -4; -// field->setValue(speed); - -// obj->updated(); - -// // ****************** -// // save the new setting to SD card - -// if (save_to_sdcard) -// saveObjectToSD(obj); - -// // ****************** - -// return 0; // OK -//} - -//int UAVObjectUtilManager::getTelemetrySerialPortSpeed(QString &speed) -//{ -// UAVObjectField *field; - -// QMutexLocker locker(mutex); - -//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); -//// if (!pm) return -1; - -// UAVObjectManager *om = pm->getObject(); -// if (!om) return -2; - -// UAVDataObject *obj = dynamic_cast(om->getObject(QString("TelemetrySettings"))); -// if (!obj) return -3; - -//// obj->requestUpdate(); - -// field = obj->getField(QString("Speed")); -// if (!field) return -4; -// speed = field->getValue().toString(); - -// return 0; // OK -//} - -//int UAVObjectUtilManager::getTelemetrySerialPortSpeeds(QComboBox *comboBox) -//{ -// UAVObjectField *field; - -// QMutexLocker locker(mutex); - -// if (!comboBox) return -1; - -//// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); -//// if (!pm) return -2; - -// UAVObjectManager *om = pm->getObject(); -// if (!om) return -3; - -// UAVDataObject *obj = dynamic_cast(om->getObject(QString("TelemetrySettings"))); -// if (!obj) return -4; - -//// obj->requestUpdate(); - -// field = obj->getField(QString("Speed")); -// if (!field) return -5; -// comboBox->addItems(field->getOptions()); - -// return 0; // OK -//} - deviceDescriptorStruct UAVObjectUtilManager::getBoardDescriptionStruct() { deviceDescriptorStruct ret; diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h index 1a4147f94..8ea9dc8f2 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h @@ -55,14 +55,9 @@ public: int setHomeLocation(double LLA[3], bool save_to_sdcard); int getHomeLocation(bool &set, double LLA[3]); -// int getHomeLocation(bool &set, double LLA[3], double ECEF[3], double RNE[9], double Be[3]); int getGPSPosition(double LLA[3]); -// int setTelemetrySerialPortSpeed(QString speed, bool save_to_sdcard); -// int getTelemetrySerialPortSpeed(QString &speed); -// int getTelemetrySerialPortSpeeds(QComboBox *comboBox); - int getBoardModel(); QByteArray getBoardCPUSerial(); quint32 getFirmwareCRC(); From 1721479a12470584c854c1245eff63e3c7376a34 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 27 Sep 2012 14:34:11 -0500 Subject: [PATCH 7/9] Fix for vinz' merge to pios_mpu6000 exti changes --- flight/PiOS/Common/pios_mpu6000.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/flight/PiOS/Common/pios_mpu6000.c b/flight/PiOS/Common/pios_mpu6000.c index 46bd3569e..ced67f4f5 100644 --- a/flight/PiOS/Common/pios_mpu6000.c +++ b/flight/PiOS/Common/pios_mpu6000.c @@ -400,21 +400,21 @@ uint32_t mpu6000_interval_us; uint32_t mpu6000_time_us; uint32_t mpu6000_transfer_size; -void PIOS_MPU6000_IRQHandler(void) +bool PIOS_MPU6000_IRQHandler(void) { static uint32_t timeval; mpu6000_interval_us = PIOS_DELAY_DiffuS(timeval); timeval = PIOS_DELAY_GetRaw(); if(!mpu6000_configured) - return; + return false; mpu6000_count = PIOS_MPU6000_FifoDepth(); if(mpu6000_count < sizeof(struct pios_mpu6000_data)) - return; + return false; if(PIOS_MPU6000_ClaimBus() != 0) - return; + return false; uint8_t mpu6000_send_buf[1+sizeof(struct pios_mpu6000_data)] = {PIOS_MPU6000_FIFO_REG | 0x80, 0, 0, 0, 0, 0, 0, 0, 0}; uint8_t mpu6000_rec_buf[1+sizeof(struct pios_mpu6000_data)]; @@ -422,7 +422,7 @@ void PIOS_MPU6000_IRQHandler(void) if(PIOS_SPI_TransferBlock(dev->spi_id, &mpu6000_send_buf[0], &mpu6000_rec_buf[0], sizeof(mpu6000_send_buf), NULL) < 0) { PIOS_MPU6000_ReleaseBus(); mpu6000_fails++; - return; + return false; } PIOS_MPU6000_ReleaseBus(); @@ -433,7 +433,7 @@ void PIOS_MPU6000_IRQHandler(void) if (mpu6000_count >= (sizeof(data) * 2)) { mpu6000_fifo_backup++; if(PIOS_MPU6000_ClaimBus() != 0) - return; + return false; uint8_t mpu6000_send_buf[1+sizeof(struct pios_mpu6000_data)] = {PIOS_MPU6000_FIFO_REG | 0x80, 0, 0, 0, 0, 0, 0, 0, 0}; uint8_t mpu6000_rec_buf[1+sizeof(struct pios_mpu6000_data)]; @@ -441,7 +441,7 @@ void PIOS_MPU6000_IRQHandler(void) if(PIOS_SPI_TransferBlock(dev->spi_id, &mpu6000_send_buf[0], &mpu6000_rec_buf[0], sizeof(mpu6000_send_buf), NULL) < 0) { PIOS_MPU6000_ReleaseBus(); mpu6000_fails++; - return; + return false; } PIOS_MPU6000_ReleaseBus(); From 1ba40ee9b068ad850f8044f6e3c14b95b81b11ec Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 27 Sep 2012 14:41:38 -0500 Subject: [PATCH 8/9] PIOS_EXTI: Make sure to use pdTRUE instead of true where appropriate. --- flight/PiOS/STM32F10x/pios_exti.c | 2 +- flight/PiOS/STM32F4xx/pios_exti.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_exti.c b/flight/PiOS/STM32F10x/pios_exti.c index 41d40f14b..b7b351a2f 100644 --- a/flight/PiOS/STM32F10x/pios_exti.c +++ b/flight/PiOS/STM32F10x/pios_exti.c @@ -169,7 +169,7 @@ static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) #define PIOS_EXTI_HANDLE_LINE(line) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ - xHigherPriorityTaskWoken |= PIOS_EXTI_generic_irq_handler(line); \ + xHigherPriorityTaskWoken = PIOS_EXTI_generic_irq_handler(line) ? pdTRUE : xHigherPriorityTaskWoken; \ } #else #define PIOS_EXTI_HANDLE_LINE(line) \ diff --git a/flight/PiOS/STM32F4xx/pios_exti.c b/flight/PiOS/STM32F4xx/pios_exti.c index 8259ce006..8ef53492c 100644 --- a/flight/PiOS/STM32F4xx/pios_exti.c +++ b/flight/PiOS/STM32F4xx/pios_exti.c @@ -171,7 +171,7 @@ static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) #define PIOS_EXTI_HANDLE_LINE(line) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ - xHigherPriorityTaskWoken |= PIOS_EXTI_generic_irq_handler(line); \ + xHigherPriorityTaskWoken = PIOS_EXTI_generic_irq_handler(line) ? pdTRUE : xHigherPriorityTaskWoken; \ } #else #define PIOS_EXTI_HANDLE_LINE(line) \ From 519e3e2e3a44e2ee6708775ab6701a01b5b2d970 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Fri, 28 Sep 2012 00:40:36 -0500 Subject: [PATCH 9/9] PIOS_EXTI: Make the line task macro now take in the xHigherTaskPriority variable name --- flight/PiOS/STM32F10x/pios_exti.c | 52 ++++++++++++++++++++----------- flight/PiOS/STM32F4xx/pios_exti.c | 52 ++++++++++++++++++++----------- 2 files changed, 66 insertions(+), 38 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_exti.c b/flight/PiOS/STM32F10x/pios_exti.c index b7b351a2f..9b8221bbe 100644 --- a/flight/PiOS/STM32F10x/pios_exti.c +++ b/flight/PiOS/STM32F10x/pios_exti.c @@ -166,13 +166,13 @@ static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) } #ifdef PIOS_INCLUDE_FREERTOS -#define PIOS_EXTI_HANDLE_LINE(line) \ +#define PIOS_EXTI_HANDLE_LINE(line, woken) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ - xHigherPriorityTaskWoken = PIOS_EXTI_generic_irq_handler(line) ? pdTRUE : xHigherPriorityTaskWoken; \ + woken = PIOS_EXTI_generic_irq_handler(line) ? pdTRUE : woken; \ } #else -#define PIOS_EXTI_HANDLE_LINE(line) \ +#define PIOS_EXTI_HANDLE_LINE(line, woken) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ PIOS_EXTI_generic_irq_handler(line); \ @@ -185,8 +185,10 @@ static void PIOS_EXTI_0_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(0); + PIOS_EXTI_HANDLE_LINE(0, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -197,8 +199,10 @@ static void PIOS_EXTI_1_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(1); + PIOS_EXTI_HANDLE_LINE(1, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -209,8 +213,10 @@ static void PIOS_EXTI_2_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(2); + PIOS_EXTI_HANDLE_LINE(2, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -221,8 +227,10 @@ static void PIOS_EXTI_3_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(3); + PIOS_EXTI_HANDLE_LINE(3, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -233,8 +241,10 @@ static void PIOS_EXTI_4_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(4); + PIOS_EXTI_HANDLE_LINE(4, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -245,12 +255,14 @@ static void PIOS_EXTI_9_5_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(5); - PIOS_EXTI_HANDLE_LINE(6); - PIOS_EXTI_HANDLE_LINE(7); - PIOS_EXTI_HANDLE_LINE(8); - PIOS_EXTI_HANDLE_LINE(9); + PIOS_EXTI_HANDLE_LINE(5, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(6, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(7, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(8, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(9, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -261,13 +273,15 @@ static void PIOS_EXTI_15_10_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; // dummy variable #endif - PIOS_EXTI_HANDLE_LINE(10); - PIOS_EXTI_HANDLE_LINE(11); - PIOS_EXTI_HANDLE_LINE(12); - PIOS_EXTI_HANDLE_LINE(13); - PIOS_EXTI_HANDLE_LINE(14); - PIOS_EXTI_HANDLE_LINE(15); + PIOS_EXTI_HANDLE_LINE(10, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(11, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(12, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(13, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(14, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(15, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif diff --git a/flight/PiOS/STM32F4xx/pios_exti.c b/flight/PiOS/STM32F4xx/pios_exti.c index 8ef53492c..45efb2ae5 100644 --- a/flight/PiOS/STM32F4xx/pios_exti.c +++ b/flight/PiOS/STM32F4xx/pios_exti.c @@ -168,13 +168,13 @@ static bool PIOS_EXTI_generic_irq_handler(uint8_t line_index) /* Bind Interrupt Handlers */ #ifdef PIOS_INCLUDE_FREERTOS -#define PIOS_EXTI_HANDLE_LINE(line) \ +#define PIOS_EXTI_HANDLE_LINE(line, woken) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ - xHigherPriorityTaskWoken = PIOS_EXTI_generic_irq_handler(line) ? pdTRUE : xHigherPriorityTaskWoken; \ + woken = PIOS_EXTI_generic_irq_handler(line) ? pdTRUE : woken; \ } #else -#define PIOS_EXTI_HANDLE_LINE(line) \ +#define PIOS_EXTI_HANDLE_LINE(line, woken) \ if (EXTI_GetITStatus(EXTI_Line##line) != RESET) { \ EXTI_ClearITPendingBit(EXTI_Line##line); \ PIOS_EXTI_generic_irq_handler(line); \ @@ -185,8 +185,10 @@ static void PIOS_EXTI_0_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(0); + PIOS_EXTI_HANDLE_LINE(0, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -197,8 +199,10 @@ static void PIOS_EXTI_1_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(1); + PIOS_EXTI_HANDLE_LINE(1, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -209,8 +213,10 @@ static void PIOS_EXTI_2_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(2); + PIOS_EXTI_HANDLE_LINE(2, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -221,8 +227,10 @@ static void PIOS_EXTI_3_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(3); + PIOS_EXTI_HANDLE_LINE(3, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -233,8 +241,10 @@ static void PIOS_EXTI_4_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(4); + PIOS_EXTI_HANDLE_LINE(4, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -245,12 +255,14 @@ static void PIOS_EXTI_9_5_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(5); - PIOS_EXTI_HANDLE_LINE(6); - PIOS_EXTI_HANDLE_LINE(7); - PIOS_EXTI_HANDLE_LINE(8); - PIOS_EXTI_HANDLE_LINE(9); + PIOS_EXTI_HANDLE_LINE(5, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(6, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(7, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(8, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(9, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif @@ -261,13 +273,15 @@ static void PIOS_EXTI_15_10_irq_handler (void) { #ifdef PIOS_INCLUDE_FREERTOS portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +#else + bool xHigherPriorityTaskWoken; #endif - PIOS_EXTI_HANDLE_LINE(10); - PIOS_EXTI_HANDLE_LINE(11); - PIOS_EXTI_HANDLE_LINE(12); - PIOS_EXTI_HANDLE_LINE(13); - PIOS_EXTI_HANDLE_LINE(14); - PIOS_EXTI_HANDLE_LINE(15); + PIOS_EXTI_HANDLE_LINE(10, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(11, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(12, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(13, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(14, xHigherPriorityTaskWoken); + PIOS_EXTI_HANDLE_LINE(15, xHigherPriorityTaskWoken); #ifdef PIOS_INCLUDE_FREERTOS portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); #endif