SBUS center at 1488

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download

SBUS center at 1488

Postby Plüschi » Sat Aug 24, 2013 5:57 am

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 1486

With 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 :o
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: SBUS center at 1488

Postby brm » Sat Aug 24, 2013 6:14 pm

futaba is different.
calibrate your Radio before u use it.
brm
 
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: SBUS center at 1488

Postby Plüschi » Sat Aug 24, 2013 6:23 pm

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.
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: SBUS center at 1488

Postby -ralf- » Sat Aug 24, 2013 8:51 pm

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

Code: Select all
#define MIDRC 1488


in config.h ?

But you're right, a constant to change to 1500 would be nice ....
-ralf-
 
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: SBUS center at 1488

Postby Plüschi » Sat Aug 24, 2013 10:58 pm

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
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: SBUS center at 1488

Postby -ralf- » Mon Aug 26, 2013 9:37 am

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 ?
-ralf-
 
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: SBUS center at 1488

Postby Plüschi » Tue Aug 27, 2013 2:40 am

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 */
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: SBUS center at 1488

Postby timecop » Tue Aug 27, 2013 3:45 am

SBUS center at 1488

It's a conspiracy.
timecop
 
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: SBUS center at 1488

Postby -ralf- » Thu Aug 29, 2013 6:03 pm

@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 ....
-ralf-
 
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: SBUS center at 1488

Postby Mis » Thu Aug 29, 2013 9:07 pm

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.
Mis
 
Posts: 203
Joined: Fri Apr 01, 2011 12:23 am

Re: SBUS center at 1488

Postby -ralf- » Tue Sep 10, 2013 10:49 am

You're right ..... I'm a fool.

But can someone implement the "SBUS_MID_OFFSET" in the official dev?
-ralf-
 
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm


Return to Software development

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron