Skip to content
Snippets Groups Projects
Commit 1b7ca684 authored by Randy Mackay's avatar Randy Mackay
Browse files

Tracker: add read_radio

parent f4d45c9b
No related branches found
No related tags found
No related merge requests found
......@@ -182,8 +182,8 @@ SITL sitl;
/**
antenna control channels
*/
static RC_Channel channel_yaw(CH_1);
static RC_Channel channel_pitch(CH_2);
static RC_Channel channel_yaw(CH_YAW);
static RC_Channel channel_pitch(CH_PITCH);
////////////////////////////////////////////////////////////////////////////////
// GCS selection
......@@ -255,6 +255,7 @@ static struct {
*/
static const AP_Scheduler::Task scheduler_tasks[] PROGMEM = {
{ update_ahrs, 1, 1000 },
{ read_radio, 1, 200 },
{ update_tracking, 1, 1000 },
{ update_GPS, 5, 4000 },
{ update_compass, 5, 1500 },
......
......@@ -55,6 +55,17 @@
# define SERIAL2_BUFSIZE 256
#endif
//////////////////////////////////////////////////////////////////////////////
// RC Channel definitions
//
#ifndef CH_YAW
# define CH_YAW CH_1 // RC input/output for yaw on channel 1
#endif
#ifndef CH_PITCH
# define CH_PITCH CH_2 // RC input/output for pitch on channel 2
#endif
//////////////////////////////////////////////////////////////////////////////
// yaw and pitch axis angle range defaults
//
......
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
// Functions to read the RC radio input
static void read_radio()
{
if (hal.rcin->new_input()) {
channel_yaw.set_pwm(hal.rcin->read(CH_YAW));
channel_pitch.set_pwm(hal.rcin->read(CH_PITCH));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment