Commit Graph

12 Commits

Author SHA1 Message Date
Dominic Clifton f7c38af7fc Initial commit for implementation of autotune. 2014-05-27 18:11:55 +01:00
Dominic Clifton d6c1ce323d BUGFIX - Warning LED / arm prevention code fixes.
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.
2014-05-22 22:46:54 +01:00
Dominic Clifton 56dc59722a Adding FIXME regarding content of flags_t. 2014-04-22 02:46:14 +01:00
Dominic Clifton fe89d40fa0 Remove main.c's dependency on mw.h/board.h.
Moved pidControllers out of mw.c into flight_common.c/h.
Moved appropriate code into rc_controls.c/h.
2014-04-22 01:58:23 +01:00
Dominic Clifton a7e4c859bd decouple cli/msp from each other. relocated non-msp code into
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.
2014-04-19 01:01:31 +01:00
Dominic Clifton 2baf385b99 Remove mpu6050_scale from core_t by providing a sensor independent way
of determining a revision code.  Previously there was mpu6050 specific
code in cli.c (the status command).

Finally this commit has removed all non-serial port configuration
settings from core_t so that a future commit can refactor core_t to
reduce dependencies on serial port code.

In doing this I also noted from other source code that the MPU6050
accelerometer trim for some revisions appeared to be incorrectly set to
255 * 8 instead of 256 * 8.
2014-04-18 23:32:48 +01:00
Dominic Clifton 94c0f87c45 Remove useServos from core_t since it's only needed for initial startup
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.
2014-04-18 23:13:43 +01:00
Dominic Clifton be6ce96e5d Merge remote-tracking branch 'multiwii/master' into project-structure-alternative
Conflicts:
	src/mw.h
2014-04-18 19:45:30 +01:00
Dominic Clifton f68fc17627 Cleaned up RX initialisation. Updated Spektrum RX code to support 12
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.
2014-04-18 17:25:53 +01:00
Dominic Clifton 0f02e12f40 de-duplicate failsafe code. extract failsafe code to seperate files.
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.
2014-04-17 23:02:22 +01:00
Dominic Clifton 64d16e1987 Relocated used code from board.h into appropriate headers, deleted
unused code.
2014-04-17 15:02:41 +01:00
Dominic Clifton f75f7a7e17 Updating accgyro files so they do not include "board.h". It is now
clear what all accgyro drivers need to compile and what was
unnecessarily included before.
2014-04-16 17:33:47 +01:00