mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-09 22:28:12 +00:00
MLink: added voltage, current, rpm, temp sensors and lqi
This commit is contained in:
parent
6ba1c8b118
commit
0cf58c2990
@ -257,30 +257,62 @@ static void __attribute__((unused)) MLINK_send_data_packet()
|
|||||||
#ifdef MLINK_HUB_TELEMETRY
|
#ifdef MLINK_HUB_TELEMETRY
|
||||||
static void __attribute__((unused)) MLINK_Send_Telemetry()
|
static void __attribute__((unused)) MLINK_Send_Telemetry()
|
||||||
{ // not sure how MLINK telemetry works, the 2 RXs I have are sending something completly different...
|
{ // not sure how MLINK telemetry works, the 2 RXs I have are sending something completly different...
|
||||||
RX_RSSI = TX_LQI;
|
telemetry_counter += 2; // TX LQI counter
|
||||||
|
telemetry_link = 1;
|
||||||
|
|
||||||
if(packet_in[0]==0x13)
|
if(packet_in[0]==0x13)
|
||||||
{ // RX-9-DR : 13 1A C8 00 01 64 00
|
{ // RX-9-DR : 13 1A C8 00 01 64 00
|
||||||
v_lipo1 = packet_in[5*2]; // Rx_Batt*20
|
uint8_t id;
|
||||||
}
|
for(uint i=1; i<5; i+=3)
|
||||||
|
{//2 sensors per packet
|
||||||
if(packet_in[0]==0x03)
|
id=0x00;
|
||||||
{ // RX-5 : 03 15 23 00 00 01 02
|
switch(packet_in[i]&0x0F)
|
||||||
//Incoming packet values
|
{
|
||||||
RX_RSSI = packet_in[2*2]<<1; // Looks to be the RX RSSI value
|
case 1: //voltage
|
||||||
RX_LQI = packet_in[5*2]; // Looks to be connection lost
|
if((packet_in[i]&0xF0) == 0x00)
|
||||||
|
v_lipo1 = packet_in[i+1]; // Rx_Batt*20
|
||||||
|
else
|
||||||
|
v_lipo2 = packet_in[i+1];
|
||||||
|
break;
|
||||||
|
case 2: //current
|
||||||
|
id = 0x28;
|
||||||
|
break;
|
||||||
|
case 5: //rpm
|
||||||
|
id = 0x03;
|
||||||
|
break;
|
||||||
|
case 6: //temp
|
||||||
|
id = 0x02;
|
||||||
|
break;
|
||||||
|
case 10: //lqi
|
||||||
|
RX_RSSI=RX_LQI=packet_in[i+1]>>1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#if defined HUB_TELEMETRY
|
||||||
|
if(id)
|
||||||
|
{
|
||||||
|
uint16_t val=((packet_in[i+2]&0x80)<<8)|((packet_in[i+2]&0x7F)<<7)|(packet_in[i+1]>>1); //remove the alarm LSB bit, move the sign bit to MSB
|
||||||
|
frsky_send_user_frame(id, val, val>>8);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if(packet_in[0]==0x03)
|
||||||
|
{ // RX-5 : 03 15 23 00 00 01 02
|
||||||
|
//Incoming packet values
|
||||||
|
RX_RSSI = packet_in[2]<<1; // Looks to be the RX RSSI value
|
||||||
|
RX_LQI = packet_in[5]; // Looks to be connection lost
|
||||||
|
}
|
||||||
|
else
|
||||||
|
RX_RSSI = TX_LQI;
|
||||||
|
|
||||||
// Read TX RSSI
|
// Read TX RSSI
|
||||||
TX_RSSI = CYRF_ReadRegister(CYRF_13_RSSI)&0x1F;
|
TX_RSSI = CYRF_ReadRegister(CYRF_13_RSSI)&0x1F;
|
||||||
|
|
||||||
telemetry_counter++; // TX LQI counter
|
|
||||||
telemetry_link = 1;
|
|
||||||
|
|
||||||
if(telemetry_lost)
|
if(telemetry_lost)
|
||||||
{
|
{
|
||||||
telemetry_lost = 0;
|
telemetry_lost = 0;
|
||||||
packet_count = 100;
|
packet_count = 50;
|
||||||
telemetry_counter = 100;
|
telemetry_counter = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +449,7 @@ uint16_t ReadMLINK()
|
|||||||
#ifdef MLINK_HUB_TELEMETRY
|
#ifdef MLINK_HUB_TELEMETRY
|
||||||
//TX LQI calculation
|
//TX LQI calculation
|
||||||
packet_count++;
|
packet_count++;
|
||||||
if(packet_count>=100)
|
if(packet_count>=50)
|
||||||
{
|
{
|
||||||
packet_count=0;
|
packet_count=0;
|
||||||
TX_LQI=telemetry_counter;
|
TX_LQI=telemetry_counter;
|
||||||
@ -443,8 +475,9 @@ uint16_t ReadMLINK()
|
|||||||
crc8=bit_reverse(MLINK_CRC_Init);
|
crc8=bit_reverse(MLINK_CRC_Init);
|
||||||
for(uint8_t i=0;i<MLINK_PACKET_SIZE-1;i++)
|
for(uint8_t i=0;i<MLINK_PACKET_SIZE-1;i++)
|
||||||
{
|
{
|
||||||
crc8_update(bit_reverse(packet_in[i<<1]));
|
packet_in[i]=packet_in[i<<1];
|
||||||
debug(" %02X",packet_in[i<<1]);
|
crc8_update(bit_reverse(packet_in[i]));
|
||||||
|
debug(" %02X",packet_in[i]);
|
||||||
}
|
}
|
||||||
if(packet_in[14] == bit_reverse(crc8)) // Packet CRC is ok
|
if(packet_in[14] == bit_reverse(crc8)) // Packet CRC is ok
|
||||||
MLINK_Send_Telemetry();
|
MLINK_Send_Telemetry();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 2
|
#define VERSION_REVISION 2
|
||||||
#define VERSION_PATCH_LEVEL 30
|
#define VERSION_PATCH_LEVEL 31
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
|
@ -840,7 +840,7 @@ bool Update_All()
|
|||||||
update_led_status();
|
update_led_status();
|
||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
||||||
if((protocol == PROTO_BAYANG_RX) || (protocol == PROTO_AFHDS2A_RX) || (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_HOTT) || (protocol==PROTO_PROPEL) || (protocol==PROTO_OMP) || (protocol==PROTO_DEVO) || (protocol==PROTO_DSM_RX) || (protocol==PROTO_FRSKY_R9) || (protocol==PROTO_RLINK) || (protocol==PROTO_WFLY2) || (protocol==PROTO_LOLI))
|
if((protocol == PROTO_BAYANG_RX) || (protocol == PROTO_AFHDS2A_RX) || (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_HOTT) || (protocol==PROTO_PROPEL) || (protocol==PROTO_OMP) || (protocol==PROTO_DEVO) || (protocol==PROTO_DSM_RX) || (protocol==PROTO_FRSKY_R9) || (protocol==PROTO_RLINK) || (protocol==PROTO_WFLY2) || (protocol==PROTO_LOLI) || (protocol==PROTO_MLINK))
|
||||||
#endif
|
#endif
|
||||||
if(IS_DISABLE_TELEM_off)
|
if(IS_DISABLE_TELEM_off)
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
|
@ -531,7 +531,7 @@ void frsky_link_frame()
|
|||||||
telemetry_link |= 2 ; // Send hub if available
|
telemetry_link |= 2 ; // Send hub if available
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//PROTO_HUBSAN, PROTO_AFHDS2A, PROTO_BAYANG, PROTO_NCC1701, PROTO_CABELL, PROTO_HITEC, PROTO_BUGS, PROTO_BUGSMINI, PROTO_FRSKYX, PROTO_FRSKYX2, PROTO_PROPEL, PROTO_DEVO, PROTO_RLINK, PROTO_OMP, PROTO_WFLY2, PROTO_LOLI
|
{//PROTO_HUBSAN, PROTO_AFHDS2A, PROTO_BAYANG, PROTO_NCC1701, PROTO_CABELL, PROTO_HITEC, PROTO_BUGS, PROTO_BUGSMINI, PROTO_FRSKYX, PROTO_FRSKYX2, PROTO_PROPEL, PROTO_DEVO, PROTO_RLINK, PROTO_OMP, PROTO_WFLY2, PROTO_LOLI, PROTO_MLINK
|
||||||
frame[1] = v_lipo1;
|
frame[1] = v_lipo1;
|
||||||
frame[2] = v_lipo2;
|
frame[2] = v_lipo2;
|
||||||
frame[3] = RX_RSSI;
|
frame[3] = RX_RSSI;
|
||||||
@ -975,14 +975,14 @@ void TelemetryUpdate()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( telemetry_link & 1 )
|
if( telemetry_link & 1 )
|
||||||
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell + Hitec + Bugs + BugsMini + NCC1701 + PROPEL + RLINK + OMP
|
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell + Hitec + Bugs + BugsMini + NCC1701 + PROPEL + RLINK + OMP + MLINK
|
||||||
// FrSkyX telemetry if in PPM
|
// FrSkyX telemetry if in PPM
|
||||||
frsky_link_frame();
|
frsky_link_frame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined HUB_TELEMETRY
|
#if defined HUB_TELEMETRY
|
||||||
if((telemetry_link & 2) && ( protocol == PROTO_FRSKYD || protocol == PROTO_BAYANG ) )
|
if((telemetry_link & 2) && ( protocol == PROTO_FRSKYD || protocol == PROTO_BAYANG || protocol == PROTO_MLINK ) )
|
||||||
{ // FrSkyD
|
{ // FrSkyD + Bayang + MLINK
|
||||||
frsky_user_frame();
|
frsky_user_frame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user