Currently port usage is hard-coded to the default port layout, cli
commands are coming in a future commit.
This decouples all code from the global 'serialPorts' structure which
has been removed. Any code that needs to use a serial port can use
findOpenSerialPort() and openSerialPort() and maintain it's own
reference to the port.
Ports can switch between functions. e.g. by default
cli/msp/telemetry/gps
passthrough all use USART1. Each port maintains it's current function.
see begin/endSerialPortFunction.
There are only certain combinations of serial port functions that are
supported, these are listed in serialPortFunctionScenario_e.
This commit also adds a few 'static' keywords to variables that should
have been.
There a a few other minor fixes and tweaks to various bits of code that
this uncovered too.
connected instead of the 'midrc' value.
Achieved by deleting unnecessary legacy ardino code.
Discussion here:
http://www.multiwii.com/forum/viewtopic.php?f=8&t=5063&p=50635#p50634
Basically it was there because the Ardiuno PPMSUM timer resolution is
lower than the STM32 code we use.
With a Grapner GR-24 receiver using parallel PWM or PPM (12channel) the
values hardly fluctuate at all, slightly more noticable with parallel
PWM input.
This removes a number of FIXMEs regarding driver dependencies on the
main code.
The code to verify pulse lengths is now in computeRC which means that
all RX drivers do not have to duplicate the pulse length checking code.
This means that failsafe can be used to validate serial RX providers as
well as PWM/PPM RX providers.
2d248676f5. MSP RX ignored rc channel
mapping.
Symptoms: power up FC using parallel PWM or PPM with no receiver
attached. Connect GUI tool to view receiver data. Observe that each
channel has a reading of '2' instead of somewhere near 'midrc'.
Symptoms: rxMsp ignored rc channel map, cli 'map' command had no effect.
This commit re-instates the code that checked to see if an rc channel
value was in the correct range but moved it into computeRC where it
really belongs.
Additionally to the code to remap rc channels was moved from the rx
implementations into the computeRc method. This results in smaller code
size, no duplication of logic avoids having to pass rxConfig to each rx
read method and finally fixes rxMsp so that channel mapping can be used.
Failsafe still works as intended, verified by using parallel PWM, arming
and then pulling out the throttle PWM inpout cable.
This also improves code cleanliness since now each rawRawRc method in
the RX implementations does not have to remap the channels. The methods
now do only what their name says.
By decoupling everything the structures now only contain members they need. The mapping code is simplified. The calculation of timer periods is now where it belongs (with the output code, not with the mapping code). Also, since each motor output has it's own callback method it is technically possible to mix brushed and brushless motors if the brushed motors and brushless motors use different timers. Additional code would be required to fully support that.
This is a large commit, from the commit it is clear that the mixer has
many dependencies, this is expected since it is central to the
application.
To achieve the decoupling many master config and profile members had to
be moved into structures.
Relocated throttle/pitch curves into rc_curves.c/h since it has nothing
to with rx code, this fixed the dependencies inside the rx provider
files.
channels when using Spektrum 2048 - untested. Renamed and extracted
core_t.numRCChannels to rxConfig.channelCount so that future commits can
clean up core_t further since core_t contains completely unrelated
properties.
code into rx_common.c. Moved some GPS code into gps_common.c. Isolated
some GPS functions into gps_common.c that were called from mw.c/loop().
moved gimbal defines into gimbal.h. Moved sound & light code into
statusindicator.c
remove dependency on board.h and mw.h on a few files.
Moved rx configuration paramaters into rxConfig in order to remove the
dependency on config_t from the sbus rx code - sumd/spektrum to follow.
Avoided use of YAW/PITCH/ROLL in some files since those constants are
from an unrelated enum type.
Replaced some magic numbers with constants to remove comments and
improve code readability.
Note, due to the tight coupling and global variable usage it was
difficult to create a smaller commit.