The old code was using f.ACC_CALIBRATED to mean 'flash the warning led'
and 'prevent arming'
There was another flag called f.OK_TO_ARM which really meant 'prevent
arming after failsafe unless using a switch to arm' - this meant the
comment in the code was incorrect since it did not mention the switch.
There was code which every ~71 minutes would set f.ACC_CALIBRATED to
FALSE and would toggle the LED, even when flying.
There was code that was run during every cycle that did not need to be
run when armed.
There was code that was run during every cycle which did not need to be
run when waiting for calibration to finish.
The warning light was toggled regardless of actual accelerometer
calibration state.
This commit fixes all that and prevents the user from arming after a
failsafe landing until the system is reset, regardless of wether a
switch is used to arm or not.
This commit also flashes the warning led during barometer calibration
and will not let you arm until it has completed.
Add a 5 second delay on startup to failsafe to prevent failsafe from
activating in the case of TX/RX gear with long bind procedures before
they send out valid data.
Failsafe now only prevents re-arming if a landing was forced.
In the case when you power on your RX without your TX on the beeper
sounds and failsafe warning ligts are activated. When the FC then
detects a signal the lights go off and you can then arm.
own dedicated serial port.
Added a feature to enable/disable RX_MSP.
Renamed feature SERIALRX to RX_SERIAL.
Renamed feature PARALLEL_PWM to RX_PARALLEL_PWM
Renamed PPM to RX_PPM.
Update serial configuration checking to better support Serial RX and
telemetry by verifiying serial port features and supported baud rates.
It's now possible to use a low-speed serial rx provider via softserial -
only problem is all the current serial rx providers are 100000/115200
baud. The code changes however open the door for using serial rx and
any capable serial port such as uart3-5 on the STM32F30x
It's also now possible to use GPS at low speeds on software serial
ports.
This enables a new feature setting for PARALLEL_PWM which is enabled by
default.
This starts to move much of the feature checking/excluding code that is
littered through into a single place - validateAndFixConfig(). Since
the config is known to be valid after the method is called other code
can just get on with it's job instead of checking for confliciting
features/settings.
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.
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.
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.
TIM8 correctly. Software serial conficted with parallel PWM input. Fixed
crash due to incorrect timerConfig index calculation code.
The crash occurred when capture compare interrupt handlers attempted to
call an invalid callback.
Note: the crash does not affect existing baseflight code since the
formula is OK when using a 2 dimensional array with equal dimensions.
Formula details here:
https://docs.google.com/spreadsheets/d/1UuxnC0VKiprvt1wt3KXffefEWJUb_-ILFLQuP377Anw
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.
Moved some GPS code from mw.c into gps_common.c.
Moved pid values into a pidProfile_t structure; this was done so that
gps_common.c does not have a dependency on config_profile.h.
pidProfile_t lives in flight_common.h now.
Moved gps profile settings from profile_t into gpsProfile_t for the same
reason.
Removed gps_common.c's dependency on masterConfig_t by passing needed
variables into gpsInit().
separate concerns and help reduce and clarify dependencies.
cfg and mcfg are too similarly named and are not obvious. Renamed cfg
to currentProfile and mcfg to masterConfig. This will increase source
code line length somewhat but that's ok; lines of code doing too much
are now easier to spot.
each. relocated acc_t/gyro_t from sensors_common.h into
drivers/accgyro_common.h since they define an interface and the
dependency was pointing the wrong way from the drivers.
baro_t/acc_t/gyro_t dependences are all now pointing the right way.
the code is doing. There are now no EEPROM read/write/reset/verify
methods that take any arguments which removes magic boolean variables
from method signatures.
This also removes duplicate code in the cliDefaults and cliSave commands
which results in smaller code also also due to the deduplication of a
reboot message.
serial_common.c/h. decouple runtime_config from serial ports. decouple
buzzer from serial ports. decouple opening of the main serial port from
the msp code. decouple serial rx providers from runtime_config. rename
core_t to serialPorts_t since it only contained serial ports. It's now
clear which files use serial ports based on the header files they
include.
and by the mixer. main.c now asks the mixer if it needs to use servos
and the mixer decides this in mixerInit(). Main already has a
dependency on the mixer. This allows future commits to further clean up
core_t which is still a source of dependency problems.
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.
This fixes a bug where buzzerFreq could be uninitialised before it's
use.
This improves performance by only checking whether to sound the battery
alarm after the battery voltage has been recalculated.
There were unused battery beep codes which have been deleted to save
code size.
Configuration structure extracted from mw.h into config.h.
Moved mixer configuration structures into flight_mixer.h.
Added a build_config.c in order to decouple pwm_common.h from config.h.
Finally, battery configuration values now live in a batteryConfig
structure which means that battery.c does not depend on config.h and all
of it's dependencies.
Fixed the use of plurals on defines that were not collection objects.
PIDITEMS and CHECKBOXITEMS are now PID_ITEM_COUNT and
CHECKBOX_ITEM_COUNT.
do not include "board.h". It is now clear what all ADC drivers need to
compile and what was unnecessarily included before.
Note: FY90Q make target now compiles successfully, it was broken for
various reasons before.