diff --git a/libraries/AP_HAL_Linux/CameraSensor_Mt9v117.cpp b/libraries/AP_HAL_Linux/CameraSensor_Mt9v117.cpp index 5f740a1f1c..492bcfa708 100644 --- a/libraries/AP_HAL_Linux/CameraSensor_Mt9v117.cpp +++ b/libraries/AP_HAL_Linux/CameraSensor_Mt9v117.cpp @@ -407,7 +407,7 @@ void CameraSensor_Mt9v117::_init_sensor() id = _read_reg16(CHIP_ID); if (id != MT9V117_CHIP_ID) { - AP_HAL::panic("Mt9v117: bad chip id\n"); + AP_HAL::panic("Mt9v117: bad chip id 0x%04x\n", id); } _soft_reset(); _apply_patch(); diff --git a/libraries/AP_HAL_Linux/GPIO.h b/libraries/AP_HAL_Linux/GPIO.h index 8aada38331..af7d91eb60 100644 --- a/libraries/AP_HAL_Linux/GPIO.h +++ b/libraries/AP_HAL_Linux/GPIO.h @@ -25,6 +25,6 @@ private: #include "GPIO_RPI.h" #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE #include "GPIO_Minnow.h" -#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO #include "GPIO_Bebop.h" #endif diff --git a/libraries/AP_HAL_Linux/GPIO_Bebop.cpp b/libraries/AP_HAL_Linux/GPIO_Bebop.cpp index 58f7cf6ca1..1e37eed753 100644 --- a/libraries/AP_HAL_Linux/GPIO_Bebop.cpp +++ b/libraries/AP_HAL_Linux/GPIO_Bebop.cpp @@ -2,7 +2,7 @@ #include "GPIO_Bebop.h" -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO const unsigned Linux::GPIO_Sysfs::pin_table[] = { [BEBOP_GPIO_CAMV_NRST] = 129, diff --git a/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp b/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp index 44ed9aa060..c515d5e04e 100644 --- a/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp +++ b/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp @@ -45,7 +45,7 @@ static UARTDriver uartFDriver(false); static I2CDeviceManager i2c_mgr_instance; -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO static I2CDriver i2cDriver0(0); static I2CDriver i2cDriver1(1); static I2CDriver i2cDriver2(2); @@ -113,7 +113,9 @@ static GPIO_BBB gpioDriver; CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BH || \ CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_PXFMINI static GPIO_RPI gpioDriver; -#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE || \ + CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || \ + CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO static GPIO_Sysfs gpioDriver; #else static Empty::GPIO gpioDriver; @@ -135,7 +137,8 @@ static RCInput_RPI rcinDriver; static RCInput_Raspilot rcinDriver; #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ZYNQ static RCInput_ZYNQ rcinDriver; -#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || \ + CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO static RCInput_UDP rcinDriver; #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE static RCInput_UART rcinDriver("/dev/ttyS2"); @@ -169,7 +172,8 @@ static RCOutput_PCA9685 rcoutDriver(i2c_mgr_instance.get_device(1, PCA9685_QUATE static RCOutput_Raspilot rcoutDriver; #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ZYNQ static RCOutput_ZYNQ rcoutDriver; -#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || \ + CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO static RCOutput_Bebop rcoutDriver(i2c_mgr_instance.get_device(HAL_RCOUT_BEBOP_BLDC_I2C_BUS, HAL_RCOUT_BEBOP_BLDC_I2C_ADDR)); #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE static RCOutput_PCA9685 rcoutDriver(i2c_mgr_instance.get_device(i2c_devpaths, PCA9685_PRIMARY_ADDRESS), false, 0, MINNOW_GPIO_S5_1); @@ -200,7 +204,7 @@ HAL_Linux::HAL_Linux() : &uartEDriver, &uartFDriver, &i2c_mgr_instance, -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO &i2cDriver0, &i2cDriver1, &i2cDriver2, @@ -330,7 +334,7 @@ void HAL_Linux::run(int argc, char* const argv[], Callbacks* callbacks) const scheduler->init(); gpio->init(); i2c->begin(); -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO i2c1->begin(); i2c2->begin(); #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE diff --git a/libraries/AP_HAL_Linux/Heat_Pwm.cpp b/libraries/AP_HAL_Linux/Heat_Pwm.cpp index d659b24611..fea17e208b 100644 --- a/libraries/AP_HAL_Linux/Heat_Pwm.cpp +++ b/libraries/AP_HAL_Linux/Heat_Pwm.cpp @@ -16,7 +16,7 @@ #include -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO #include #include #include diff --git a/libraries/AP_HAL_Linux/RCOutput_Bebop.cpp b/libraries/AP_HAL_Linux/RCOutput_Bebop.cpp index 948ef7216b..a3206150f3 100644 --- a/libraries/AP_HAL_Linux/RCOutput_Bebop.cpp +++ b/libraries/AP_HAL_Linux/RCOutput_Bebop.cpp @@ -1,6 +1,6 @@ #include -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO #include "RCOutput_Bebop.h" #include @@ -176,7 +176,7 @@ int RCOutput_Bebop::read_obs_data(BebopBLDC_ObsData &obs) _dev->get_semaphore()->give(); if (data.checksum != _checksum((uint8_t *)&data, sizeof(data) - 1)) { - hal.console->printf("RCOutput_Bebop: bad checksum in obs data"); + return -EBUSY; } /* fill obs class */ @@ -425,6 +425,8 @@ void RCOutput_Bebop::_run_rcout() _max_rpm = BEBOP_BLDC_MAX_RPM_1; } else if (hw_version == UTIL_HARDWARE_BEBOP2) { _max_rpm = BEBOP_BLDC_MAX_RPM_2; + } else if (hw_version == UTIL_HARDWARE_DISCO) { + _max_rpm = BEBOP_BLDC_MAX_RPM_2; } else if (hw_version < 0) { AP_HAL::panic("failed to get hw version %s", strerror(hw_version)); } else { diff --git a/libraries/AP_HAL_Linux/SPIDriver.cpp b/libraries/AP_HAL_Linux/SPIDriver.cpp index ac26aff137..9a4b81795a 100644 --- a/libraries/AP_HAL_Linux/SPIDriver.cpp +++ b/libraries/AP_HAL_Linux/SPIDriver.cpp @@ -75,7 +75,7 @@ SPIDeviceDriver SPIDeviceManager::_device[] = { SPIDeviceDriver("mpu9250", 0, 0, AP_HAL::SPIDevice_MPU9250, SPI_MODE_0, 8, RPI_GPIO_7, 1*MHZ, 20*MHZ), SPIDeviceDriver("ublox", 0, 0, AP_HAL::SPIDevice_Ublox, SPI_MODE_0, 8, RPI_GPIO_8, 250*KHZ, 5*MHZ), }; -#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO SPIDeviceDriver SPIDeviceManager::_device[] = { SPIDeviceDriver("bebop", 1, 0, AP_HAL::SPIDevice_Bebop, SPI_MODE_0, 8, SPI_CS_KERNEL, 320*KHZ, 320*KHZ), }; diff --git a/libraries/AP_HAL_Linux/Scheduler.cpp b/libraries/AP_HAL_Linux/Scheduler.cpp index f76b773905..d975c46298 100644 --- a/libraries/AP_HAL_Linux/Scheduler.cpp +++ b/libraries/AP_HAL_Linux/Scheduler.cpp @@ -185,7 +185,7 @@ void Scheduler::register_timer_process(AP_HAL::MemberProc proc) bool Scheduler::register_timer_process(AP_HAL::MemberProc proc, uint8_t freq_div) { -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO if (freq_div > 1) { return _register_timesliced_proc(proc, freq_div); } diff --git a/libraries/AP_HAL_Linux/Storage.cpp b/libraries/AP_HAL_Linux/Storage.cpp index fbf6f1fe82..04060e2669 100644 --- a/libraries/AP_HAL_Linux/Storage.cpp +++ b/libraries/AP_HAL_Linux/Storage.cpp @@ -20,7 +20,7 @@ using namespace Linux; // name the storage file after the sketch so you can use the same board // card for ArduCopter and ArduPlane -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP +#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO #define STORAGE_DIR "/data/ftp/internal_000/APM" #elif APM_BUILD_TYPE(APM_BUILD_Replay) #define STORAGE_DIR "." diff --git a/libraries/AP_HAL_Linux/Util.cpp b/libraries/AP_HAL_Linux/Util.cpp index 939528a281..bb35a2d635 100644 --- a/libraries/AP_HAL_Linux/Util.cpp +++ b/libraries/AP_HAL_Linux/Util.cpp @@ -178,6 +178,7 @@ const char *Linux::Util::_hw_names[UTIL_NUM_HARDWARES] = { [UTIL_HARDWARE_RPI2] = "BCM2709", [UTIL_HARDWARE_BEBOP] = "Mykonos3 board", [UTIL_HARDWARE_BEBOP2] = "Milos board", + [UTIL_HARDWARE_DISCO] = "Evinrude board", }; #define MAX_SIZE_LINE 50 diff --git a/libraries/AP_HAL_Linux/Util.h b/libraries/AP_HAL_Linux/Util.h index 4596bd9274..47bdb65c10 100644 --- a/libraries/AP_HAL_Linux/Util.h +++ b/libraries/AP_HAL_Linux/Util.h @@ -13,6 +13,7 @@ enum hw_type { UTIL_HARDWARE_RPI2, UTIL_HARDWARE_BEBOP, UTIL_HARDWARE_BEBOP2, + UTIL_HARDWARE_DISCO, UTIL_NUM_HARDWARES, };