From 8eec6ade61e956f30e79dfe2450a6c09a72e05fe Mon Sep 17 00:00:00 2001 From: Junichiro Sugihara Date: Mon, 4 Nov 2024 14:36:51 +0900 Subject: [PATCH] [Spinal][H7_v2][Controller] Modified initialization method of controller according to SERVO and DSHOT flag. --- .../spinal/mcu_project/boards/stm32H7_v2/Src/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/aerial_robot_nerve/spinal/mcu_project/boards/stm32H7_v2/Src/main.c b/aerial_robot_nerve/spinal/mcu_project/boards/stm32H7_v2/Src/main.c index ed4058af6..f952ad0b7 100644 --- a/aerial_robot_nerve/spinal/mcu_project/boards/stm32H7_v2/Src/main.c +++ b/aerial_robot_nerve/spinal/mcu_project/boards/stm32H7_v2/Src/main.c @@ -266,23 +266,26 @@ int main(void) estimator_.init(&imu_, &baro_, &gps_, &nh_); // imu + baro + gps => att + alt + pos(xy) dshot_.init(DSHOT600, &htim1,TIM_CHANNEL_1, &htim1,TIM_CHANNEL_2, &htim1,TIM_CHANNEL_3, &htim1, TIM_CHANNEL_4); dshot_.initTelemetry(&huart6); - controller_.init(&htim1, &htim4, &estimator_, &dshot_, &battery_status_, &nh_, &flightControlMutexHandle); + /* controller_.init(&htim1, &htim4, &estimator_, &dshot_, &battery_status_, &nh_, &flightControlMutexHandle); */ #else battery_status_.init(&hadc1, &nh_); estimator_.init(&imu_, &baro_, &gps_, &nh_); // imu + baro + gps => att + alt + pos(xy) - controller_.init(&htim1, &htim4, &estimator_, NULL, &battery_status_, &nh_, &flightControlMutexHandle); + /* controller_.init(&htim1, &htim4, &estimator_, NULL, &battery_status_, &nh_, &flightControlMutexHandle); */ #endif FlashMemory::read(); //IMU and SERVO calib data (including IMU in neurons) -#if SERVO_FLAG +#if SERVO_FLAG && DSHOT servo_.init(&huart2, &nh_, NULL); controller_.init(&htim1, &htim4, &estimator_, &dshot_, &servo_, &battery_status_, &nh_, &flightControlMutexHandle); +#elif SERVO_FLAG && !DSHOT + servo_.init(&huart2, &nh_, NULL); + controller_.init(&htim1, &htim4, &estimator_, NULL, &servo_, &battery_status_, &nh_, &flightControlMutexHandle); #elif NERVE_COMM Spine::init(&hfdcan1, &nh_, &estimator_, LED1_GPIO_Port, LED1_Pin); Spine::useRTOS(&canMsgMailHandle); // use RTOS for CAN in spianl - controller_.init(&htim1, &htim4, &estimator_, &dshot_, NULL, &battery_status_, &nh_, &flightControlMutexHandle); + controller_.init(&htim1, &htim4, &estimator_, NULL, NULL, &battery_status_, &nh_, &flightControlMutexHandle); #else - controller_.init(&htim1, &htim4, &estimator_, &dshot_, NULL, &battery_status_, &nh_, &flightControlMutexHandle); + controller_.init(&htim1, &htim4, &estimator_, NULL, NULL, &battery_status_, &nh_, &flightControlMutexHandle); #endif /* USER CODE END 2 */