#!/bin/sh
# PX4 commands need the 'px4-' prefix in bash.
# (px4-alias.sh is expected to be in the PATH)
. px4-alias.sh

uorb start

if [ -f eeprom/parameters ]
then
	param load
fi
param set CBRK_SUPPLY_CHK 894281
#param set SYS_AUTOSTART 4001
param set MAV_BROADCAST 1
param set MAV_TYPE 2

dataman start

load_mon start

battery_status start

# internal IMU
if ! icm42688p start -s -R 4
then
	# some boards has ICM42605 inside
	icm42605 start -s -R 4
fi
ist8310 start -I -a 15 -R 4
ms5611 start -I

# ADC
ads1115 start -I

# PWM
pca9685_pwm_out start
mixer load /dev/pwm_output0 etc/mixers/quad_x.main.mix

# external GPS & compass
gps start -d /dev/ttySC0 -i uart -p ubx -s
#hmc5883 start -X
#ist8310 start -X

rc_input start -d /dev/ttyAMA0

rc_update start
sensors start
commander start
navigator start
ekf2 start
land_detector start multicopter
mc_hover_thrust_estimator start
flight_mode_manager start
mc_pos_control start
mc_att_control start
mc_rate_control start

mavlink start -x -u 14556 -r 1000000

# Telem
mavlink start -x -Z -d /dev/ttySC1

logger start -t -b 200

mavlink boot_complete
