|
|
|
#include "Copter.h"
|
|
|
|
|
|
|
|
#ifdef USERHOOK_INIT
|
|
|
|
void Copter::userhook_init()
|
|
|
|
{
|
|
|
|
// put your initialisation code here
|
|
|
|
// this will be called once at start-up
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USERHOOK_FASTLOOP
|
|
|
|
void Copter::userhook_FastLoop()
|
|
|
|
{
|
|
|
|
// put your 100Hz code here
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USERHOOK_50HZLOOP
|
|
|
|
void Copter::userhook_50Hz()
|
|
|
|
{
|
|
|
|
// put your 50Hz code here
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USERHOOK_MEDIUMLOOP
|
|
|
|
void Copter::userhook_MediumLoop()
|
|
|
|
{
|
|
|
|
// put your 10Hz code here
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USERHOOK_SLOWLOOP
|
|
|
|
void Copter::userhook_SlowLoop()
|
|
|
|
{
|
|
|
|
// put your 3.3Hz code here
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USERHOOK_SUPERSLOWLOOP
|
|
|
|
void Copter::userhook_SuperSlowLoop()
|
|
|
|
{
|
|
|
|
// put your 1Hz code here
|
|
|
|
|
|
|
|
// static bool init_prx = false;
|
|
|
|
// if (init_prx == false ) {
|
|
|
|
// static uint32_t prx_init_time = AP_HAL::millis();
|
|
|
|
// uint32_t tnow = AP_HAL::millis();
|
|
|
|
// if(tnow - prx_init_time > 5000){
|
|
|
|
// init_prx = true;
|
|
|
|
// init_proximity();
|
|
|
|
// gcs().send_text(MAV_SEVERITY_INFO, "--- init prx:%ldms -> %ldms ---",prx_init_time,tnow);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USERHOOK_AUXSWITCH
|
|
|
|
void Copter::userhook_auxSwitch1(uint8_t ch_flag)
|
|
|
|
{
|
|
|
|
// put your aux switch #1 handler here (CHx_OPT = 47)
|
|
|
|
}
|
|
|
|
|
|
|
|
void Copter::userhook_auxSwitch2(uint8_t ch_flag)
|
|
|
|
{
|
|
|
|
// put your aux switch #2 handler here (CHx_OPT = 48)
|
|
|
|
}
|
|
|
|
|
|
|
|
void Copter::userhook_auxSwitch3(uint8_t ch_flag)
|
|
|
|
{
|
|
|
|
// put your aux switch #3 handler here (CHx_OPT = 49)
|
|
|
|
}
|
|
|
|
#endif
|