Closed digitalentity closed 6 years ago
@digitalentity , yes, it would certainly be good to see pwmInit
cleaned up. I'm not sure the best approach though.
I don't really like the multiPPM
, multiPWM
, airPPM
and airPWM
arrays, so I'm not sure if extending them is the best approach - perhaps it's better to get rid of them altogether and replace them with your idea of a target specific callback.
But to be honest, I'm not really sure of the best approach - I need to think about this more.
I agree with @martinbudden here. It should be completely refactored to be usable.
@digitalentity , some thought is also being given to this idea by @blckmn as part of the betaflight release, see PR https://github.com/betaflight/betaflight/pull/491
I don't think we should do any work in this area until after the F4 port - doing so would make bringing F4 code across from betaflight much more difficult. The aim should be to get a shared solution used by betaflight and iNav which can then be ported back to cleanflight.
@martinbudden agreed, if possible we should walk the same path with Betaflight to allow code portability.
I've added the blocked label, since this depends on changes that come with F4 support, issue https://github.com/iNavFlight/inav/issues/274
See also PR https://github.com/betaflight/betaflight/pull/1189 - Initial IO remapping
@digitalentity I belive we close that
Currently we have a few possibilities of output channel mappings: 1) Multicopter w/o servos 2) Multicopter + servo outputs 3) Airplane
While 1 and 3 are straightforward -
multiPPM
,multiPWM
,airPPM
andairPWM
mappings are defined for them, the 2 is handled withinpwmInit()
and we have loads of target-specific code like this:I suggest extending channel mapping furhter:
multiPPM
andmultiPWM
for multicopters w/o servo outputsmultiPPM_servo
andmultiPWM_servo
for multicopters with servo outputs (tricopters included)airPPM
andairPWM
for airplanesAs a second step I suggest creating a callback from
pwmInit()
to target-specifictarget.c
to avoid ifdefs like these:@martinbudden what do you think?