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: add separate define for AP_RCPROTOCOL_DSM_ENABLED #26113

Merged
merged 1 commit into from Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions libraries/AP_RCProtocol/AP_RCProtocol.cpp
Expand Up @@ -55,7 +55,9 @@ void AP_RCProtocol::init()
#if AP_RCPROTOCOL_FASTSBUS_ENABLED
backend[AP_RCProtocol::FASTSBUS] = new AP_RCProtocol_SBUS(*this, true, 200000);
#endif
#if AP_RCPROTOCOL_DSM_ENABLED
backend[AP_RCProtocol::DSM] = new AP_RCProtocol_DSM(*this);
#endif
#if AP_RCPROTOCOL_SUMD_ENABLED
backend[AP_RCProtocol::SUMD] = new AP_RCProtocol_SUMD(*this);
#endif
Expand Down Expand Up @@ -475,8 +477,10 @@ const char *AP_RCProtocol::protocol_name_from_protocol(rcprotocol_t protocol)
case FASTSBUS:
return "FastSBUS";
#endif
#if AP_RCPROTOCOL_DSM_ENABLED
case DSM:
return "DSM";
#endif
#if AP_RCPROTOCOL_SUMD_ENABLED
case SUMD:
return "SUMD";
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_RCProtocol/AP_RCProtocol.h
Expand Up @@ -42,7 +42,9 @@ class AP_RCProtocol {
#if AP_RCPROTOCOL_SBUS_NI_ENABLED
SBUS_NI = 3,
#endif
#if AP_RCPROTOCOL_DSM_ENABLED
DSM = 4,
#endif
#if AP_RCPROTOCOL_SUMD_ENABLED
SUMD = 5,
#endif
Expand Down Expand Up @@ -111,7 +113,9 @@ class AP_RCProtocol {
// for protocols without strong CRCs we require 3 good frames to lock on
bool requires_3_frames(enum rcprotocol_t p) {
switch (p) {
#if AP_RCPROTOCOL_DSM_ENABLED
case DSM:
#endif
#if AP_RCPROTOCOL_FASTSBUS_ENABLED
case FASTSBUS:
#endif
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_RCProtocol/AP_RCProtocol_DSM.cpp
Expand Up @@ -20,7 +20,7 @@

#include "AP_RCProtocol_config.h"

#if AP_RCPROTOCOL_ENABLED
#if AP_RCPROTOCOL_DSM_ENABLED

#include "AP_RCProtocol_DSM.h"
#include <AP_VideoTX/AP_VideoTX_config.h>
Expand Down Expand Up @@ -539,4 +539,4 @@ void AP_RCProtocol_DSM::process_byte(uint8_t b, uint32_t baudrate)
_process_byte(AP_HAL::millis(), b);
}

#endif // AP_RCPROTOCOL_ENABLED
#endif // AP_RCPROTOCOL_DSM_ENABLED
4 changes: 2 additions & 2 deletions libraries/AP_RCProtocol/AP_RCProtocol_DSM.h
Expand Up @@ -19,7 +19,7 @@

#include "AP_RCProtocol_config.h"

#if AP_RCPROTOCOL_ENABLED
#if AP_RCPROTOCOL_DSM_ENABLED

#include "AP_RCProtocol_Backend.h"

Expand Down Expand Up @@ -83,4 +83,4 @@ class AP_RCProtocol_DSM : public AP_RCProtocol_Backend {
SoftSerial ss{115200, SoftSerial::SERIAL_CONFIG_8N1};
};

#endif // AP_RCPROTOCOL_ENABLED
#endif // AP_RCPROTOCOL_DSM_ENABLED
4 changes: 4 additions & 0 deletions libraries/AP_RCProtocol/AP_RCProtocol_config.h
Expand Up @@ -19,6 +19,10 @@
#define AP_RCPROTOCOL_DRONECAN_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED && HAL_ENABLE_DRONECAN_DRIVERS
#endif

#ifndef AP_RCPROTOCOL_DSM_ENABLED
#define AP_RCPROTOCOL_DSM_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_RCPROTOCOL_FPORT_ENABLED
#define AP_RCPROTOCOL_FPORT_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED
#endif
Expand Down