Commit Graph

8 Commits

Author SHA1 Message Date
Ricardo de Almeida Gonzaga 1fad971851 ArduPlane: Fix typos 2016-05-13 19:20:07 -03:00
skyscraper 7f29903287 ArduPlane: Fix up after refactoring RC_Channel class
Further to refactor of RC_Channel class which included
adding get_xx set_xx methods, change reads and writes to the public members
to calls to  get and set functionsss

old public member(int16_t)   get function -> int16_t     set function (int16_t)
(expression where c is an object of type RC_Channel)
c.radio_in                     c.get_radio_in()           c.set_radio_in(v)
c.control_in                   c.get_control_in()         c.set_control_in(v)
c.servo_out                    c.get_servo_out()          c.set_servo_out(v)
c.pwm_out                      c.get_pwm_out()            // use existing
c.radio_out                    c.get_radio_out()          c.set_radio_out(v)
c.radio_max                    c.get_radio_max()          c.set_radio_max(v)
c.radio_min                    c.get_radio_min()          c.set_radio_min(v)
c.radio_trim                   c.get_radio_trim()         c.set_radio_trim(v);

c.min_max_configured() // return true if min and max are configured

Because data members of RC_Channels are now private and so cannot be written directly
 some overloads are provided in the Plane classes to provide the old functionality

new overload Plane::stick_mix_channel(RC_Channel *channel)
which forwards to the previously existing
void stick_mix_channel(RC_Channel *channel, int16_t &servo_out);

new overload Plane::channel_output_mixer(Rc_Channel* , RC_Channel*)const
which forwards to
(uint8_t mixing_type, int16_t & chan1, int16_t & chan2)const;

Rename functions

 RC_Channel_aux::set_radio_trim(Aux_servo_function_t function)
    to RC_Channel_aux::set_trim_to_radio_in_for(Aux_servo_function_t function)

 RC_Channel_aux::set_servo_out(Aux_servo_function_t function, int16_t value)
    to RC_Channel_aux::set_servo_out_for(Aux_servo_function_t function, int16_t value)

 Rationale:

        RC_Channel is a complicated class, which combines
        several functionalities dealing with stick inputs
        in pwm and logical units, logical and actual actuator
        outputs, unit conversion etc, etc
        The intent of this PR is to clarify existing use of
        the class. At the basic level it should now be possible
        to grep all places where private variable is set by
        searching for the set_xx function.

        (The wider purpose is to provide a more generic and
        logically simpler method of output mixing. This is a small step)
2016-05-10 16:21:16 +10:00
Michael du Breuil bcc939930c Plane: Only resend the mixer configuration if its changed 2016-01-29 12:20:14 +11:00
Andrew Tridgell d43d070e75 Plane: ensure throttle reverse is obeyed in all states
need to use radio_max for failsafe if reversed
2015-09-14 09:42:20 +10:00
Andrew Tridgell 4aac2c5c96 Plane: trigger OVERRIDE_CHAN in px4io
setup the MODESWITCH channel as our OVERRIDE_CHAN, allowing for
instant manual passthru in px4io when OVERRIDE_CHAN goes above 1750

This makes for faster switching, and avoids bugs where a still enabled
FMU channel disables override
2015-06-21 18:19:16 +10:00
Andrew Tridgell 3e74b82bc4 Plane: fixed two bugs in px4io override code
First bug is going via microSD to poulate mixer. We can't rely on the
microSD being writeable or functioning properly. Instead create the
buffer in memory and only write a copy to the filesystem.

Second bug is related to extreme trim values on channels. If trim
values are well out of range then the mixer fails and override fails.
2015-06-02 21:48:18 +10:00
Andrew Tridgell 1520d8f734 Plane: catch a px4_mixer failure case 2015-05-30 11:17:56 +10:00
Andrew Tridgell 18c37935c9 Plane: convert from .pde to .cpp files 2015-05-21 07:48:52 +10:00