diff --git a/flight/Modules/GPS/GPS.c b/flight/Modules/GPS/GPS.c index bc8f92c17..d7b202346 100644 --- a/flight/Modules/GPS/GPS.c +++ b/flight/Modules/GPS/GPS.c @@ -140,7 +140,6 @@ int32_t GPSInitialize(void) #ifdef PIOS_GPS_SETS_HOMELOCATION HomeLocationInitialize(); #endif - HwSettingsInitialize(); updateSettings(); gps_rx_buffer = pvPortMalloc(NMEA_MAX_PACKET_LENGTH); diff --git a/flight/PiOS/Boards/STM32F4xx_Revolution.h b/flight/PiOS/Boards/STM32F4xx_Revolution.h index b55ca78c4..82f6f1cca 100644 --- a/flight/PiOS/Boards/STM32F4xx_Revolution.h +++ b/flight/PiOS/Boards/STM32F4xx_Revolution.h @@ -130,6 +130,7 @@ extern uint32_t pios_com_gps_id; extern uint32_t pios_com_aux_id; extern uint32_t pios_com_telem_usb_id; #define PIOS_COM_AUX (pios_com_aux_id) +#define PIOS_COM_GPS (pios_com_gps_id) #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id) #define PIOS_COM_DEBUG PIOS_COM_AUX diff --git a/flight/Revolution/Makefile b/flight/Revolution/Makefile index b123da092..a39ea9a4a 100644 --- a/flight/Revolution/Makefile +++ b/flight/Revolution/Makefile @@ -49,7 +49,7 @@ endif FLASH_TOOL = OPENOCD # List of modules to include -MODULES = Telemetry Attitude/revolution ManualControl Stabilization Altitude/revolution Actuator +MODULES = Telemetry Attitude/revolution ManualControl Stabilization Altitude/revolution Actuator GPS PYMODULES = #FlightPlan @@ -129,7 +129,7 @@ SRC += $(OPSYSTEM)/cm3_fault_handlers.c SRC += $(FLIGHTLIB)/CoordinateConversions.c SRC += $(FLIGHTLIB)/fifo_buffer.c -SRC += $(FLIGHTLIB)/NMEA.c +SRC += $(FLIGHTLIB)/WorldMagModel.c ## PIOS Hardware (STM32F4xx) include $(PIOS)/STM32F4xx/library.mk diff --git a/flight/Revolution/System/inc/pios_config.h b/flight/Revolution/System/inc/pios_config.h index a886bb9fa..5bcf04354 100644 --- a/flight/Revolution/System/inc/pios_config.h +++ b/flight/Revolution/System/inc/pios_config.h @@ -71,7 +71,7 @@ #define PIOS_INCLUDE_DSM //#define PIOS_INCLUDE_SBUS //#define PIOS_INCLUDE_PPM -//#define PIOS_INCLUDE_PWM +#define PIOS_INCLUDE_PWM //#define PIOS_INCLUDE_GCSRCVR #define PIOS_INCLUDE_SETTINGS @@ -82,11 +82,11 @@ /* Other Interfaces */ //#define PIOS_INCLUDE_I2C_ESC -/* Flags that alter behaviors */ +/* Flags that alter behaviors - mostly to lower resources for CC */ #define PIOS_INCLUDE_INITCALL /* Include init call structures */ #define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */ #define PIOS_QUATERNION_STABILIZATION /* Stabilization options */ -#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */ +//#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */ /* Alarm Thresholds */ #define HEAP_LIMIT_WARNING 4000 diff --git a/flight/Revolution/System/pios_board.c b/flight/Revolution/System/pios_board.c index d3e057d6a..0ab028e66 100644 --- a/flight/Revolution/System/pios_board.c +++ b/flight/Revolution/System/pios_board.c @@ -451,10 +451,7 @@ static const struct pios_usart_cfg pios_usart_gps_cfg = { }, }; -#define PIOS_COM_AUX_TX_BUF_LEN 150 -static uint8_t pios_com_aux_tx_buffer[PIOS_COM_AUX_TX_BUF_LEN]; -#define PIOS_COM_AUX_RX_BUF_LEN 10 -static uint8_t pios_com_aux_rx_buffer[PIOS_COM_AUX_RX_BUF_LEN]; +#define PIOS_COM_GPS_RX_BUF_LEN 192 #endif /* PIOS_INCLUDE_GPS */ @@ -504,11 +501,6 @@ static const struct pios_usart_cfg pios_usart_aux_cfg = { }, }; -#define PIOS_COM_GPS_TX_BUF_LEN 10 -static uint8_t pios_com_gps_tx_buffer[PIOS_COM_GPS_TX_BUF_LEN]; -#define PIOS_COM_GPS_RX_BUF_LEN 192 -static uint8_t pios_com_gps_rx_buffer[PIOS_COM_GPS_RX_BUF_LEN]; - #endif /* PIOS_COM_AUX */ #ifdef PIOS_INCLUDE_COM_TELEM @@ -569,8 +561,8 @@ static const struct pios_usart_cfg pios_usart_telem_main_cfg = { #include static const struct pios_usart_cfg pios_usart_dsm_main_cfg = { - .regs = USART1, - .remap = GPIO_AF_USART1, + .regs = USART3, + .remap = GPIO_AF_USART3, .init = { .USART_BaudRate = 115200, .USART_WordLength = USART_WordLength_8b, @@ -581,16 +573,16 @@ static const struct pios_usart_cfg pios_usart_dsm_main_cfg = { }, .irq = { .init = { - .NVIC_IRQChannel = USART1_IRQn, + .NVIC_IRQChannel = USART3_IRQn, .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, }, .rx = { - .gpio = GPIOA, + .gpio = GPIOB, .init = { - .GPIO_Pin = GPIO_Pin_10, + .GPIO_Pin = GPIO_Pin_11, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_Mode = GPIO_Mode_AF, .GPIO_OType = GPIO_OType_PP, @@ -598,9 +590,9 @@ static const struct pios_usart_cfg pios_usart_dsm_main_cfg = { }, }, .tx = { - .gpio = GPIOA, + .gpio = GPIOB, .init = { - .GPIO_Pin = GPIO_Pin_9, + .GPIO_Pin = GPIO_Pin_10, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_Mode = GPIO_Mode_AF, .GPIO_OType = GPIO_OType_PP, @@ -611,9 +603,9 @@ static const struct pios_usart_cfg pios_usart_dsm_main_cfg = { static const struct pios_dsm_cfg pios_dsm_main_cfg = { .bind = { - .gpio = GPIOA, + .gpio = GPIOB, .init = { - .GPIO_Pin = GPIO_Pin_10, + .GPIO_Pin = GPIO_Pin_11, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_OType = GPIO_OType_PP, @@ -1561,13 +1553,17 @@ void PIOS_Board_Init(void) { uint32_t pios_usart_gps_id; if (PIOS_USART_Init(&pios_usart_gps_id, &pios_usart_gps_cfg)) { - PIOS_DEBUG_Assert(0); + PIOS_Assert(0); } + + uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_RX_BUF_LEN); + PIOS_Assert(rx_buffer); if (PIOS_COM_Init(&pios_com_gps_id, &pios_usart_com_driver, pios_usart_gps_id, - pios_com_gps_rx_buffer, sizeof(pios_com_gps_rx_buffer), - pios_com_gps_tx_buffer, sizeof(pios_com_gps_tx_buffer))) { - PIOS_DEBUG_Assert(0); + rx_buffer, PIOS_COM_GPS_RX_BUF_LEN, + NULL, 0)) { + PIOS_Assert(0); } + #endif /* PIOS_INCLUDE_GPS */ #if defined(PIOS_INCLUDE_COM_AUX) @@ -1628,6 +1624,7 @@ void PIOS_Board_Init(void) { } pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_dsm_rcvr_id; +#if defined(PIOS_INCLUDE_PWM) && defined(PIOS_INCLUDE_RCVR) /* Set up the receiver port. Later this should be optional */ uint32_t pios_pwm_id; PIOS_PWM_Init(&pios_pwm_id, &pios_pwm_cfg); @@ -1637,6 +1634,7 @@ void PIOS_Board_Init(void) { PIOS_Assert(0); } pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PWM] = pios_pwm_rcvr_id; +#endif /* Set up the servo outputs */ PIOS_Servo_Init(&pios_servo_cfg);