From 5856442e0fe45ab23b1600ebb6034f9319ad039c Mon Sep 17 00:00:00 2001 From: pascallanger Date: Mon, 4 Nov 2019 19:16:19 +0100 Subject: [PATCH] First HoTT version --- Multiprotocol/HOTT_cc2500.ino | 80 +++++++++++++++++++++++++-------- Multiprotocol/Multiprotocol.h | 6 ++- Multiprotocol/Multiprotocol.ino | 2 +- Multiprotocol/_Config.h | 6 +-- 4 files changed, 70 insertions(+), 24 deletions(-) diff --git a/Multiprotocol/HOTT_cc2500.ino b/Multiprotocol/HOTT_cc2500.ino index e171e4b..6344983 100644 --- a/Multiprotocol/HOTT_cc2500.ino +++ b/Multiprotocol/HOTT_cc2500.ino @@ -107,11 +107,41 @@ static void __attribute__((unused)) HOTT_tune_freq() uint8_t HOTT_hop[75]= { 48, 37, 16, 62, 9, 50, 42, 22, 68, 0, 55, 35, 21, 74, 1, 56, 31, 20, 70, 11, 45, 32, 24, 71, 8, 54, 38, 26, 61, 13, 53, 30, 15, 65, 7, 52, 34, 28, 60, 3, 47, 39, 18, 69, 2, 49, 44, 23, 72, 5, 51, 43, 19, 64, 12, 46, 33, 17, 67, 6, 58, 36, 29, 73, 14, 57, 41, 25, 63, 4, 59, 40, 27, 66, 10 }; uint16_t HOTT_hop_val = 0xC06B; -// Channel values are PPM*2 +static void __attribute__((unused)) HOTT_init() +{ + packet[0] = HOTT_hop_val; + packet[1] = HOTT_hop_val>>8; + #ifdef HOTT_FORCE_ID + memcpy(rx_tx_addr,"\x7C\x94\x00\x0D\x50",5); + #endif + memset(&packet[30],0xFF,9); + packet[39]=0X07; // unknown + if(IS_BIND_IN_PROGRESS) + { + packet[28] = 0x80; // unknown 0x80 when bind starts then when RX replies start normal, 0x89/8A/8B/8C/8D/8E during normal packets + packet[29] = 0x02; // unknown 0x02 when bind starts then when RX replies cycle in sequence 0x1A/22/2A/0A/12, 0x02 during normal packets + memset(&packet[40],0xFA,5); + memcpy(&packet[45],rx_tx_addr,5); + } + else + { + packet[28] = 0x8C; // unknown 0x80 when bind starts then when RX replies start normal, 0x89/8A/8B/8C/8D/8E during normal packets + packet[29] = 0x02; // unknown 0x02 when bind starts then when RX replies cycle in sequence 0x1A/22/2A/0A/12, 0x02 during normal packets + memcpy(&packet[40],rx_tx_addr,5); + + uint8_t addr=HOTT_EEPROM_OFFSET+RX_num*5; + for(uint8_t i=0;i<5;i++) + packet[45+i]=eeprom_read_byte((EE_ADDR)(addr+i)); + } +} + static void __attribute__((unused)) HOTT_data_packet() { packet[2] = hopping_frequency_no; - packet[3] = 0x00; // unknown, may be for additional channels + + packet[3] = 0x00; // unknown, may be for additional channels? + + // Channel values are PPM*2 for(uint8_t i=4;i<28;i+=2) { uint16_t val=Channel_data[(i-4)>>1]; @@ -120,9 +150,6 @@ static void __attribute__((unused)) HOTT_data_packet() packet[i+1] = val>>8; } - packet[28] = 0x8C; // unknown - packet[29] = 0x02; // unknown - CC2500_SetTxRxMode(TX_EN); CC2500_SetPower(); CC2500_WriteReg(CC2500_06_PKTLEN, 0x32); @@ -182,10 +209,36 @@ uint16_t ReadHOTT() if (len==HOTT_RX_PACKET_LEN+2) { CC2500_ReadData(packet_in, len); - debug("T:"); - for(uint8_t i=0;i>8; - memcpy(&packet[30],"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x07\x7C\x94\x00\x0C\x50\x4D\xF2\x00\x00\xB1",20); //unknown -} - uint16_t initHOTT() { - BIND_DONE; // Not a TX bind protocol HOTT_init(); - HOTT_rf_init(); phase = HOTT_START; return 10000; diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 1cae8b1..50a7ce8 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 0 -#define VERSION_PATCH_LEVEL 33 +#define VERSION_PATCH_LEVEL 34 //****************** // Protocols @@ -593,7 +593,8 @@ enum { #define FRSKY_RX_EEPROM_OFFSET 178 // (1) format + (3) TX ID + (1) freq_tune + (47) channels, 52 bytes, end is 178+52=230 #define AFHDS2A_RX_EEPROM_OFFSET 230 // (4) TX ID + (16) channels, 20 bytes, end is 230+20=250 #define AFHDS2A_EEPROM_OFFSET2 250 // RX ID, 4 bytes per model id, end is 250+192=442 -//#define CONFIG_EEPROM_OFFSET 442 // Current configuration of the multimodule +#define HOTT_EEPROM_OFFSET 442 // RX ID, 5 bytes per model id, end is 320+442=762 +//#define CONFIG_EEPROM_OFFSET 762 // Current configuration of the multimodule //**************************************** //*** MULTI protocol serial definition *** @@ -910,6 +911,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- OPTION_FIXEDID 4 OPTION_TELEM 5 OPTION_SRVFREQ 6 + OPTION_MAXTHR 7 [19&0x0F] Number of sub protocols [20..27] Sub protocol name [8], not null terminated if sub prototcol len == 8 diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index b7e1ac4..a6de2bf 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -113,7 +113,7 @@ uint8_t num_ch; #ifdef CC2500_INSTALLED #ifdef SCANNER_CC2500_INO uint8_t calData[255]; - #elif defined(HOTT_CC2500_IN0) + #elif defined(HOTT_CC2500_INO) uint8_t calData[75]; #else uint8_t calData[50]; diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 305eba6..cddf437 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -179,7 +179,7 @@ #define FRSKYX_CC2500_INO #define FRSKY_RX_CC2500_INO #define HITEC_CC2500_INO -//#define HOTT_CC2500_INO +#define HOTT_CC2500_INO #define SCANNER_CC2500_INO #define SFHSS_CC2500_INO #define REDPINE_CC2500_INO @@ -275,8 +275,8 @@ //For STM32 and OrangeRX modules, comment to prevent the TX from forcing the serial telemetry polarity normal/invert. #define INVERT_TELEMETRY_TX -//Uncomment if you don't want to send Multi status telemetry frames (Protocol available, Bind in progress, version...) -//Use with er9x/erskyTX, for OpenTX MULTI_TELEMETRY below is preferred instead +//Uncomment if you want to send Multi status telemetry frames (Protocol available, Bind in progress, version...) +//Use with er9x/erskyTX, for OpenTX you must select MULTI_TELEMETRY below //#define MULTI_STATUS //Sends Multi status and allow OpenTX to autodetect the telemetry format. Comment to disable.