From debc9de11a39a6f9a8a25bb389d67d00482b7d5d Mon Sep 17 00:00:00 2001 From: pascallanger Date: Fri, 22 Mar 2024 18:17:21 +0100 Subject: [PATCH] New protocol Kyosho3/ASF Only 1 ID and 1 frequency for now --- Lua_scripts/MultiChan.txt | 1 + Multiprotocol/Kyosho3_cyrf6936.ino | 122 +++++++++++++++++++++++++++++ Multiprotocol/Multi.txt | 1 + Multiprotocol/Multi_Protos.ino | 5 ++ Multiprotocol/Multiprotocol.h | 3 +- Multiprotocol/Validate.h | 2 + Multiprotocol/_Config.h | 3 + Protocols_Details.md | 12 +++ 8 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 Multiprotocol/Kyosho3_cyrf6936.ino diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index f7c4468b8..5eccaa375 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -216,3 +216,4 @@ 96,0,BumbleB 97,0,SGF22,Std,1,Mode,Flip,LED,Pict,Video 61,1,EazyRC +98,0,Kyosho3,ASF,0 diff --git a/Multiprotocol/Kyosho3_cyrf6936.ino b/Multiprotocol/Kyosho3_cyrf6936.ino new file mode 100644 index 000000000..0a3b5b90b --- /dev/null +++ b/Multiprotocol/Kyosho3_cyrf6936.ino @@ -0,0 +1,122 @@ +/* + This project is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Multiprotocol is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Multiprotocol. If not, see . + */ + +#if defined(KYOSHO3_CYRF6936_INO) + +#include "iface_cyrf6936.h" + +#define KYOSHO3_FORCE_ID +//#define KYOSHO3_DEBUG + +#define KYOSHO3_BIND_PACKET_SIZE 4 +#define KYOSHO3_PACKET_SIZE 9 + +const uint8_t PROGMEM KYOSHO3_init_vals[][2] = { + //Init from dump + {CYRF_0B_PWR_CTRL, 0x00}, // PMU + {CYRF_32_AUTO_CAL_TIME, 0x3C}, // Default init value + {CYRF_35_AUTOCAL_OFFSET, 0x14}, // Default init value + {CYRF_03_TX_CFG, 0x28 | CYRF_BIND_POWER}, // 8DR Mode, 64 chip codes + {CYRF_10_FRAMING_CFG, 0xA4}, // SOP and LEN enable + {CYRF_1F_TX_OVERRIDE, 0x05}, // Disable CRC, Data invert + {CYRF_1E_RX_OVERRIDE, 0x04}, // CRC check disabled + //{CYRF_11_DATA32_THOLD, 0x04}, // ???Using 64 chip... + {CYRF_12_DATA64_THOLD, 0x0E}, // Default + {CYRF_06_RX_CFG, 0x52}, // AGC disabled, LNA enabled, override enabled +}; + +static uint16_t __attribute__((unused)) KYOSHO3_send_packet() +{ + CYRF_SetPower(0x28); + if(IS_BIND_IN_PROGRESS) + { + packet[0] = 0xAA; + //ID + memcpy(&packet[1],&rx_tx_addr[1],3); + CYRF_WriteDataPacketLen(packet, KYOSHO3_BIND_PACKET_SIZE); + #ifdef KYOSHO3_DEBUG + debug("P:"); + for(uint8_t i=0;i>= 2; + packet[3] |= Channel_data[i]<<6; + packet[4+i] = Channel_data[i]>>3; + } + //Checksum + packet[8] = packet[3]; + for(uint8_t i=4;i<8;i++) + packet[8] += packet[i]; + //Timing + phase ^= 0x01; + CYRF_WriteDataPacketLen(packet, KYOSHO3_PACKET_SIZE); + #ifdef KYOSHO3_DEBUG + debug("P:"); + for(uint8_t i=0;iCC2500 & NRF24L01 PROTO_BUMBLEB = 96, // =>CC2500 & NRF24L01 PROTO_SGF22 = 97, // =>NRF24L01 + PROTO_KYOSHO3 = 98, // =>CYRF6936 PROTO_NANORF = 126, // =>NRF24L01 diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index 4ea98fc1a..beffa13d4 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -266,6 +266,7 @@ #undef E01X_CYRF6936_INO #undef E129_CYRF6936_INO #undef J6PRO_CYRF6936_INO + #undef KYOSHO3_CYRF6936_INO #undef LOSI_CYRF6936_INO #undef MLINK_CYRF6936_INO #undef TRAXXAS_CYRF6936_INO @@ -377,6 +378,7 @@ #undef TRAXXAS_CYRF6936_INO #undef EAZYRC_NRF24L01_INO #undef KYOSHO2_NRF24L01_INO + #undef KYOSHO3_CYRF6936_INO #undef MOULDKG_NRF24L01_INO #undef SHENQI_NRF24L01_INO #endif diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 9c10ed988..016b04417 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -191,6 +191,7 @@ #define E01X_CYRF6936_INO #define E129_CYRF6936_INO #define J6PRO_CYRF6936_INO +#define KYOSHO3_CYRF6936_INO #define LOSI_CYRF6936_INO //Need DSM to be enabled #define MLINK_CYRF6936_INO #define SCORPIO_CYRF6936_INO @@ -739,6 +740,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { KYOSHO_HYPE PROTO_KYOSHO2 NONE + PROTO_KYOSHO3 + NONE PROTO_LOLI NONE PROTO_LOSI diff --git a/Protocols_Details.md b/Protocols_Details.md index 4564b4f9f..981d28e81 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -116,6 +116,7 @@ CFlie|38|CFlie||||||||NRF24L01| [KN](Protocols_Details.md#KN---9)|9|WLTOYS|FEILUN|||||||NRF24L01| [Kyosho](Protocols_Details.md#Kyosho---73)|73|FHSS|Hype|||||||A7105| [Kyosho2](Protocols_Details.md#Kyosho2---93)|93|KT-17||||||||NRF24L01| +[Kyosho3](Protocols_Details.md#Kyosho3---98)|98|ASF||||||||CYRF6936| [LOLI](Protocols_Details.md#LOLI---82)|82|||||||||NRF24L01| [Losi](Protocols_Details.md#Losi---89)|89|||||||||CYRF6936| [MJXq](Protocols_Details.md#MJXQ---18)|18|WLH08|X600|X800|H26D|E010*|H26WH|PHOENIX*||NRF24L01|XN297 @@ -647,6 +648,17 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12 ---|---|---|---|---|---|---|---|---|----|----|---- A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12 +## Kyosho3 - *98* + +### Sub_protocol ASF - *0* +Surface protocol ASF. Models: Mini-Z. + +Extended limits supported + +CH1|CH2|CH3|CH4 +---|---|---|--- +STEERING|THROTTLE|CH3|CH4 + ## Losi - *89* TX: LSR-3000