Page 1 of 1
SBUS center at 1488
Posted: Sat Aug 24, 2013 5:57 am
by Plüschi
in RX.cpp, SBUS RX Data, void readSBus()
The offset used is
976 with the comment
// Perhaps you may change the term "/2+976" -> center will be 1486With my equipment the SBUS center is at 1488 which makes it difficult to arm the copter. I propose to change the
976 offset into
988 bringing the center spot on to
1500.
988 + 512 = 1500
Re: SBUS center at 1488
Posted: Sat Aug 24, 2013 6:14 pm
by brm
futaba is different.
calibrate your Radio before u use it.
Re: SBUS center at 1488
Posted: Sat Aug 24, 2013 6:23 pm
by Plüschi
So futaba is offset to my oerangerx sbus stuff? Got to keep if futaba compatible then
How about defining this offset as a constant and not as 16 times hardcoded? Would be easier to change it.
Re: SBUS center at 1488
Posted: Sat Aug 24, 2013 8:51 pm
by -ralf-
Plüschi wrote:So futaba is offset to my oerangerx sbus stuff? Got to keep if futaba compatible then
How about defining this offset as a constant and not as 16 times hardcoded? Would be easier to change it.
Cesco,
what's about
in config.h ?
But you're right, a constant to change to 1500 would be nice ....
Re: SBUS center at 1488
Posted: Sat Aug 24, 2013 10:58 pm
by Plüschi
Ralf,
Unluckily
#define MIDRC 1488 does not have any influence on
#define MINCHECK 1100 and
#define MAXCHECK 1900, so the arming problem persists.
And then, i like to swap RC systems. And i like standards like 1500. Im old, i like simple things
Edit: messed up colors
Re: SBUS center at 1488
Posted: Mon Aug 26, 2013 9:37 am
by -ralf-
Plüschi (and Alex),
can we go like this
Code: Select all
/******************************* SBUS RECIVER ************************************/
/* The following line apply only for Futaba S-Bus Receiver on MEGA boards at RX1 only (Serial 1).
You have to invert the S-Bus-Serial Signal e.g. with a Hex-Inverter like IC SN74 LS 04 */
//#define SBUS
//#define SBUS_SERIAL_PORT 1
//#define SBUS_MID_OFFSET 988
and use this in rx.cpp ?
Re: SBUS center at 1488
Posted: Tue Aug 27, 2013 2:40 am
by Plüschi
That is exactly what i have done locally.
The comment is also outdated.
Code: Select all
/* The following line apply only for Futaba S-Bus Receiver on MEGA or PROMICRO boards.
You have to invert the S-Bus-Serial Signal e.g. with a Hex-Inverter like IC SN74 LS 04 */
Re: SBUS center at 1488
Posted: Tue Aug 27, 2013 3:45 am
by timecop
Re: SBUS center at 1488
Posted: Thu Aug 29, 2013 6:03 pm
by -ralf-
@Plüschi (and all the other S.Bus-Folks);
can you test this for me (I'm on vacation and have no S.Bus hardware).
It allows to connect the S.Bus-RX direct to the FC (Software-Inverter).
Replace S.Bus-Section in rx.cpp
Code: Select all
/**************************************************************************************/
/*************** SBUS RX Data ********************/
/**************************************************************************************/
#if defined(SBUS)
void readSBus(){
#if defined(SBUS_SOFT_INVERT)
#define SBUS_SYNCBYTE 0xF0 // Not inverted
#else
#define SBUS_SYNCBYTE 0x0F // Hardware inverted
#endif
static uint16_t sbus[25]={0};
while(SerialAvailable(1)){
int val = SerialRead(1);
if(sbusIndex==0 && val != SBUS_SYNCBYTE)
continue;
#if defined(SBUS_SOFT_INVERT)
sbus[sbusIndex++] = (~val) & 0x00FF;
#else
sbus[sbusIndex++] = val;
#endif
if(sbusIndex==25){
sbusIndex=0;
rcValue[0] = ((sbus[1]|sbus[2]<< 8) & 0x07FF)/2+SBUS_MID_OFFSET; // SBUS_MID_OFFSET defined and set in config.h
rcValue[1] = ((sbus[2]>>3|sbus[3]<<5) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[2] = ((sbus[3]>>6|sbus[4]<<2|sbus[5]<<10) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[3] = ((sbus[5]>>1|sbus[6]<<7) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[4] = ((sbus[6]>>4|sbus[7]<<4) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[5] = ((sbus[7]>>7|sbus[8]<<1|sbus[9]<<9) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[6] = ((sbus[9]>>2|sbus[10]<<6) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[7] = ((sbus[10]>>5|sbus[11]<<3) & 0x07FF)/2+SBUS_MID_OFFSET; // & the other 8 + 2 channels if you need them
//The following lines: If you need more than 8 channels, max 16 analog + 2 digital. Must comment the not needed channels!
rcValue[8] = ((sbus[12]|sbus[13]<< 8) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[9] = ((sbus[13]>>3|sbus[14]<<5) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[10] = ((sbus[14]>>6|sbus[15]<<2|sbus[16]<<10) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[11] = ((sbus[16]>>1|sbus[17]<<7) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[12] = ((sbus[17]>>4|sbus[18]<<4) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[13] = ((sbus[18]>>7|sbus[19]<<1|sbus[20]<<9) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[14] = ((sbus[20]>>2|sbus[21]<<6) & 0x07FF)/2+SBUS_MID_OFFSET;
rcValue[15] = ((sbus[21]>>5|sbus[22]<<3) & 0x07FF)/2+;
// now the two Digital-Channels
if ((sbus[23]) & 0x0001) rcValue[16] = 2000; else rcValue[16] = 1000;
if ((sbus[23] >> 1) & 0x0001) rcValue[17] = 2000; else rcValue[17] = 1000;
// Failsafe: there is one Bit in the SBUS-protocol (Byte 25, Bit 4) whitch is the failsafe-indicator-bit
#if defined(FAILSAFE)
if (!((sbus[23] >> 3) & 0x0001))
{if(failsafeCnt > 20) failsafeCnt -= 20; else failsafeCnt = 0;} // clear FailSafe counter
#endif
}
}
}
#endif
In config.h S.Bus-section should look as this
Code: Select all
/******************************* SBUS RECIVER ************************************/
/* The following line apply only for Futaba S-Bus Receiver on MEGA boards at RX1 only (Serial 1).
You have to invert the S-Bus-Serial Signal e.g. with a Hex-Inverter like IC SN74 LS 04
or use SBUS_SOFT_INVERT to invert via Software */
#define SBUS
#define SBUS_SERIAL_PORT 1
#define SBUS_SOFT_INVERT
#define SBUS_MID_OFFSET 988 //SBUS Mid-Point at 1500
Thanks ....
Re: SBUS center at 1488
Posted: Thu Aug 29, 2013 9:07 pm
by Mis
This way not work. You inverting only data bits. Not the start and stop bits in serial transmision. In this case the serial receiver not work propertly.
Re: SBUS center at 1488
Posted: Tue Sep 10, 2013 10:49 am
by -ralf-
You're right ..... I'm a fool.
But can someone implement the "SBUS_MID_OFFSET" in the official dev?