JOYSWAY: new protocol UNTESTED

This commit is contained in:
Pascal Langer
2021-03-02 10:00:33 +01:00
parent b3132c7bf1
commit b757283f41
9 changed files with 181 additions and 19 deletions

View File

@@ -210,6 +210,11 @@ void A7105_AdjustLOBaseFreq(uint8_t cmd)
offset=(int16_t)FORCE_KYOSHO_TUNING;
#endif
break;
case PROTO_JOYSWAY:
#ifdef FORCE_JOYSWAY_TUNING
offset=(int16_t)FORCE_JOYSWAY_TUNING;
#endif
break;
case PROTO_WFLY2:
#ifdef FORCE_WFLY2_TUNING
offset=(int16_t)FORCE_WFLY2_TUNING;
@@ -341,6 +346,14 @@ const uint8_t PROGMEM WFLY2_A7105_regs[] = {
0x01, 0x0f // 30 - 31
};
#endif
#ifdef JOYSWAY_A7105_INO
const uint8_t PROGMEM JOYSWAY_A7105_regs[] = {
0xff, 0x62, 0xff, 0x0F, 0x00, 0xff, 0xff ,0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0xF5, 0x00, 0x15, // 00 - 0f
0x9E, 0x4B, 0x00, 0x03, 0x56, 0x2B, 0x12, 0x4A, 0x02, 0x80, 0x80, 0x00, 0x0E, 0x91, 0x03, 0x0F, // 10 - 1f
0x16, 0x2A, 0x00, 0xff, 0xff, 0xff, 0x3A, 0x06, 0x1F, 0x47, 0x80, 0x01, 0x05, 0x45, 0x18, 0x00, // 20 - 2f
0x01, 0x0f // 30 - 31
};
#endif
#define ID_NORMAL 0x55201041
#define ID_PLUS 0xAA201041
@@ -349,6 +362,13 @@ void A7105_Init(void)
uint8_t *A7105_Regs=0;
uint8_t vco_calibration0, vco_calibration1;
#ifdef JOYSWAY_A7105_INO
if(protocol==PROTO_JOYSWAY)
{
A7105_Regs=(uint8_t*)JOYSWAY_A7105_regs;
}
else
#endif
#ifdef WFLY2_A7105_INO
if(protocol==PROTO_WFLY2)
{
@@ -482,6 +502,9 @@ void A7105_Init(void)
case PROTO_KYOSHO: //sub_protocol Hype
vco_calibration1=0x0C;
break;
case PROTO_JOYSWAY:
vco_calibration1=0x09;
break;
default:
vco_calibration1=0x0A;
break;

View File

@@ -0,0 +1,112 @@
/*
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 <http://www.gnu.org/licenses/>.
*/
#if defined(JOYSWAY_A7105_INO)
#include "iface_a7105.h"
//#define JOYSWAY_FORCE_ID
static void __attribute__((unused)) JOYSWAY_send_packet()
{
static uint8_t next_ch = 0x30;
//RF frequency
if (packet_count == 254)
{
packet_count = 0;
A7105_WriteID(0x5475c52a);
rf_ch_num = 0x0a;
}
else if (packet_count == 2)
{
A7105_WriteID(MProtocol_id);
rf_ch_num = 0x30;
}
else
{
if (packet_count & 0x01)
rf_ch_num = 0x30;
else
rf_ch_num = next_ch;
}
if (! (packet_count & 0x01))
{
next_ch++;
if (next_ch >= 0x45)
next_ch = 0x30;
}
//Payload
packet[0] = packet_count == 0 ? 0xdd : 0xff;
//ID
packet[1] = rx_tx_addr[0];
packet[2] = rx_tx_addr[1];
packet[3] = rx_tx_addr[2];
packet[4] = rx_tx_addr[3];
packet[5] = 0x00;
//Channels
for (uint8_t i = 0; i < 4; i++)
packet[ 6 + (i & 0x01) + ((i & 0x02)<<1)] = convert_channel_16b_limit(i, 0x00, 0xCC);
packet[8] = 0x64;
packet[9] = 0x64;
packet[12] = 0x64;
packet[13] = 0x64;
packet[14] = packet_count == 0 ? 0x30 : 0xaa;
//Check
uint8_t value = 0;
for (uint8_t i = 0; i < 15; i++)
value += packet[i];
packet[15] = value;
//Send
#if 0
debug("ch=%02X P=",rf_ch_num);
for(uint8_t i=0; i<16; i++)
debug("%02X ", packet[i]);
debugln("");
#endif
A7105_WriteData(16, rf_ch_num);
A7105_SetPower();
packet_count++;
}
uint16_t JOYSWAY_callback()
{
#ifdef MULTI_SYNC
telemetry_set_input_sync(6000);
#endif
#ifndef FORCE_JOYSWAY_TUNING
A7105_AdjustLOBaseFreq(1);
#endif
JOYSWAY_send_packet();
return 6000;
}
void JOYSWAY_init()
{
BIND_DONE; // not a bind protocol
#ifdef JOYSWAY_FORCE_ID
MProtocol_id = 0xf82dcaa0;
set_rx_tx_addr(MProtocol_id);
#endif
A7105_Init();
packet_count = 2;
}
#endif

View File

@@ -80,4 +80,5 @@
80,E016H,E016Hv2
81,E010r5
82,LOLI
83,E129
83,E129
84,JOYSWAY

View File

@@ -39,6 +39,7 @@ const char STR_FY326[] ="FY326";
const char STR_FUTABA[] ="Futaba";
const char STR_J6PRO[] ="J6 Pro";
const char STR_JJRC345[] ="JJRC345";
const char STR_JOYSWAY[] ="JOYSWAY";
const char STR_FQ777[] ="FQ777";
const char STR_ASSAN[] ="Assan";
const char STR_FRSKYV[] ="FrSky V";
@@ -318,6 +319,9 @@ const mm_protocol_definition multi_protocols[] = {
#if defined(JJRC345_NRF24L01_INO)
{PROTO_JJRC345, STR_JJRC345, STR_SUBTYPE_JJRC345, 2, OPTION_NONE, 0, 0, SW_NRF, JJRC345_init, JJRC345_callback },
#endif
#if defined(JOYSWAY_A7105_INO)
{PROTO_JOYSWAY, STR_JOYSWAY, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_A7105, JOYSWAY_init, JOYSWAY_callback },
#endif
#if defined(KF606_CCNRF_INO)
{PROTO_KF606, STR_KF606, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, KF606_init, KF606_callback },
#endif

View File

@@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 2
#define VERSION_PATCH_LEVEL 52
#define VERSION_PATCH_LEVEL 54
#define MODE_SERIAL 0
@@ -111,6 +111,7 @@ enum PROTOCOLS
PROTO_E010R5 = 81, // =>CYRF6936
PROTO_LOLI = 82, // =>NRF24L01
PROTO_E129 = 83, // =>CYRF6936
PROTO_JOYSWAY = 84, // =>A7105
PROTO_NANORF = 126, // =>NRF24L01
PROTO_TEST = 127, // =>CC2500

View File

@@ -155,6 +155,11 @@
#error "The Hubsan forced frequency tuning value is outside of the range -300..300."
#endif
#endif
#ifdef FORCE_JOYSWAY_TUNING
#if ( FORCE_JOYSWAY_TUNING < -300 ) || ( FORCE_JOYSWAY_TUNING > 300 )
#error "The JOYSWAY forced frequency tuning value is outside of the range -300..300."
#endif
#endif
#ifdef FORCE_KYOSHO_TUNING
#if ( FORCE_KYOSHO_TUNING < -300 ) || ( FORCE_KYOSHO_TUNING > 300 )
#error "The Kyosho forced frequency tuning value is outside of the range -300..300."
@@ -179,6 +184,9 @@
#ifndef FORCE_PELIKAN_TUNING
#define FORCE_PELIKAN_TUNING 0
#endif
#ifndef FORCE_JOYSWAY_TUNING
#define FORCE_JOYSWAY_TUNING 0
#endif
#ifndef FORCE_KYOSHO_TUNING
#define FORCE_KYOSHO_TUNING 0
#endif
@@ -239,6 +247,7 @@
#undef FLYSKY_A7105_INO
#undef HEIGHT_A7105_INO
#undef HUBSAN_A7105_INO
#undef JOYSWAY_A7105_INO
#undef KYOSHO_A7105_INO
#undef PELIKAN_A7105_INO
#undef WFLY2_A7105_INO

View File

@@ -121,6 +121,7 @@
//#define FORCE_FLYSKY_TUNING 0
//#define FORCE_HEIGHT_TUNING 0
//#define FORCE_HUBSAN_TUNING 0
//#define FORCE_JOYSWAY_TUNING 0
//#define FORCE_KYOSHO_TUNING 0
//#define FORCE_PELIKAN_TUNING 0
//#define FORCE_WFLY2_TUNING 0
@@ -174,6 +175,7 @@
#define FLYSKY_A7105_INO
#define HEIGHT_A7105_INO
#define HUBSAN_A7105_INO
#define JOYSWAY_A7105_INO
#define KYOSHO_A7105_INO
#define PELIKAN_A7105_INO
#define WFLY2_A7105_INO
@@ -682,6 +684,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
PROTO_JJRC345
JJRC345
SKYTMBLR
PROTO_JOYSWAY
NONE
PROTO_KF606
NONE
PROTO_KN