diff --git a/ArduCopter/AP_Arming.cpp b/ArduCopter/AP_Arming.cpp index 4f4a599ede..7051293aa5 100644 --- a/ArduCopter/AP_Arming.cpp +++ b/ArduCopter/AP_Arming.cpp @@ -191,6 +191,7 @@ bool AP_Arming_Copter::board_voltage_checks(bool display_failure) { #if CONFIG_HAL_BOARD != HAL_BOARD_VRBRAIN #ifndef CONFIG_ARCH_BOARD_PX4FMU_V1 + #ifndef CONFIG_ARCH_BOARD_AEROFC_V1 // check board voltage if ((checks_to_perform == ARMING_CHECK_ALL) || (checks_to_perform & ARMING_CHECK_VOLTAGE)) { if (hal.analogin->board_voltage() < BOARD_VOLTAGE_MIN || hal.analogin->board_voltage() > BOARD_VOLTAGE_MAX) { @@ -202,6 +203,7 @@ bool AP_Arming_Copter::board_voltage_checks(bool display_failure) } #endif #endif + #endif Parameters &g = copter.g; diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 26e73b7ed9..79c96b5c9c 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -508,3 +508,11 @@ class px4_v4(px4): self.bootloader_name = 'px4fmuv4_bl.bin' self.board_name = 'px4fmu-v4' self.romfs_exclude(['oreoled.bin']) + +class aerofc_v1(px4): + name = 'aerofc-v1' + def __init__(self): + super(aerofc_v1, self).__init__() + self.bootloader_name = 'aerofcv1_bl.bin' + self.board_name = 'aerofc-v1' + self.romfs_exclude(['oreoled.bin']) diff --git a/Tools/ardupilotwaf/px4/cmake/configs/nuttx_aerofc-v1_apm.cmake b/Tools/ardupilotwaf/px4/cmake/configs/nuttx_aerofc-v1_apm.cmake new file mode 100644 index 0000000000..8e2529681a --- /dev/null +++ b/Tools/ardupilotwaf/px4/cmake/configs/nuttx_aerofc-v1_apm.cmake @@ -0,0 +1,11 @@ +include(configs/nuttx_px4fmu-common_apm) + +list(APPEND config_module_list + drivers/boards/aerofc-v1 + lib/rc +) + +list(REMOVE_ITEM config_module_list + drivers/stm32/adc + drivers/stm32/tone_alarm +) diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.cpp b/libraries/AP_BoardConfig/AP_BoardConfig.cpp index 5d5ed0b4cc..d641881741 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.cpp +++ b/libraries/AP_BoardConfig/AP_BoardConfig.cpp @@ -38,6 +38,11 @@ #elif defined(CONFIG_ARCH_BOARD_PX4FMU_V4) #define BOARD_PWM_COUNT_DEFAULT 6 #define BOARD_SER1_RTSCTS_DEFAULT 2 +#elif defined(CONFIG_ARCH_BOARD_AEROFC_V1) +#define BOARD_PWM_COUNT_DEFAULT 0 +#define BOARD_SER1_RTSCTS_DEFAULT 0 +# undef BOARD_SAFETY_ENABLE_DEFAULT +# define BOARD_SAFETY_ENABLE_DEFAULT 0 #else // V2 #define BOARD_PWM_COUNT_DEFAULT 4 #define BOARD_SER1_RTSCTS_DEFAULT 2 @@ -154,7 +159,7 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = { // @Param: TYPE // @DisplayName: Board type // @Description: This allows selection of a PX4 or VRBRAIN board type. If set to zero then the board type is auto-detected (PX4) - // @Values: 0:AUTO,1:PX4V1,2:Pixhawk,3:Pixhawk2,4:Pixracer,5:PixhawkMini,6:Pixhawk2Slim,7:VRBrain 5.1,8:VRBrain 5.2,9:VR Micro Brain 5.1,10:VR Micro Brain 5.2,11:VRBrain Core 1.0,12:VRBrain 5.4,20:AUAV2.1 + // @Values: 0:AUTO,1:PX4V1,2:Pixhawk,3:Pixhawk2,4:Pixracer,5:PixhawkMini,6:Pixhawk2Slim,7:VRBrain 5.1,8:VRBrain 5.2,9:VR Micro Brain 5.1,10:VR Micro Brain 5.2,11:VRBrain Core 1.0,12:VRBrain 5.4,13:Intel Aero FC,20:AUAV2.1 // @RebootRequired: True // @User: Advanced AP_GROUPINFO("TYPE", 9, AP_BoardConfig, px4.board_type, BOARD_TYPE_DEFAULT), diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.h b/libraries/AP_BoardConfig/AP_BoardConfig.h index b34160618e..880ddbdd87 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.h +++ b/libraries/AP_BoardConfig/AP_BoardConfig.h @@ -46,6 +46,7 @@ public: PX4_BOARD_PIXRACER = 4, PX4_BOARD_PHMINI = 5, PX4_BOARD_PH2SLIM = 6, + PX4_BOARD_AEROFC = 7, PX4_BOARD_AUAV21 = 20, PX4_BOARD_OLDDRIVERS = 100, #endif diff --git a/libraries/AP_BoardConfig/px4_drivers.cpp b/libraries/AP_BoardConfig/px4_drivers.cpp index 8f37be0e4a..e8ae00a5ea 100644 --- a/libraries/AP_BoardConfig/px4_drivers.cpp +++ b/libraries/AP_BoardConfig/px4_drivers.cpp @@ -402,6 +402,7 @@ void AP_BoardConfig::px4_setup_px4io(void) */ void AP_BoardConfig::px4_setup_peripherals(void) { +#ifndef CONFIG_ARCH_BOARD_AEROFC_V1 // always start adc if (px4_start_driver(adc_main, "adc", "start")) { hal.analogin->init(); @@ -409,13 +410,17 @@ void AP_BoardConfig::px4_setup_peripherals(void) } else { px4_sensor_error("no ADC found"); } +#endif -#ifndef CONFIG_ARCH_BOARD_PX4FMU_V4 +#if !defined(CONFIG_ARCH_BOARD_PX4FMU_V4) && \ + !defined(CONFIG_ARCH_BOARD_AEROFC_V1) px4_setup_px4io(); #endif -#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1 +#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1) const char *fmu_mode = "mode_serial"; +#elif defined(CONFIG_ARCH_BOARD_AEROFC_V1) + const char *fmu_mode = "mode_rcin"; #else const char *fmu_mode = "mode_pwm4"; #endif @@ -504,6 +509,9 @@ void AP_BoardConfig::px4_autodetect(void) // only one choice px4.board_type.set_and_notify(PX4_BOARD_PIXRACER); hal.console->printf("Detected Pixracer\n"); +#elif defined(CONFIG_ARCH_BOARD_AEROFC_V1) + px4.board_type.set_and_notify(PX4_BOARD_AEROFC); + hal.console->printf("Detected Aero FC\n"); #endif } diff --git a/libraries/AP_HAL/AP_HAL_Boards.h b/libraries/AP_HAL/AP_HAL_Boards.h index 2ff96201d0..f83736d089 100644 --- a/libraries/AP_HAL/AP_HAL_Boards.h +++ b/libraries/AP_HAL/AP_HAL_Boards.h @@ -43,6 +43,7 @@ #define HAL_BOARD_SUBTYPE_PX4_V2 2001 #define HAL_BOARD_SUBTYPE_PX4_V4 2002 #define HAL_BOARD_SUBTYPE_PX4_V3 2003 +#define HAL_BOARD_SUBTYPE_PX4_AEROFC_V1 2004 /* HAL VRBRAIN sub-types, starting at 4000 */ #define HAL_BOARD_SUBTYPE_VRBRAIN_V45 4000 diff --git a/libraries/AP_HAL/board/px4.h b/libraries/AP_HAL/board/px4.h index f645c8a323..044ef98b7a 100644 --- a/libraries/AP_HAL/board/px4.h +++ b/libraries/AP_HAL/board/px4.h @@ -31,6 +31,12 @@ #define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_V4 #define HAL_STORAGE_SIZE 16384 #define HAL_WITH_UAVCAN 1 +#elif defined(CONFIG_ARCH_BOARD_AEROFC_V1) +#define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_PX4_AEROFC_V1 +#define HAL_STORAGE_SIZE 16384 +#define USE_FLASH_STORAGE 1 +// we don't have any sdcard +#undef HAL_OS_POSIX_IO #else #error "Unknown PX4 board type" #endif diff --git a/libraries/AP_HAL_PX4/AnalogIn.cpp b/libraries/AP_HAL_PX4/AnalogIn.cpp index af0b1aee12..2d59e0cff3 100644 --- a/libraries/AP_HAL_PX4/AnalogIn.cpp +++ b/libraries/AP_HAL_PX4/AnalogIn.cpp @@ -58,9 +58,11 @@ static const struct { { 13, 3.3f/4096 }, // AUX ADC pin 4 { 14, 3.3f/4096 }, // AUX ADC pin 3 { 15, 6.6f/4096 }, // analog airspeed sensor, 2:1 scaling +#elif defined(CONFIG_ARCH_BOARD_AEROFC_V1) #else #error "Unknown board type for AnalogIn scaling" #endif + { 0, 0.f }, }; using namespace PX4; @@ -114,7 +116,7 @@ float PX4AnalogSource::read_latest() float PX4AnalogSource::_pin_scaler(void) { float scaling = PX4_VOLTAGE_SCALING; - uint8_t num_scalings = ARRAY_SIZE(pin_scaling); + uint8_t num_scalings = ARRAY_SIZE(pin_scaling) - 1; for (uint8_t i=0; iprintf("started pwm_input driver\n"); } diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_PX4_PWM.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_PX4_PWM.cpp index 0d376c92d7..718913a644 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_PX4_PWM.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_PX4_PWM.cpp @@ -85,7 +85,8 @@ AP_RangeFinder_PX4_PWM::~AP_RangeFinder_PX4_PWM() */ bool AP_RangeFinder_PX4_PWM::detect(RangeFinder &_ranger, uint8_t instance) { -#ifndef CONFIG_ARCH_BOARD_PX4FMU_V1 +#if !defined(CONFIG_ARCH_BOARD_PX4FMU_V1) && \ + !defined(CONFIG_ARCH_BOARD_AEROFC_V1) if (AP_BoardConfig::px4_start_driver(pwm_input_main, "pwm_input", "start")) { hal.console->printf("started pwm_input driver\n"); }