diff --git a/flight/OpenPilot/System/pios_board.c b/flight/OpenPilot/System/pios_board.c index 5c8ba05d0..16725c654 100644 --- a/flight/OpenPilot/System/pios_board.c +++ b/flight/OpenPilot/System/pios_board.c @@ -30,6 +30,7 @@ #include #include #include +#include "manualcontrolsettings.h" //#define I2C_DEBUG_PIN 0 //#define USART_GPS_DEBUG_PIN 1 @@ -1069,28 +1070,12 @@ void PIOS_Board_Init(void) { PIOS_ADC_Init(); PIOS_GPIO_Init(); -#if defined(PIOS_INCLUDE_SPEKTRUM) -#if (PIOS_SPEKTRUM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS) -#error More receiver inputs than available devices -#endif - /* SPEKTRUM init must come before comms */ - PIOS_SPEKTRUM_Init(&pios_spektrum_cfg, false); - - uint32_t pios_usart_spektrum_id; - if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) { - PIOS_Assert(0); - } - for (uint8_t i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) { - if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel], - &pios_spektrum_rcvr_driver, - i)) { - pios_rcvr_max_channel++; - } else { - PIOS_Assert(0); - } - } -#endif + /* Configure the selected receiver */ + uint8_t manualcontrolsettings_inputmode; + ManualControlSettingsInputModeGet(&manualcontrolsettings_inputmode); + switch (manualcontrolsettings_inputmode) { + case MANUALCONTROLSETTINGS_INPUTMODE_PWM: #if defined(PIOS_INCLUDE_PWM) #if (PIOS_PWM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS) #error More receiver inputs than available devices @@ -1105,7 +1090,9 @@ void PIOS_Board_Init(void) { PIOS_Assert(0); } } -#endif +#endif /* PIOS_INCLUDE_PWM */ + break; + case MANUALCONTROLSETTINGS_INPUTMODE_PPM: #if defined(PIOS_INCLUDE_PPM) #if (PIOS_PPM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS) #error More receiver inputs than available devices @@ -1120,7 +1107,39 @@ void PIOS_Board_Init(void) { PIOS_Assert(0); } } +#endif /* PIOS_INCLUDE_PPM */ + break; + case MANUALCONTROLSETTINGS_INPUTMODE_SPEKTRUM: +#if defined(PIOS_INCLUDE_SPEKTRUM) +#if (PIOS_SPEKTRUM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS) +#error More receiver inputs than available devices #endif + /* SPEKTRUM init must come before comms */ + PIOS_SPEKTRUM_Init(&pios_spektrum_cfg, false); + + uint32_t pios_usart_spektrum_id; + if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) { + PIOS_Assert(0); + } + for (uint8_t i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) { + if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel], + &pios_spektrum_rcvr_driver, + i)) { + pios_rcvr_max_channel++; + } else { + PIOS_Assert(0); + } + } +#endif + break; + case MANUALCONTROLSETTINGS_INPUTMODE_SBUS: +#if defined(PIOS_INCLUDE_SBUS) +#error SBUS NOT ON OP YET +#endif /* PIOS_INCLUDE_SBUS */ + break; + } + + #if defined(PIOS_INCLUDE_USB_HID) PIOS_USB_HID_Init(0); #if defined(PIOS_INCLUDE_COM) diff --git a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj index 4f2252237..3bb55fcb4 100644 --- a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj +++ b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj @@ -86,6 +86,7 @@ 6549E0D31279B3CF00C5476F /* fifo_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fifo_buffer.h; sourceTree = ""; }; 655268BC121FBD2900410C6E /* ahrscalibration.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ahrscalibration.xml; sourceTree = ""; }; 656268C612DC1923007B0A0F /* nedaccel.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = nedaccel.xml; sourceTree = ""; }; + 6562BE1713CCAD0600C823E8 /* pios_rcvr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_rcvr.c; sourceTree = ""; }; 65632DF51251650300469B77 /* pios_board.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_board.h; sourceTree = ""; }; 65632DF61251650300469B77 /* STM32103CB_AHRS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STM32103CB_AHRS.h; sourceTree = ""; }; 65632DF71251650300469B77 /* STM3210E_OP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STM3210E_OP.h; sourceTree = ""; }; @@ -7664,6 +7665,7 @@ 6528CCB412E406B800CF5144 /* pios_adxl345.c */, 6512D60712ED4CB8008175E5 /* pios_flash_w25x.c */, 65FF4D5E137EDEC100146BE4 /* pios_flashfs_objlist.c */, + 6562BE1713CCAD0600C823E8 /* pios_rcvr.c */, 65E8C743139A6D0900E1F979 /* pios_crc.c */, ); name = Common; @@ -8463,6 +8465,7 @@ }; buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "OpenPilotOSX" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, diff --git a/flight/Project/gdb/openpilot b/flight/Project/gdb/openpilot index 28ae59b1c..7c02a7a0b 100644 --- a/flight/Project/gdb/openpilot +++ b/flight/Project/gdb/openpilot @@ -1,7 +1,7 @@ define connect target remote localhost:3333 monitor cortex_m3 vector_catch all - file ./build/openpilot/OpenPilot.elf + file ./build/fw_openpilot/fw_openpilot.elf end #monitor reset halt