mirror of https://github.com/ArduPilot/ardupilot
Merge branch 'master' of https://code.google.com/p/ardupilot-mega
This commit is contained in:
commit
bca934b538
|
@ -87,14 +87,6 @@
|
|||
// Note channels are from 0!
|
||||
//
|
||||
// XXX these should be CH_n defines from RC.h at some point.
|
||||
#define CH_1 0
|
||||
#define CH_2 1
|
||||
#define CH_3 2
|
||||
#define CH_4 3
|
||||
#define CH_5 4
|
||||
#define CH_6 5
|
||||
#define CH_7 6
|
||||
#define CH_8 7
|
||||
#define CH_10 9 //PB5
|
||||
#define CH_11 10 //PE3
|
||||
|
||||
|
|
|
@ -398,9 +398,9 @@
|
|||
// also means that you should avoid switching out of MANUAL while you have
|
||||
// any control stick deflection.
|
||||
//
|
||||
// The default is to enable AUTO_TRIM.
|
||||
// The default is to disable AUTO_TRIM.
|
||||
//
|
||||
//#define AUTO_TRIM ENABLED
|
||||
//#define AUTO_TRIM DISABLED
|
||||
//
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -39,7 +39,6 @@ version 2.1 of the License, or (at your option) any later version.
|
|||
#include <AP_DCM.h> // ArduPilot Mega DCM Library
|
||||
#include <PID.h> // PID library
|
||||
#include <RC_Channel.h> // RC Channel Library
|
||||
//#include <RC_Channel/RC_Channel_aux.h> // Auxiliary RC Channel Library (Channels 5..8)
|
||||
#include <AP_RangeFinder.h> // Range finder library
|
||||
#include <ModeFilter.h>
|
||||
#include <AP_Camera.h> // Photo or video camera
|
||||
|
|
|
@ -274,14 +274,14 @@ static void set_servos(void)
|
|||
}
|
||||
g.channel_throttle.radio_out = g.channel_throttle.radio_in;
|
||||
g.channel_rudder.radio_out = g.channel_rudder.radio_in;
|
||||
if (g_rc_function[RC_Channel_aux::k_aileron] != NULL) g_rc_function[RC_Channel_aux::k_aileron]->radio_out = g_rc_function[RC_Channel_aux::k_aileron]->radio_in;
|
||||
G_RC_AUX(k_aileron)->radio_out = g_rc_function[RC_Channel_aux::k_aileron]->radio_in;
|
||||
|
||||
} else {
|
||||
if (g.mix_mode == 0) {
|
||||
g.channel_roll.calc_pwm();
|
||||
g.channel_pitch.calc_pwm();
|
||||
g.channel_rudder.calc_pwm();
|
||||
if (g_rc_function[RC_Channel_aux::k_aileron] != NULL) {
|
||||
if (g_rc_function[RC_Channel_aux::k_aileron]) {
|
||||
g_rc_function[RC_Channel_aux::k_aileron]->servo_out = g.channel_roll.servo_out;
|
||||
g_rc_function[RC_Channel_aux::k_aileron]->calc_pwm();
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ static void set_servos(void)
|
|||
}
|
||||
|
||||
if(control_mode <= FLY_BY_WIRE_B) {
|
||||
if (g_rc_function[RC_Channel_aux::k_flap_auto] != NULL) g_rc_function[RC_Channel_aux::k_flap_auto]->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_in;
|
||||
G_RC_AUX(k_flap_auto)->radio_out = g_rc_function[RC_Channel_aux::k_flap_auto]->radio_in;
|
||||
} else if (control_mode >= FLY_BY_WIRE_C) {
|
||||
if (g.airspeed_enabled == true) {
|
||||
flapSpeedSource = g.airspeed_cruise;
|
||||
|
@ -323,11 +323,11 @@ static void set_servos(void)
|
|||
flapSpeedSource = g.throttle_cruise;
|
||||
}
|
||||
if ( flapSpeedSource > g.flap_1_speed) {
|
||||
if (g_rc_function[RC_Channel_aux::k_flap_auto] != NULL) g_rc_function[RC_Channel_aux::k_flap_auto]->servo_out = 0;
|
||||
G_RC_AUX(k_flap_auto)->servo_out = 0;
|
||||
} else if (flapSpeedSource > g.flap_2_speed) {
|
||||
if (g_rc_function[RC_Channel_aux::k_flap_auto] != NULL) g_rc_function[RC_Channel_aux::k_flap_auto]->servo_out = g.flap_1_percent;
|
||||
G_RC_AUX(k_flap_auto)->servo_out = g.flap_1_percent;
|
||||
} else {
|
||||
if (g_rc_function[RC_Channel_aux::k_flap_auto] != NULL) g_rc_function[RC_Channel_aux::k_flap_auto]->servo_out = g.flap_2_percent;
|
||||
G_RC_AUX(k_flap_auto)->servo_out = g.flap_2_percent;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@
|
|||
// AUTO_TRIM
|
||||
//
|
||||
#ifndef AUTO_TRIM
|
||||
# define AUTO_TRIM ENABLED
|
||||
# define AUTO_TRIM DISABLED
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ static void init_rc_in()
|
|||
g.channel_throttle.dead_zone = 6;
|
||||
|
||||
//set auxiliary ranges
|
||||
update_aux_servo_function(&g.rc_5, &g.rc_6, &g.rc_7, &g.rc_8);
|
||||
G_RC_AUX(k_flap)->set_range(0,100);
|
||||
G_RC_AUX(k_flap_auto)->set_range(0,100);
|
||||
G_RC_AUX(k_aileron)->set_angle(SERVO_MAX);
|
||||
|
|
|
@ -259,7 +259,11 @@ SKETCHCPP_SRC := $(SKETCHPDE) $(sort $(filter-out $(SKETCHPDE),$(SKETCHPDESRCS)
|
|||
# make.
|
||||
#
|
||||
SEXPR = 's/^[[:space:]]*\#include[[:space:]][<\"]([^>\"./]+).*$$/\1/p'
|
||||
LIBTOKENS := $(sort $(shell cat $(SKETCHPDESRCS) $(SKETCHSRCS) | sed -nre $(SEXPR)))
|
||||
ifeq ($(SYSTYPE),Darwin)
|
||||
LIBTOKENS := $(sort $(shell cat $(SKETCHPDESRCS) $(SKETCHSRCS) | sed -nEe $(SEXPR)))
|
||||
else
|
||||
LIBTOKENS := $(sort $(shell cat $(SKETCHPDESRCS) $(SKETCHSRCS) | sed -nre $(SEXPR)))
|
||||
endif
|
||||
|
||||
#
|
||||
# Find sketchbook libraries referenced by the sketch.
|
||||
|
|
|
@ -21,6 +21,7 @@ RC_Channel_aux::closest_limit(int16_t angle)
|
|||
while (min >= 1800) min -= 3600;
|
||||
while (max < -1800) max += 3600;
|
||||
while (max >= 1800) max -= 3600;
|
||||
// This is done every time because the user might change the min, max values on the fly
|
||||
set_range(min, max);
|
||||
|
||||
// If the angle is outside servo limits, saturate the angle to the closest limit
|
||||
|
@ -44,6 +45,7 @@ RC_Channel_aux::closest_limit(int16_t angle)
|
|||
void
|
||||
RC_Channel_aux::output_ch(unsigned char ch_nr)
|
||||
{
|
||||
// take care or two corner cases
|
||||
switch(function)
|
||||
{
|
||||
case k_none: // disabled
|
||||
|
@ -52,26 +54,14 @@ RC_Channel_aux::output_ch(unsigned char ch_nr)
|
|||
case k_manual: // manual
|
||||
radio_out = radio_in;
|
||||
break;
|
||||
case k_flap: // flaps
|
||||
case k_flap_auto: // flaps automated
|
||||
case k_aileron: // aileron
|
||||
case k_flaperon: // flaperon (flaps and aileron combined, needs two independent servos one for each wing)
|
||||
case k_mount_yaw: // mount yaw (pan)
|
||||
case k_mount_pitch: // mount pitch (tilt)
|
||||
case k_mount_roll: // mount roll
|
||||
case k_cam_trigger: // camera trigger
|
||||
case k_cam_open: // camera open
|
||||
case k_egg_drop: // egg drop
|
||||
case k_nr_aux_servo_functions: // dummy, just to avoid a compiler warning
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
APM_RC.OutputCh(ch_nr, radio_out);
|
||||
}
|
||||
|
||||
// update the g_rc_function array from pointers to rc_x channels
|
||||
// This should be done periodically because the user might change the configuration and
|
||||
// Update the g_rc_function array of pointers to rc_x channels
|
||||
// This is to be done before rc_init so that the channels get correctly initialized.
|
||||
// It also should be called periodically because the user might change the configuration and
|
||||
// expects the changes to take effect instantly
|
||||
void update_aux_servo_function(RC_Channel_aux* rc_5, RC_Channel_aux* rc_6, RC_Channel_aux* rc_7, RC_Channel_aux* rc_8)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue