From 63f87a863cfeaf396d18df76737d107b13e29018 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 8 Nov 2021 11:27:39 +1100 Subject: [PATCH] AP_RCProtocol: use switch statement for 3-frame check Forces new protocol implementer to consider whether a 3-frame check is required --- libraries/AP_RCProtocol/AP_RCProtocol.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libraries/AP_RCProtocol/AP_RCProtocol.h b/libraries/AP_RCProtocol/AP_RCProtocol.h index 5fa1a5a66f..0652eb5a7f 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol.h +++ b/libraries/AP_RCProtocol/AP_RCProtocol.h @@ -62,7 +62,24 @@ public: // for protocols without strong CRCs we require 3 good frames to lock on bool requires_3_frames(enum rcprotocol_t p) { - return (p == DSM || p == SBUS || p == SBUS_NI || p == PPM || p == FPORT || p == FPORT2); + switch (p) { + case DSM: + case SBUS: + case SBUS_NI: + case PPM: + case FPORT: + case FPORT2: + return true; + case IBUS: + case SUMD: + case SRXL: + case SRXL2: + case CRSF: + case ST24: + case NONE: + return false; + } + return false; } uint8_t num_channels();