Added sub-protocol for setting failsafe values

This commit is contained in:
Dennis 2017-03-11 13:03:22 -05:00
parent b67e0ec6a7
commit 90c50293df
3 changed files with 13 additions and 5 deletions

View File

@ -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 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, normal = 0,
bind = 1, bind = 1,
setFailSafe = 2,
unBind = 127 unBind = 127
} RxMode; } RxMode;
uint8_t reserved = 0; uint8_t reserved = 0;
@ -107,8 +108,12 @@ static void __attribute__((unused)) CABELL_send_packet(uint8_t bindMode)
if (sub_protocol == CABELL_UNBIND) { if (sub_protocol == CABELL_UNBIND) {
TxPacket.RxMode = CABELL_RxTxPacket_t::RxMode_t::unBind; TxPacket.RxMode = CABELL_RxTxPacket_t::RxMode_t::unBind;
TxPacket.option = option & (~CABELL_OPTION_MASK_CHANNEL_REDUCTION); //remove channel reduction if in unBind mode TxPacket.option = option & (~CABELL_OPTION_MASK_CHANNEL_REDUCTION); //remove channel reduction if in unBind mode
} else {
if (sub_protocol == CABELL_SET_FAIL_SAFE) {
TxPacket.RxMode = CABELL_RxTxPacket_t::RxMode_t::setFailSafe;
} else { } else {
TxPacket.RxMode = (bindMode) ? CABELL_RxTxPacket_t::RxMode_t::bind : CABELL_RxTxPacket_t::RxMode_t::normal; 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.option = (bindMode) ? (option & (~CABELL_OPTION_MASK_CHANNEL_REDUCTION)) : option; //remove channel reduction if in bind mode
} }
TxPacket.reserved = 0; TxPacket.reserved = 0;

View File

@ -177,6 +177,7 @@ enum FY326
enum CABELL enum CABELL
{ {
CABELL_V3 = 0, CABELL_V3 = 0,
CABELL_SET_FAIL_SAFE = 6,
CABELL_UNBIND = 7 CABELL_UNBIND = 7
}; };
@ -538,6 +539,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
FY319 1 FY319 1
sub_protocol==CABELL sub_protocol==CABELL
CABELL_V3 0, CABELL_V3 0,
CABELL_SET_FAIL_SAFE 6,
CABELL_UNBIND 7 CABELL_UNBIND 7
Power value => 0x80 0=High/1=Low Power value => 0x80 0=High/1=Low

View File

@ -291,6 +291,7 @@ const PPM_Parameters PPM_prot[15]= {
PPM_SBUS PPM_SBUS
MODE_CABELL MODE_CABELL
CABELL_V3 CABELL_V3
CABELL_SET_FAIL_SAFE
CABELL_UNBIND CABELL_UNBIND
*/ */