From 90c50293df45a7d21027ffd09891c6431c17bab6 Mon Sep 17 00:00:00 2001 From: Dennis Date: Sat, 11 Mar 2017 13:03:22 -0500 Subject: [PATCH] Added sub-protocol for setting failsafe values --- Multiprotocol/CABELL_nrf224l01.ino | 7 ++++++- Multiprotocol/Multiprotocol.h | 10 ++++++---- Multiprotocol/_Config.h | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Multiprotocol/CABELL_nrf224l01.ino b/Multiprotocol/CABELL_nrf224l01.ino index 92baf8c..20db173 100644 --- a/Multiprotocol/CABELL_nrf224l01.ino +++ b/Multiprotocol/CABELL_nrf224l01.ino @@ -50,6 +50,7 @@ typedef struct { enum RxMode_t : uint8_t { // Note bit 8 is used to indicate if the packet is the first of 2 on the channel. Mask out this bit before using the enum normal = 0, bind = 1, + setFailSafe = 2, unBind = 127 } RxMode; uint8_t reserved = 0; @@ -108,7 +109,11 @@ static void __attribute__((unused)) CABELL_send_packet(uint8_t bindMode) TxPacket.RxMode = CABELL_RxTxPacket_t::RxMode_t::unBind; TxPacket.option = option & (~CABELL_OPTION_MASK_CHANNEL_REDUCTION); //remove channel reduction if in unBind mode } else { - TxPacket.RxMode = (bindMode) ? CABELL_RxTxPacket_t::RxMode_t::bind : CABELL_RxTxPacket_t::RxMode_t::normal; + if (sub_protocol == CABELL_SET_FAIL_SAFE) { + TxPacket.RxMode = CABELL_RxTxPacket_t::RxMode_t::setFailSafe; + } else { + TxPacket.RxMode = (bindMode) ? CABELL_RxTxPacket_t::RxMode_t::bind : CABELL_RxTxPacket_t::RxMode_t::normal; + } TxPacket.option = (bindMode) ? (option & (~CABELL_OPTION_MASK_CHANNEL_REDUCTION)) : option; //remove channel reduction if in bind mode } TxPacket.reserved = 0; diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 1c9f35d..3453e94 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -176,8 +176,9 @@ enum FY326 }; enum CABELL { - CABELL_V3 = 0, - CABELL_UNBIND = 7 + CABELL_V3 = 0, + CABELL_SET_FAIL_SAFE = 6, + CABELL_UNBIND = 7 }; #define NONE 0 @@ -537,8 +538,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- FY326 0 FY319 1 sub_protocol==CABELL - CABELL_V3 0, - CABELL_UNBIND 7 + CABELL_V3 0, + CABELL_SET_FAIL_SAFE 6, + CABELL_UNBIND 7 Power value => 0x80 0=High/1=Low Stream[3] = option_protocol; diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 4b0f7bd..4832acb 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -291,6 +291,7 @@ const PPM_Parameters PPM_prot[15]= { PPM_SBUS MODE_CABELL CABELL_V3 + CABELL_SET_FAIL_SAFE CABELL_UNBIND */