Skip to content

Commit

Permalink
[Spinal][H7_v2][Controller] Modified initialization method of control…
Browse files Browse the repository at this point in the history
…ler according to SERVO and DSHOT flag.
  • Loading branch information
sugihara-16 committed Nov 4, 2024
1 parent 4c87a51 commit 8eec6ad
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 8eec6ad

Please sign in to comment.