mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2026-12-06 07:37:38 +00:00
FrSkyA: FrSky ACCESS on the CC2500 (#1214)
* FrSky X: S.Port frames to the receiver stored at payload[i-start-2]
FrSkyX_seq_sport() (SPORT_SEND) stored the outgoing bytes at
payload[i-start+2], i.e. payload[4] to payload[11] for the 8 bytes of
an LBT packet: up to 4 bytes past each frame's 8-byte payload (into the
next frame's count and payload, past the array for frame 3). The
retransmits sent payload[i] and payload[i-start+2], bytes from beyond
the frame. All three now use payload[i-start-2] (0 to 7).
* FrSkyA: FrSky ACCESS on the CC2500
New protocol 112, subtypes 16ch, 8ch (FCC) and EU16ch, EU8ch (only the
region flag differs: ACCESS uses the same channels, hops and timing in
both). Reversed from the ISRM and RX6R firmwares and captures of an X9
Lite with an RX6R; same CC2500 PHY as Mike's UNI ACCESS.
- register (channel 0) and bind (channel 239) in the same bind
- 16 or 8 channels every 7 ms, D16 channel packing, extended limits
- failsafe: one channel per frame in its slot, as the ISRM
- telemetry: RSSI / RxBatt and the S.Port stream as D16, S.Port packets
from the radio sent to the receiver (SportQueue(), split out of the
serial input for FrSkyX/X2/R9)
- receiver settings and hardware info (PXX2 messages 5 and 6) between
the receiver and a Lua script, MULTI telemetry type 18 ("Pipe") and
serial frames of 2 to 7 extra bytes
- not on the atmega328p nor in the 64KB CC2500 release (size)
Tested with an RX6R (ACCESS 2.1.8) and an Archer Plus SR10+ (1.0.10,
3.0.3): bind, channels, failsafe (S.Bus output), telemetry, receiver
settings and the SR10+ stabilizer settings over S.Port.
Needs FrSkyX_seq_sport() fixed (#1203): its resends overflowed and
froze the hopping at the first S.Port packet.
* Lua: FrSky ACCESS RX, receiver options for FrSkyA
The receiver options page of an ACCESS module for a receiver bound
with FrSkyA: name and versions, fast PWM, telemetry and 25mW,
S.Port/F.Port/F.Port2, S.Bus 24, PWM on CH5/CH6, the channel or port
mode of each output. Rows follow the capabilities the receiver
reports. Uses the Multi Lua pipe (multiBuffer "Pipe").
* FrSkyA Lua: receiver IDs 81 to 85
Names for the newer ACCESS receivers (SR6BL15A, SR6Lite, R6Lite,
RS-Lite, R2SIM), so an R6Lite shows by name instead of "ID 83".
---------
Co-authored-by: Raphael Coeffic <1050031+raphaelcoeffic@users.noreply.github.com>
Co-authored-by: pascallanger <pascal_langer@yahoo.fr>
This commit is contained in:
13 files changed
+1154
-53
No files matched your search
@@ -693,6 +693,55 @@ void setup()
|
||||
|
||||
// Main
|
||||
// Protocol scheduler
|
||||
#ifdef SPORT_SEND
|
||||
// One S.Port packet from the radio (physical ID, primId, data ID, value; no
|
||||
// CRC) into the stuffed downlink stream (FrSky X, X2, ACCESS, R9)
|
||||
void SportQueue(const uint8_t *b)
|
||||
{
|
||||
#define BYTE_STUFF 0x7D
|
||||
#define STUFF_MASK 0x20
|
||||
//debug("SPort_in: ");
|
||||
boolean sport_valid=false;
|
||||
for(uint8_t i=1;i<8;i++)
|
||||
if(b[i]!=0) sport_valid=true; //Check that the payload is not full of 0
|
||||
if((b[0]&0x1F) > 0x1B) //Check 1st byte validity
|
||||
sport_valid=false;
|
||||
if(sport_valid)
|
||||
{
|
||||
SportData[SportTail]=0x7E;
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
SportData[SportTail]=b[0]&0x1F;
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
for(uint8_t i=1;i<8;i++)
|
||||
{
|
||||
if( (b[i]==BYTE_STUFF) || (b[i]==0x7E) )
|
||||
{//stuff
|
||||
SportData[SportTail]=BYTE_STUFF;
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
SportData[SportTail]=b[i]^STUFF_MASK;
|
||||
}
|
||||
else
|
||||
SportData[SportTail]=b[i];
|
||||
//debug("%02X ",SportData[SportTail]);
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
}
|
||||
uint8_t used = SportTail;
|
||||
if ( SportHead > SportTail )
|
||||
used += MAX_SPORT_BUFFER - SportHead ;
|
||||
else
|
||||
used -= SportHead ;
|
||||
if ( used >= MAX_SPORT_BUFFER-(MAX_SPORT_BUFFER>>2) )
|
||||
{
|
||||
DATA_BUFFER_LOW_on;
|
||||
//Send Multi Status ASAP to inform the TX
|
||||
SEND_MULTI_STATUS_on;
|
||||
Update_Telem();
|
||||
debugln("Low buf=%d,h=%d,t=%d",used,SportHead,SportTail);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void loop()
|
||||
{
|
||||
uint16_t next_callback, diff;
|
||||
@@ -769,7 +818,7 @@ void loop()
|
||||
void End_Bind()
|
||||
{
|
||||
//Request protocol to terminate bind
|
||||
if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYL || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYV || protocol==PROTO_FRSKY_R9
|
||||
if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYL || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYA || protocol==PROTO_FRSKYV || protocol==PROTO_FRSKY_R9
|
||||
|| protocol==PROTO_DSM_RX || protocol==PROTO_AFHDS2A_RX || protocol==PROTO_FRSKY_RX || protocol==PROTO_BAYANG_RX
|
||||
|| protocol==PROTO_AFHDS2A || protocol==PROTO_BUGS || protocol==PROTO_BUGSMINI || protocol==PROTO_HOTT || protocol==PROTO_ASSAN)
|
||||
BIND_DONE;
|
||||
@@ -1529,50 +1578,8 @@ void update_serial_data()
|
||||
}
|
||||
#endif
|
||||
#ifdef SPORT_SEND
|
||||
if((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKY_R9) && rx_len==27+8)
|
||||
{//Protocol waiting for 8 bytes
|
||||
#define BYTE_STUFF 0x7D
|
||||
#define STUFF_MASK 0x20
|
||||
//debug("SPort_in: ");
|
||||
boolean sport_valid=false;
|
||||
for(uint8_t i=28;i<28+7;i++)
|
||||
if(rx_ok_buff[i]!=0) sport_valid=true; //Check that the payload is not full of 0
|
||||
if((rx_ok_buff[27]&0x1F) > 0x1B) //Check 1st byte validity
|
||||
sport_valid=false;
|
||||
if(sport_valid)
|
||||
{
|
||||
SportData[SportTail]=0x7E;
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
SportData[SportTail]=rx_ok_buff[27]&0x1F;
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
for(uint8_t i=28;i<28+7;i++)
|
||||
{
|
||||
if( (rx_ok_buff[i]==BYTE_STUFF) || (rx_ok_buff[i]==0x7E) )
|
||||
{//stuff
|
||||
SportData[SportTail]=BYTE_STUFF;
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
SportData[SportTail]=rx_ok_buff[i]^STUFF_MASK;
|
||||
}
|
||||
else
|
||||
SportData[SportTail]=rx_ok_buff[i];
|
||||
//debug("%02X ",SportData[SportTail]);
|
||||
SportTail = (SportTail+1) & (MAX_SPORT_BUFFER-1);
|
||||
}
|
||||
uint8_t used = SportTail;
|
||||
if ( SportHead > SportTail )
|
||||
used += MAX_SPORT_BUFFER - SportHead ;
|
||||
else
|
||||
used -= SportHead ;
|
||||
if ( used >= MAX_SPORT_BUFFER-(MAX_SPORT_BUFFER>>2) )
|
||||
{
|
||||
DATA_BUFFER_LOW_on;
|
||||
//Send Multi Status ASAP to inform the TX
|
||||
SEND_MULTI_STATUS_on;
|
||||
Update_Telem();
|
||||
debugln("Low buf=%d,h=%d,t=%d",used,SportHead,SportTail);
|
||||
}
|
||||
}
|
||||
}
|
||||
if((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYA || protocol==PROTO_FRSKY_R9) && rx_len==27+8)
|
||||
SportQueue((const uint8_t *)&rx_ok_buff[27]); //Protocol waiting for 8 bytes
|
||||
#endif //SPORT_SEND
|
||||
#ifdef HOTT_FW_TELEMETRY
|
||||
if(protocol==PROTO_HOTT && rx_len==27+1)
|
||||
@@ -1595,6 +1602,12 @@ void update_serial_data()
|
||||
CONFIG_SerialRX=true;
|
||||
}
|
||||
#endif
|
||||
#if defined(FRSKYA_CC2500_INO)
|
||||
if(protocol==PROTO_FRSKYA && rx_len>27+1 && rx_len<27+8)
|
||||
{//Lua/multiBuffer message (8 bytes = S.Port)
|
||||
FrSkyA_lua_in((const uint8_t *)&rx_ok_buff[27], rx_len-27);
|
||||
}
|
||||
#endif
|
||||
#ifdef RLINK_HUB_TELEMETRY
|
||||
if(protocol==PROTO_RLINK && sub_protocol==RLINK_DUMBORC_P
|
||||
&& rx_len>27 && rx_len<=27+sizeof(RLINK_SerialRX_val))
|
||||
@@ -1856,7 +1869,7 @@ void PPM_Telemetry_serial_init()
|
||||
)
|
||||
initTXSerial( SPEED_9600 ) ;
|
||||
#ifndef TELEMETRY_FRSKYX_TO_FRSKYD
|
||||
if(protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2)
|
||||
if(protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYA)
|
||||
initTXSerial( SPEED_57600 ) ;
|
||||
#endif
|
||||
if(protocol==PROTO_DSM)
|
||||
|
||||
Reference in new issue
Block a user