AP_RCProtocol: added destructor

for use by test suite
This commit is contained in:
Andrew Tridgell 2018-11-05 14:56:37 +11:00
parent 696d4b47a1
commit eb78d4fa26
3 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,17 @@ void AP_RCProtocol::init()
backend[AP_RCProtocol::ST24] = new AP_RCProtocol_ST24(*this);
}
AP_RCProtocol::~AP_RCProtocol()
{
for (uint8_t i = 0; i < AP_RCProtocol::NONE; i++) {
if (backend[i] != nullptr) {
delete backend[i];
backend[i] = nullptr;
}
}
instance = nullptr;
}
void AP_RCProtocol::process_pulse(uint32_t width_s0, uint32_t width_s1)
{
uint32_t now = AP_HAL::millis();

View File

@ -28,6 +28,7 @@ public:
AP_RCProtocol() {
instance = this;
}
~AP_RCProtocol();
enum rcprotocol_t {
PPM = 0,
SBUS,

View File

@ -24,6 +24,7 @@ class AP_RCProtocol_Backend {
public:
AP_RCProtocol_Backend(AP_RCProtocol &_frontend);
virtual ~AP_RCProtocol_Backend() {}
virtual void process_pulse(uint32_t width_s0, uint32_t width_s1) {}
virtual void process_byte(uint8_t byte, uint32_t baudrate) {}
uint16_t read(uint8_t chan);