multiwii / baseflight

32 bit fork of the MultiWii RC flight controller firmware
500 stars 356 forks source link

Spektrum DSMX satellite 8th channel support #181

Closed jaahaavi closed 10 years ago

jaahaavi commented 10 years ago

Added support for 8th channel when using Spektrum DSMX satellite. (old 1024 resolution 22ms DSM2 still work with 7 channels because those doesn't support more than 7 channels)

jaahaavi commented 10 years ago

It seems that this these GIT commits aren't like version control "tasks" I am used to do. It took automatically my next commit to this request... Does it matter that both "Spektrum DSMX 8 ch support" and "Spektrum satellite binding" are under this request?

trollcop commented 10 years ago

Yes, the patch is simple enough so that 8ch and bind can be submitted at once. however, do fix the formatting.

jaahaavi commented 10 years ago

It seems that my Eclipse is autoformatting all the edited code :( I have fixed formatting with Notepad2.

trollcop commented 10 years ago

Almost there.

jaahaavi commented 10 years ago

Corrected formatting.

trollcop commented 10 years ago

What happens once spektrum sat is bound? Shouldn't the 'bind' value reset to zero on next reboot?

norem commented 10 years ago

Softserial causes problems with sonar when enabled, can we peek at this issue while doing this update, What I have seen is enabling Softserial modifies the pulse on channels 7 and 8.

trollcop commented 10 years ago

Unlikely, but you're welcome to come up with a test case

On Mon, Nov 3, 2014 at 10:34 PM, norem notifications@github.com wrote:

Softserial causes problems with sonar when enabled, can we peek at this issue while doing this update, What I have seen is enabling Softserial modifies the pulse on channels 7 and 8.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61477378.

norem commented 10 years ago

With a scope on pin 7 and Softserial disabled signal is clean pulse rail to rail, then enable Softserial signal no longer able to pull trigger line of HC-SR04 to ground.

I’ll grab this latest code and see if it still does that…

From: dongie [mailto:notifications@github.com] Sent: Monday, November 3, 2014 8:35 AM To: multiwii/baseflight Cc: norem Subject: Re: [baseflight] Spektrum DSMX satellite 8th channel support (#181)

Unlikely, but you're welcome to come up with a test case

On Mon, Nov 3, 2014 at 10:34 PM, norem <notifications@github.com mailto:notifications@github.com > wrote:

Softserial causes problems with sonar when enabled, can we peek at this issue while doing this update, What I have seen is enabling Softserial modifies the pulse on channels 7 and 8.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61477378.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61477448 . https://github.com/notifications/beacon/AC1X8481LVeLtQUPuc9haNh4qJyfkmCVks5nJ3wYgaJpZM4C2NPC.gif

trollcop commented 10 years ago

I'm sure that woudln't have anything to do wiht the fact that the sonar garbage is 5V etc.

On Mon, Nov 3, 2014 at 10:42 PM, norem notifications@github.com wrote:

With a scope on pin 7 and Softserial disabled signal is clean pulse rail to rail, then enable Softserial signal no longer able to pull trigger line of HC-SR04 to ground.

I’ll grab this latest code and see if it still does that…

From: dongie [mailto:notifications@github.com] Sent: Monday, November 3, 2014 8:35 AM To: multiwii/baseflight Cc: norem Subject: Re: [baseflight] Spektrum DSMX satellite 8th channel support (#181)

Unlikely, but you're welcome to come up with a test case

On Mon, Nov 3, 2014 at 10:34 PM, norem <notifications@github.com <mailto: notifications@github.com> > wrote:

Softserial causes problems with sonar when enabled, can we peek at this issue while doing this update, What I have seen is enabling Softserial modifies the pulse on channels 7 and 8.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61477378.

— Reply to this email directly or view it on GitHub < https://github.com/multiwii/baseflight/pull/181#issuecomment-61477448> . < https://github.com/notifications/beacon/AC1X8481LVeLtQUPuc9haNh4qJyfkmCVks5nJ3wYgaJpZM4C2NPC.gif>

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61478219.

norem commented 10 years ago

Agreed it probably doesn’t help… but can still see the pulse is changed with channel 7 left disconnected and enabling Softserial, suggesting Softserial modifies this ports settings regardless of Sonar being enabled.

From: dongie [mailto:notifications@github.com] Sent: Monday, November 3, 2014 8:44 AM To: multiwii/baseflight Cc: norem Subject: Re: [baseflight] Spektrum DSMX satellite 8th channel support (#181)

I'm sure that woudln't have anything to do wiht the fact that the sonar garbage is 5V etc.

On Mon, Nov 3, 2014 at 10:42 PM, norem <notifications@github.com mailto:notifications@github.com > wrote:

With a scope on pin 7 and Softserial disabled signal is clean pulse rail to rail, then enable Softserial signal no longer able to pull trigger line of HC-SR04 to ground.

I’ll grab this latest code and see if it still does that…

From: dongie [mailto:notifications@github.com] Sent: Monday, November 3, 2014 8:35 AM To: multiwii/baseflight Cc: norem Subject: Re: [baseflight] Spektrum DSMX satellite 8th channel support (#181)

Unlikely, but you're welcome to come up with a test case

On Mon, Nov 3, 2014 at 10:34 PM, norem <notifications@github.com mailto:notifications@github.com%20%3cmailto:%20%0b <mailto: notifications@github.com mailto:notifications@github.com > > wrote:

Softserial causes problems with sonar when enabled, can we peek at this issue while doing this update, What I have seen is enabling Softserial modifies the pulse on channels 7 and 8.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61477378.

— Reply to this email directly or view it on GitHub < https://github.com/multiwii/baseflight/pull/181#issuecomment-61477448> . < https://github.com/notifications/beacon/AC1X8481LVeLtQUPuc9haNh4qJyfkmCVks5nJ3wYgaJpZM4C2NPC.gif>

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61478219.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61478360 . https://github.com/notifications/beacon/AC1X85zm0REwbcZDgSloi9ZKlbIUyL3eks5nJ34CgaJpZM4C2NPC.gif

trollcop commented 10 years ago

Most likely, again, the code is open, knock yourself out.

On Mon, Nov 3, 2014 at 10:56 PM, norem notifications@github.com wrote:

Agreed it probably doesn’t help… but can still see the pulse is changed with channel 7 left disconnected and enabling Softserial, suggesting Softserial modifies this ports settings regardless of Sonar being enabled.

From: dongie [mailto:notifications@github.com] Sent: Monday, November 3, 2014 8:44 AM To: multiwii/baseflight Cc: norem Subject: Re: [baseflight] Spektrum DSMX satellite 8th channel support (#181)

I'm sure that woudln't have anything to do wiht the fact that the sonar garbage is 5V etc.

On Mon, Nov 3, 2014 at 10:42 PM, norem <notifications@github.com <mailto: notifications@github.com> > wrote:

With a scope on pin 7 and Softserial disabled signal is clean pulse rail to rail, then enable Softserial signal no longer able to pull trigger line of HC-SR04 to ground.

I’ll grab this latest code and see if it still does that…

From: dongie [mailto:notifications@github.com] Sent: Monday, November 3, 2014 8:35 AM To: multiwii/baseflight Cc: norem Subject: Re: [baseflight] Spektrum DSMX satellite 8th channel support (#181)

Unlikely, but you're welcome to come up with a test case

On Mon, Nov 3, 2014 at 10:34 PM, norem <notifications@github.com mailto:notifications@github.com%20%3cmailto:%20%0b <mailto: notifications@github.com mailto:notifications@github.com > > wrote:

Softserial causes problems with sonar when enabled, can we peek at this issue while doing this update, What I have seen is enabling Softserial modifies the pulse on channels 7 and 8.

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61477378.

— Reply to this email directly or view it on GitHub < https://github.com/multiwii/baseflight/pull/181#issuecomment-61477448> . <

https://github.com/notifications/beacon/AC1X8481LVeLtQUPuc9haNh4qJyfkmCVks5nJ3wYgaJpZM4C2NPC.gif>

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61478219.

— Reply to this email directly or view it on GitHub < https://github.com/multiwii/baseflight/pull/181#issuecomment-61478360> . < https://github.com/notifications/beacon/AC1X85zm0REwbcZDgSloi9ZKlbIUyL3eks5nJ34CgaJpZM4C2NPC.gif>

— Reply to this email directly or view it on GitHub https://github.com/multiwii/baseflight/pull/181#issuecomment-61480013.

jaahaavi commented 10 years ago

For the question: "What happens once spektrum sat is bound? Shouldn't the 'bind' value reset to zero on next reboot?" User has to manually set the bind value back to zero. I thought about some kind of reboot counter, but I think it's better that user knows that it's always in bind mode when user has enabled it and user has to disable it manually. The reason is that satellite has to be powered off before it can be entered into binding mode. After power on satellite has only about 140ms when it can be entered to bind mode. So user has to take power off and then power on before binding can be started (software reboot isn't enough).

trollcop commented 10 years ago

Right, but I'm thinking, once the bind has been completed (spektrumBind is over), if it was successful or not, it might not be a bad idea to reset bind back to zero and save eeprom. Just wondering what do you think, since then the user doesn't need to do anything else to continue to use the stuff.

By the way, I changed some of the logic for bind/more channels selection, you should check it out.

jaahaavi commented 10 years ago

It would be nicer if it user doesn't need to put the bind back to zero, but the reason why I didn't do it was where to put that reset thing? Reason for that is that spektrumBind function only takes less than 140ms and then Naze32 continues it's normal start up and satellite goes to bind mode. Binding the satellite can take minutes depending how slow user are with transmitter. After thinking this the only way to figure out the if the binding was successful what came to my mind is in that if statement where we reset failsafeCnt (in the spektrumDataReceive function). That function is called all the time, but that statement is true only when frame is completed (11ms). I think one new if statement where we check "if (mcfg.spektrum_sat_bind != 0)" doesn't kill the cpu with load when it's called over 90 times per second.