Finished adding clone and erase

This commit is contained in:
john_moore007 2023-08-23 13:15:08 +01:00
parent ccc9a04640
commit 8bc0c48911
4 changed files with 12 additions and 18 deletions

View File

@ -4,5 +4,5 @@
"sketch": "Multiprotocol\\Multiprotocol.ino",
"output": "vscode_build",
"intelliSenseGen": "disable",
"port": "COM9"
"port": "COM15"
}

View File

@ -249,14 +249,15 @@ uint16_t DSM_RX_callback()
{
// store tx info into eeprom
uint16_t temp = DSM_RX_EEPROM_OFFSET;
if (sub_protocol==DSM_CLONE)
{
if (sub_protocol == DSM_CLONE)
temp = DSM_CLONE_EEPROM_OFFSET;
}
debug("ID=");
for(uint8_t i=0;i<4;i++)
{
cyrfmfg_id[i]=packet_in[i]^0xFF;
if (sub_protocol == DSM_CLONE && i == 3)
cyrfmfg_id[i]=(packet_in[i]^RX_num)^0xFF;
else
cyrfmfg_id[i]=packet_in[i]^0xFF;
eeprom_write_byte((EE_ADDR)temp++, cyrfmfg_id[i]);
debug(" %02X", cyrfmfg_id[i]);
}
@ -275,10 +276,8 @@ uint16_t DSM_RX_callback()
DSM_rx_type=packet_in[12];
debugln(", num_ch=%d, type=%02X",num_ch, DSM_rx_type);
eeprom_write_byte((EE_ADDR)temp, DSM_rx_type);
if (sub_protocol==DSM_CLONE)
{
if (sub_protocol == DSM_CLONE)
eeprom_write_byte((EE_ADDR)++temp, num_ch);
}
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Abort RX operation
CYRF_SetTxRxMode(TX_EN); // Force end state TX
CYRF_ConfigDataCode((const uint8_t *)"\x98\x88\x1B\xE4\x30\x79\x03\x84", 16);
@ -492,9 +491,7 @@ void DSM_RX_init()
// Clear all cloned addresses
uint16_t addr = DSM_CLONE_EEPROM_OFFSET;
for(uint8_t i=0; i<7; i++)
{
eeprom_write_byte((EE_ADDR)(addr++), 0xFF);
}
packet_count = 100;
}
else
@ -505,12 +502,9 @@ void DSM_RX_init()
}
else
{
uint16_t temp = DSM_RX_EEPROM_OFFSET;
if (sub_protocol==DSM_CLONE)
{
if (sub_protocol == DSM_CLONE || sub_protocol == DSM_ERASE )
temp = DSM_CLONE_EEPROM_OFFSET;
}
debug("ID=");
for(uint8_t i=0;i<4;i++)
@ -520,10 +514,10 @@ void DSM_RX_init()
}
DSM_rx_type=eeprom_read_byte((EE_ADDR)temp);
debugln(", type=%02X", DSM_rx_type);
if (sub_protocol==DSM_CLONE)
if (sub_protocol == DSM_CLONE || sub_protocol == DSM_ERASE )
{
num_ch=eeprom_read_byte((EE_ADDR)++temp);
debugln(", channels=%02", num_ch);
debugln("channels=%d", num_ch);
}
phase = DSM_RX_DATA_PREP;

View File

@ -719,7 +719,7 @@ void loop()
if(++count>10)
{ //The protocol does not leave enough time for an update so forcing it
count=0;
debugln("Force update");
//debugln("Force update");
Update_All();
}
}

View File

@ -158,7 +158,7 @@
//If you have 2 Multi modules which you want to share the same ID so you can use either to control the same RC model
// then you can force the ID to a certain known value using the lines below.
//Default is commented, you should uncoment only for test purpose or if you know exactly what you are doing!!!
//#define FORCE_CYRF_ID "\x7b\xe8\x8b\x40\x9A\xBC"
#define FORCE_CYRF_ID "\x54\x51\x67\x8e\x9A\xBC"
/****************************/