ardupilot/ArduCopter/RC_Channel.h
Peter Barker b4537bebd8 Copter: move control_mode_t into being Mode::Number enum class
Fixes this compiler error:

In file included from ../../ArduCopter/sensors.cpp:1:
In file included from ../../ArduCopter/Copter.h:195:
../../ArduCopter/mode.h:1291:9: fatal error: declaration shadows a variable in the global namespace [-Wshadow]
        AUTO,           // after A and B defined, pilot toggle the switch from one side to the other, vehicle flies autonomously
        ^
../../ArduCopter/defines.h:38:5: note: previous declaration is here
    AUTO =          3,  // fully automatic waypoint control using mission commands
    ^
1 error generated.
2019-09-13 13:12:08 +09:00

45 lines
962 B
C++

#pragma once
#include <RC_Channel/RC_Channel.h>
#include "mode.h"
class RC_Channel_Copter : public RC_Channel
{
public:
protected:
void init_aux_function(aux_func_t ch_option, aux_switch_pos_t) override;
void do_aux_function(aux_func_t ch_option, aux_switch_pos_t) override;
private:
void do_aux_function_change_mode(const Mode::Number mode,
const aux_switch_pos_t ch_flag);
// called when the mode switch changes position:
void mode_switch_changed(modeswitch_pos_t new_pos) override;
};
class RC_Channels_Copter : public RC_Channels
{
public:
bool has_valid_input() const override;
RC_Channel_Copter obj_channels[NUM_RC_CHANNELS];
RC_Channel_Copter *channel(const uint8_t chan) override {
if (chan > NUM_RC_CHANNELS) {
return nullptr;
}
return &obj_channels[chan];
}
protected:
int8_t flight_mode_channel_number() const override;
};