mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-12-13 19:13:14 +00:00
Multi config: enabled by default, LUA script update
This commit is contained in:
@@ -79,13 +79,24 @@ uint8_t CYRF_Reset()
|
||||
void CYRF_GetMfgData(uint8_t data[])
|
||||
{
|
||||
#ifndef FORCE_CYRF_ID
|
||||
/* Fuses power on */
|
||||
CYRF_WriteRegister(CYRF_25_MFG_ID, 0xFF);
|
||||
if(eeprom_read_byte((EE_ADDR)EEPROM_CID_INIT_OFFSET)==0xf0)
|
||||
{//read Cyrf ID from EEPROM
|
||||
for(uint8_t i=0;i<6;i++)
|
||||
data[i] = eeprom_read_byte((EE_ADDR)EEPROM_CID_OFFSET+i);
|
||||
}
|
||||
else
|
||||
{//read Cyrf ID and store it EEPROM
|
||||
/* Fuses power on */
|
||||
CYRF_WriteRegister(CYRF_25_MFG_ID, 0xFF);
|
||||
|
||||
CYRF_ReadRegisterMulti(CYRF_25_MFG_ID, data, 6);
|
||||
CYRF_ReadRegisterMulti(CYRF_25_MFG_ID, data, 6);
|
||||
for(uint8_t i=0;i<6;i++)
|
||||
eeprom_write_byte((EE_ADDR)EEPROM_CID_OFFSET+i, data[i]);
|
||||
eeprom_write_byte((EE_ADDR)EEPROM_CID_INIT_OFFSET, 0xf0);
|
||||
|
||||
/* Fuses power off */
|
||||
CYRF_WriteRegister(CYRF_25_MFG_ID, 0x00);
|
||||
/* Fuses power off */
|
||||
CYRF_WriteRegister(CYRF_25_MFG_ID, 0x00);
|
||||
}
|
||||
#else
|
||||
memcpy(data,FORCE_CYRF_ID,6);
|
||||
#endif
|
||||
|
||||
@@ -19,13 +19,19 @@
|
||||
#include "iface_cyrf6936.h"
|
||||
#endif
|
||||
|
||||
void CONFIG_write_ID(uint32_t id)
|
||||
void CONFIG_write_GID(uint32_t id)
|
||||
{
|
||||
for(uint8_t i=0;i<4;i++)
|
||||
eeprom_write_byte((EE_ADDR)EEPROM_ID_OFFSET+i,id >> (i*8));
|
||||
eeprom_write_byte((EE_ADDR)(EEPROM_ID_OFFSET+10),0xf0);
|
||||
//eeprom_write_byte((EE_ADDR)(EEPROM_ID_OFFSET+10),0xf0);
|
||||
}
|
||||
|
||||
void CONFIG_write_CID(uint8_t *data)
|
||||
{
|
||||
for(uint8_t i=0;i<6;i++)
|
||||
eeprom_write_byte((EE_ADDR)EEPROM_CID_OFFSET+i, data[i]);
|
||||
//eeprom_write_byte((EE_ADDR)EEPROM_CID_INIT_OFFSET, 0xf0);
|
||||
}
|
||||
uint16_t CONFIG_callback()
|
||||
{
|
||||
static uint8_t line=0, page=0;
|
||||
@@ -51,7 +57,7 @@ uint16_t CONFIG_callback()
|
||||
id |= CONFIG_SerialRX_val[i+1];
|
||||
}
|
||||
debugln("Update ID to %lx", id);
|
||||
CONFIG_write_ID(id);
|
||||
CONFIG_write_GID(id);
|
||||
break;
|
||||
case 2:
|
||||
if(CONFIG_SerialRX_val[1]==0xAA)
|
||||
@@ -59,7 +65,7 @@ uint16_t CONFIG_callback()
|
||||
#define STM32_UUID ((uint32_t *)0x1FFFF7E8)
|
||||
id = STM32_UUID[0] ^ STM32_UUID[1] ^ STM32_UUID[2];
|
||||
debugln("Reset GID to %lx", id);
|
||||
CONFIG_write_ID(id);
|
||||
CONFIG_write_GID(id);
|
||||
}
|
||||
break;
|
||||
#ifdef CYRF6936_INSTALLED
|
||||
@@ -68,6 +74,7 @@ uint16_t CONFIG_callback()
|
||||
for(uint8_t i=0; i<6; i++)
|
||||
debug("%02X ",CONFIG_SerialRX_val[i+1]);
|
||||
debugln("");
|
||||
CONFIG_write_CID(&CONFIG_SerialRX_val[1]);
|
||||
case 5:
|
||||
if(CONFIG_SerialRX_val[1]==0xAA)
|
||||
{
|
||||
@@ -79,6 +86,7 @@ uint16_t CONFIG_callback()
|
||||
for(uint8_t i=0; i<6; i++)
|
||||
debug("%02X ",data[i]);
|
||||
debugln("");
|
||||
CONFIG_write_CID(data);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -192,7 +192,6 @@ enum
|
||||
const mm_protocol_definition multi_protocols[] = {
|
||||
// Protocol number, Protocol String, Sub_protocol strings, Number of sub_protocols, Option type, Failsafe, ChMap, RF switch, Init, Callback
|
||||
#if defined(MULTI_CONFIG_INO)
|
||||
{0x00, STR_CONFIG, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, 0, CONFIG_init, CONFIG_callback },
|
||||
{PROTO_CONFIG, STR_CONFIG, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, 0, CONFIG_init, CONFIG_callback },
|
||||
#endif
|
||||
#if defined(ASSAN_NRF24L01_INO)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 2
|
||||
#define VERSION_PATCH_LEVEL 84
|
||||
#define VERSION_PATCH_LEVEL 85
|
||||
|
||||
#define MODE_SERIAL 0
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
//******************
|
||||
enum PROTOCOLS
|
||||
{
|
||||
//PROTO_CONFIG = 0, // Module config
|
||||
PROTO_FLYSKY = 1, // =>A7105
|
||||
PROTO_HUBSAN = 2, // =>A7105
|
||||
PROTO_FRSKYD = 3, // =>CC2500
|
||||
@@ -784,6 +783,8 @@ enum {
|
||||
#define SPEED_125K 3
|
||||
|
||||
/** EEPROM Layout */
|
||||
#define EEPROM_CID_INIT_OFFSET 0 // 1 byte flag that Cyrf ID is initialized
|
||||
#define EEPROM_CID_OFFSET 1 // 6 bytes Cyrf ID
|
||||
#define EEPROM_ID_OFFSET 10 // Module ID (4 bytes)
|
||||
#define EEPROM_BANK_OFFSET 15 // Current bank number (1 byte)
|
||||
#define EEPROM_ID_VALID_OFFSET 20 // 1 byte flag that ID is valid
|
||||
@@ -800,7 +801,8 @@ enum {
|
||||
#define FRSKYX_CLONE_EEPROM_OFFSET 822 // (1) format + (3) TX ID + (47) channels, 51 bytes, end is 873
|
||||
#define FRSKYX2_CLONE_EEPROM_OFFSET 873 // (1) format + (3) TX ID, 4 bytes, end is 877
|
||||
#define DSM_RX_EEPROM_OFFSET 877 // (4) TX ID + format, 5 bytes, end is 882
|
||||
//#define CONFIG_EEPROM_OFFSET 882 // Current configuration of the multimodule
|
||||
#define MOULDKG_EEPROM_OFFSET 882 // RX ID, 3 bytes per model, end is 882+64*3=1074
|
||||
//#define CONFIG_EEPROM_OFFSET 1074 // Current configuration of the multimodule
|
||||
|
||||
/* STM32 Flash Size */
|
||||
#ifndef DISABLE_FLASH_SIZE_CHECK
|
||||
|
||||
@@ -190,7 +190,7 @@ static void multi_send_status()
|
||||
// Protocol next/prev
|
||||
if(multi_protocols[multi_protocols_index+1].protocol != 0xFF)
|
||||
{
|
||||
if(multi_protocols[multi_protocols_index+1].protocol == PROTO_SCANNER)
|
||||
if(multi_protocols[multi_protocols_index+1].protocol == PROTO_SCANNER )//|| multi_protocols[multi_protocols_index+1].protocol == PROTO_CONFIG )
|
||||
{// if next is scanner
|
||||
if(multi_protocols[multi_protocols_index+2].protocol != 0xFF)
|
||||
Serial_write(multi_protocols[multi_protocols_index+2].protocol); // skip to next protocol number
|
||||
@@ -204,7 +204,7 @@ static void multi_send_status()
|
||||
Serial_write(multi_protocols[multi_protocols_index].protocol); // end of list
|
||||
if(multi_protocols_index>0 && multi_protocols[multi_protocols_index-1].protocol != 0)
|
||||
{
|
||||
if(multi_protocols[multi_protocols_index-1].protocol==PROTO_SCANNER)
|
||||
if(multi_protocols[multi_protocols_index-1].protocol == PROTO_SCANNER )//|| multi_protocols[multi_protocols_index-1].protocol == PROTO_CONFIG )
|
||||
{// if prev is scanner
|
||||
if(multi_protocols_index > 1)
|
||||
Serial_write(multi_protocols[multi_protocols_index-2].protocol); // skip to prev protocol number
|
||||
|
||||
@@ -168,6 +168,9 @@
|
||||
//All the protocols will not fit in the Atmega328p module so you need to pick and choose.
|
||||
//Comment the protocols you are not using with "//" to save Flash space.
|
||||
|
||||
//Protocol for module configuration
|
||||
#define MULTI_CONFIG_INO
|
||||
|
||||
//The protocols below need an A7105 to be installed
|
||||
#define AFHDS2A_A7105_INO
|
||||
#define AFHDS2A_RX_A7105_INO
|
||||
|
||||
Reference in New Issue
Block a user