Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing the minumum mmix number of motors for the warning to appear in the "Custom Airplane" mixer #4319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hntirgeam
Copy link
Contributor

image

I have discovered that the betaflight configurator gives a warning that I need to define 2+ motors in the “Custom Airplane” mixer mode.

I don't think this is expected behavior, because “Custom Airplane” can sometimes have no motors at all (gliders). Given that this case is very rare, it seems to me that the number of expected motors for this mode should be set to 1, not 2.

(perhaps 0 would even be a better choice, given the fact that in “Custom Airplane” you have to define mmix/smix yourself anyway)

The earliest commit defining 2 minimum motors can be found here: 6b3db9e

Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for origin-betaflight-app ready!

Name Link
🔨 Latest commit 4752d69
🔍 Latest deploy log https://app.netlify.com/sites/origin-betaflight-app/deploys/6793daa0dffcc100083b56de
😎 Deploy Preview https://deploy-preview-4319.dev.app.betaflight.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nerdCopter
Copy link
Member

@limonspb , can you verify and give insight. Does the code require 2, or just the configurator?

@haslinghuis
Copy link
Member

haslinghuis commented Jan 24, 2025

@nerdCopter see https://github.com/betaflight/betaflight/blob/c2768d0409a6dd6487bc88a0952079e3048ba43a/src/main/flight/mixer_init.c#L242-L274

(when one motor is required could use MIXER_FLYING_WING model)

@nerdCopter
Copy link
Member

nerdCopter commented Jan 24, 2025

i see 2 for custom-airplane, but 0 for custom (which also has false for servo by default)

    // motors, use servo, motor mixer
[...]    
    { 1, true,  mixerSingleProp },     // * MIXER_FLYING_WING
[...]
    { 0, false, NULL },                // MIXER_CUSTOM
    { 2, true,  NULL },                // MIXER_CUSTOM_AIRPLANE

so i presume there could be a workaround by using CUSTOM, but adding USE_WING & USER_SERVOS in cloud-build.
(or MIXER_FLYING_WING for 1 motor as @haslinghuis reported)
However, what is the "proper" fix (for 0 motor Glider)? Or do we even need such?

@hntirgeam
Copy link
Contributor Author

I had the following idea in my head: if there is a CUSTOM mode, in which by default there is nothing mapped (no motors, no servos), then the logic of CUSTOM_AIRPLANE mode should be as close as possible to CUSTOM mode with a bias towards airplanes/wings - the predefined servos (and, optionally, at least one motor).

@limonspb
Copy link
Member

limonspb commented Jan 24, 2025

Oh thats a good one, i always had to assign motor 2 to something that doesn't exist. But was always curious if that's FW or Configurator requirement. @hntirgeam could you plz check that you can still arm with one motor? And check if you still can have 2+ motors and still spin them on the motors tab.

I'd be OK that custom_airplane by default requires zero motors. But one is also fine.

@nerdCopter
The difference between CUSTOM and CUSTOM_AIRPLANE is that in the FW code there are lots of checks isFixedWing(). This function returns true for CUSTOM_AIRPLANE but false for CUSTOM.

@haslinghuis
Copy link
Member

@limon no need to adjust the model nor the function isFixedWing as it already accounts for MIXER_FLYING_WING, MIXER_AIRPLANE and MIXER_CUSTOM_AIRPLANE)

https://github.com/betaflight/betaflight/blob/c2768d0409a6dd6487bc88a0952079e3048ba43a/src/main/flight/mixer_init.c#L508-L525

 { 1, true,  mixerSingleProp },     // * MIXER_FLYING_WING
 { 1, true,  mixerSingleProp },     // * MIXER_AIRPLANE
 { 2, true,  NULL },                // MIXER_CUSTOM_AIRPLANE

@hntirgeam hntirgeam force-pushed the custom_airplane_mixer_reduced_motor_count branch from 8e1af55 to 4752d69 Compare January 24, 2025 18:23
@hntirgeam
Copy link
Contributor Author

@limonspb, changed motors count from 1 to 0 to match CUSTOM mixer.

I also just flashed a fresh dev build and can confirm that both combinations can be armed and controlled on the motors tab via the UI:

# mixer
Mixer: CUSTOMAIRPLANE
# mmix
mmix 0  1.000  0.000  0.000  0.000
# mixer
Mixer: CUSTOMAIRPLANE
# mmix
mmix 0  1.000  0.000  0.000  0.000
mmix 1  1.000  0.000  0.000  0.000
mmix 2  1.000  0.000  0.000  0.000

https://github.com/betaflight/betaflight/blob/c2768d0409a6dd6487bc88a0952079e3048ba43a/src/main/flight/mixer_init.c#L242-L274

Can't really tell if changing anything in FC code is necessary - comment says modes needs to be synced, but I've also found comment that says that mixes are loaded dynamically by configurator:

https://github.com/betaflight/betaflight/blob/c2768d0409a6dd6487bc88a0952079e3048ba43a/src/main/config/config.c#L205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants