S.Bus is broken again in r1449

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

S.Bus is broken again in r1449

Post by -ralf- »

Hi developers,

I just compiled r1449 (with latest GUI) ..... S.Bus is broken again.
I don't know where to fix this because the old fix doesn't match the code in serial.ino.

Please help and make it work again.

Greetings

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Hi,

it seems to work when modifying serial.ino ...

Search for

while (cc-- GPS_COND SPEK_COND) {

Replace with

while (cc-- GPS_COND SPEK_COND && CURRENTPORT != 1) {

Correct? When so please modify official dev-release.

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Sorry developers,

I'm not a C-Coder so I have problems to understand your fantastic code.
I've tried some things like

#if defined(SBUS) && CURRENTPORT ==1
continue;
#endif

to avoid the code that brakes the rcvalues.

Itried this in the for and the while loop; but it doesnt't work.
And I am in fear of producing dangerous side effects.
Can you please help the few S.BUS-users and make
it working permanently?

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: S.Bus is broken again in r1449

Post by Plüschi »

Code: Select all

    #define SPEK_COND
    #if defined(SPEKTRUM) && (UART_NUMBER > 1)
      #define SPEK_COND  && (SPEK_SERIAL_PORT != CURRENTPORT)
    #endif
    #define SBUS_COND
    #if defined(SBUS) && (UART_NUMBER > 1)
      #define SBUS_COND  && (SBUS_SERIAL_PORT != CURRENTPORT)
    #endif
    while (SerialAvailable(CURRENTPORT) GPS_COND SPEK_COND SBUS_COND) {


But ... how can i commit the stuff to the shared area ???
Do i really have to install svn. No, please NO.

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Plüschi wrote:

Code: Select all

    #define SPEK_COND
    #if defined(SPEKTRUM) && (UART_NUMBER > 1)
      #define SPEK_COND  && (SPEK_SERIAL_PORT != CURRENTPORT)
    #endif
    #define SBUS_COND
    #if defined(SBUS) && (UART_NUMBER > 1)
      #define SBUS_COND  && (SBUS_SERIAL_PORT != CURRENTPORT)
    #endif
    while (SerialAvailable(CURRENTPORT) GPS_COND SPEK_COND SBUS_COND) {


But ... how can i commit the stuff to the shared area ???
Do i really have to install svn. No, please NO.


Plüschi,
it looks you modified an older version of serial.ino. The current version
looks like

Code: Select all

    #define SPEK_COND
    #if defined(SPEKTRUM) && (UART_NUMBER > 1)
      #define SPEK_COND  && (SPEK_SERIAL_PORT != CURRENTPORT)
    #endif
    uint8_t cc = SerialAvailable(CURRENTPORT);
    while (cc-- GPS_COND SPEK_COND) {
      uint8_t bytesTXBuff = ((uint8_t)(serialHeadTX[CURRENTPORT]-serialTailTX[CURRENTPORT]))%TX_BUFFER_SIZE; // indicates the number of occupied bytes in TX buffer
      if (bytesTXBuff > TX_BUFFER_SIZE - 50 ) return; // ensure there is enough free TX buffer to go further (50 bytes margin)
      c = SerialRead(CURRENTPORT);
      #ifdef SUPPRESS_ALL_SERIAL_MSP
        // no MSP handling, so go directly
        evaluateOtherData(c);
      #else

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: S.Bus is broken again in r1449

Post by Plüschi »

Wer macht auch so oberhässliche sachen?

Code: Select all

    #define SPEK_COND
    #if defined(SPEKTRUM) && (UART_NUMBER > 1)
      #define SPEK_COND  && (SPEK_SERIAL_PORT != CURRENTPORT)
    #endif
    #define SBUS_COND
    #if defined(SBUS) && (UART_NUMBER > 1)
      #define SBUS_COND  && (SBUS_SERIAL_PORT != CURRENTPORT)
    #endif
    uint8_t cc = SerialAvailable(CURRENTPORT);
    while (cc-- GPS_COND SPEK_COND SBUS_COND) {

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Plüschi wrote:Wer macht auch so oberhässliche sachen?

Code: Select all

    #define SPEK_COND
    #if defined(SPEKTRUM) && (UART_NUMBER > 1)
      #define SPEK_COND  && (SPEK_SERIAL_PORT != CURRENTPORT)
    #endif
    #define SBUS_COND
    #if defined(SBUS) && (UART_NUMBER > 1)
      #define SBUS_COND  && (SBUS_SERIAL_PORT != CURRENTPORT)
    #endif
    uint8_t cc = SerialAvailable(CURRENTPORT);
    while (cc-- GPS_COND SPEK_COND SBUS_COND) {


Compilation Error when using your mod .....
Serial.ino: In function 'void serialCom()':
Serial:171: error: 'SBUS_SERIAL_PORT' was not declared in this scope

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Now it works ....I added a line ...

#define SBUS_COND
#define SBUS_SERIAL_PORT 1
#if defined(SBUS) && (UART_NUMBER > 1)
#define SBUS_COND && (SBUS_SERIAL_PORT != CURRENTPORT)
#endif

Now I hope the developers will integrate this patch into serial.ino in _shared

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: S.Bus is broken again in r1449

Post by Plüschi »

Sbus port should go into config.h, 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



I would even go more radical on this.
Rename cc into num_avail.
Remove the restriction for port 0.
Dont do the while() if its not necessary.

Code: Select all

    #if defined(SPEKTRUM)
    if (SPEK_SERIAL_PORT != CURRENTPORT)
    #elif defined(SBUS)
    if (SBUS_SERIAL_PORT != CURRENTPORT)
    #endif
    {
      uint8_t num_avail = SerialAvailable(CURRENTPORT);
      while (num_avail-- GPS_COND)
      {
......
      }
    }

New line of Orangerx SBUS DSMX receiver. 30$ a pop
New line of Orangerx SBUS DSMX receiver. 30$ a pop
Last edited by Plüschi on Mon May 27, 2013 6:04 am, edited 1 time in total.

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Still not fixed in r1454 :oops:

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: S.Bus is broken again in r1449

Post by Alexinparis »

Hi,

@ralf,
nobody said it will never be fixed ;)

@Plüschi
did you think one second about GPS user ? (hint: promini)

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: S.Bus is broken again in r1449

Post by Plüschi »

>did you think one second about GPS user ?

Not a second. Thanks for fixing SBUS Alex :)

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Thanks Alex :D

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: S.Bus is broken again in r1449

Post by felixrising »

There you go gents! r1458 Thanks Alex! https://code.google.com/p/multiwii/source/detail?r=1458 :D

Nicksdesign
Posts: 63
Joined: Sat Jan 26, 2013 6:49 am

Re: S.Bus is broken again in r1449

Post by Nicksdesign »

I've been trying to get SBUS working for several days now. The link in the previoius post, leads to new config.h and serial files. Is there a way to get a full set of files?

Nick

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

http://multiwii.googlecode.com/svn/trunk/

Look at the _shared-folders .....

Nicksdesign
Posts: 63
Joined: Sat Jan 26, 2013 6:49 am

Re: S.Bus is broken again in r1449

Post by Nicksdesign »

Ralf, thank you very much for your help. Unfortunately, I didn't achieve success. Either I'm severely cut/copy/past challenged, or I am just confused and challenged in every possible way.

I went to http://multiwii.googlecode.com/svn/trun ... ii_shared/ and created a new sketch by replacing every file in an existing sketch with each of the files in that location. When attempting to compile, the number of errors generated is too large to even think about. Clearly I'm just not getting it. Four days of work with only frustration to show for it. For a guy that once could write code in about six different languages, this is very frustrating and humbling!

Is there anyone that has a fully working sketch, hopefully later than v2.2, that is known to work that they would be willing to share? Perhaps in a zip file that I can copy without screwing up?

Nick

-ralf-
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: S.Bus is broken again in r1449

Post by -ralf- »

Post your error messages ... and your config.h ....

Nicksdesign
Posts: 63
Joined: Sat Jan 26, 2013 6:49 am

Re: S.Bus is broken again in r1449

Post by Nicksdesign »

Ralf, I really appreciate your willingness to help. You asked, so here is the latest.

Output.ino: In function 'void writeServos()':
Output:159: error: 'atomicServo' was not declared in this scope

This is the section of code where the error is flagged.

Code: Select all

  #else
        for(uint8_t i = (SEC_SERVO_FROM-1); i < SEC_SERVO_TO; i++){
          #if defined(PROMINI) || (defined(PROMICRO) && defined(HWPWM6)) || (defined(MEGA) && defined(MEGA_HW_PWM_SERVOS))
            atomicServo[i] = (servo[i]-1000)>>2;
          #else
            atomicServo[i] = (servo[i]-1000)<<4;
          #endif


I've noticed that in many places above this in the output.ino file, atomicServo is defined within the function.

While writing the above, I was looking through the code and noticed the MEGA_HW_PWM_SERVOS. Because I am using a Mega2560 board, I left this defined. If I comment out that define, the code will compile. But, that brings up the question of why. I want to use the camera gimbal function.

Next, I put the missing camera stabilization defines back in config.h and recompiled. It compiles ok, and SBUS is working, but the gimbal servos are not being driven. Thus, it seems I just might need MEGA_HW_PWM_SERVOS defined. Could I be the only one running this code on a Mega and using the gimbals? Still a problem in output.ino?

You asked so here is my config.h: Well I had it in the post, but it's now too big to post. I really don't think the problem is in it. Unless someone can point me to a part of it to post, I'm going to go with the error being in somewhere else.

EDIT: Forget all this: Now what? The whole reason I wanted to use SBUS is so I could use VBAT. But, the price of loosing the camera gimbal is a bit much to pay. In addition, in spite of port K not being used as digital inputs, the pullup resister is still active.

SBUS problem solved and two new problems. Oh well. (I have an untried idea about how I just might get that darn pullup disabled. Four days of research may not be for naught!)


The camera gimbal functions do work. The gain and direction are being set in a new way. Thus explaining why the old defines are no longer in config.h.

Nick

Nicksdesign
Posts: 63
Joined: Sat Jan 26, 2013 6:49 am

Re: S.Bus is broken again in r1449

Post by Nicksdesign »

R1512 seems to be running ok, BUT it is clear it is meant to use a different config GUI. I see that there is a MultiWiiConf.pde file here: http://multiwii.googlecode.com/svn/trun ... nf_shared/ But I, of course, don't know what to do with it. I suspect some of the unexplained behavior I'm getting is because I need the config GUI to configure the program.

How do I get the new config GUI?

Nick

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: S.Bus is broken again in r1449

Post by scrat »

Nicksdesign wrote:R1512 seems to be running ok, BUT it is clear it is meant to use a different config GUI. I see that there is a MultiWiiConf.pde file here: http://multiwii.googlecode.com/svn/trun ... nf_shared/ But I, of course, don't know what to do with it. I suspect some of the unexplained behavior I'm getting is because I need the config GUI to configure the program.

How do I get the new config GUI?

Nick


You must compile GUI yourself and here is manual: viewtopic.php?f=18&t=190

Nicksdesign
Posts: 63
Joined: Sat Jan 26, 2013 6:49 am

Re: S.Bus is broken again in r1449

Post by Nicksdesign »

Scrat, and Ralf, I do appreciate your help. I'd be pretty stumped without. Please know that I am trying to get by on my own.

I had determined that I would need to compile the GUI source. I just didn't know how and was fearing that I would need to buy 'tools' that I couldn't afford. I did, however, indulge in the fantasy that someone just might take pity on me and offer to send me the result. In spite of a career in electronics and computer system design, I'm trying to limit myself to the one hobby of a user of this stuff. I've already spent all of my money on the parts. I'm very glad to learn that the 'stuff' needed won't cost me more than just work. Work is something I can do without spending more money.

Nick

Nicksdesign
Posts: 63
Joined: Sat Jan 26, 2013 6:49 am

Re: S.Bus is broken again in r1449

Post by Nicksdesign »

With the generous help, I have been successful in using SBUS with R1512. I still have a problem with VBAT, but that's for another thread.

Nick

Post Reply