Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_RCProtocol: fixed valgrind on RCProtocolTest example #26228

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions libraries/AP_RCProtocol/examples/RCProtocolTest/RCProtocolTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <AP_RCProtocol/AP_RCProtocol.h>
#include <AP_SerialManager/AP_SerialManager.h>
#include <AP_VideoTX/AP_VideoTX.h>
#include <RC_Channel/RC_Channel.h>
#include <stdio.h>

void setup();
Expand All @@ -31,6 +32,31 @@ static AP_VideoTX vtx; // for set_vtx functions

static AP_RCProtocol *rcprot;

class RC_Channel_Test : public RC_Channel
{
protected:
void init_aux_function(AUX_FUNC ch_option, AuxSwitchPos) override {}
bool do_aux_function(AUX_FUNC ch_option, AuxSwitchPos) override { return false; }
};

class RC_Channels_Test : public RC_Channels
{
public:
bool has_valid_input() const override { return false; }
bool in_rc_failsafe() const override { return false; }
RC_Channel *get_arming_channel(void) const override { return nullptr; }
RC_Channel_Test *channel(const uint8_t chan) override { return nullptr; }
RC_Channel_Test obj_channels[NUM_RC_CHANNELS];
protected:
int8_t flight_mode_channel_number() const override { return 5; }
};

#define RC_CHANNELS_SUBCLASS RC_Channels_Test
#define RC_CHANNEL_SUBCLASS RC_Channel_Test
#include <RC_Channel/RC_Channels_VarInfo.h>

static RC_Channels_Test rcchan;

// setup routine
void setup()
{
Expand Down
Loading