Commit Graph

829 Commits

Author SHA1 Message Date
Dominic Clifton 297609d4c3 Decouple sensor alignment from all acc/gyro/mag drivers.
This resulted in the removal of duplicate logic, duplicate code and the
removal of a temporary buffer per-driver.

The NAZE specific sensor alignment is now contained within the core code
instead of in the drivers.
The sensor alignment is determines by the sensor initialisation code.
The alignment of sensor readings is now performed once and only by the
appropriate sensor code, see usages of alignSensors().

The acc/gyro/compass driver code is now more reusable since it has no
dependencies on the main code.
2014-04-21 14:14:14 +01:00
Dominic Clifton 0f3e4add48 Latest binaries. 2014-04-21 12:44:04 +01:00
Dominic Clifton 3805af7821 fix FY90Q build (acc_t/gyro_t changes) 2014-04-21 12:43:28 +01:00
Dominic Clifton a3d2a3df2d Merge remote-tracking branch 'multiwii/master'
Conflicts:
	obj/baseflight.hex
	src/config.c
	src/drivers/system_common.c
	src/main.c
	src/mw.h
	src/serial_cli.c
2014-04-21 12:35:44 +01:00
Dominic Clifton 12d4603edd Removing unused temperature member from acc_t. 2014-04-21 12:08:24 +01:00
Dominic Clifton 8875aad776 rename sensor_t to acc_t and gyro_t and remove unused variables from
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.
2014-04-21 12:02:02 +01:00
dongie b07ca4b4a1 building hex for recent changes; including EMF avoidance. 2014-04-21 19:49:29 +09:00
dongie 9f107545e2 Merge pull request #78 from schugabe/overclock
Added overclock feature
2014-04-21 19:47:11 +09:00
Dominic Clifton b3430ae1be Remove flight_imu and flight_common.c's dependencies on the mw.h/board.h
files.  Move baro calibration code into sensors_barometer.c.  Move other
sensor variables into appropriate files.
2014-04-21 11:29:01 +01:00
Dominic Clifton 51f2487cf5 Update readme formatting. 2014-04-21 03:40:12 +01:00
Dominic Clifton 9b8a10a09f Updating makefile so the binaries are build with the name of the fork,
in this case 'cleanflight'.  Updating binaries to reflect this change.  

Also renamed the 'startup' folder from 'baseflight_startups'.
2014-04-21 03:34:29 +01:00
Dominic Clifton 06b3e46b8b Updating the project readme. 2014-04-21 03:27:28 +01:00
Dominic Clifton 68b9b9062f Latest binaries. 2014-04-21 03:13:25 +01:00
Dominic Clifton 5cf5785848 Update failsafe in FY90Q pwm driver. 2014-04-21 03:12:43 +01:00
Dominic Clifton ca73413c72 Remove incorrect compiler warning about unused variable. 2014-04-21 03:05:46 +01:00
Dominic Clifton 007bc58859 de-duplicate EEPROM checksum calculation routines to reduce code size
and improve code maintainability.
2014-04-21 02:43:51 +01:00
Dominic Clifton 299d062e73 Replace local variables with better named ones in writeEEPROM. 2014-04-21 02:11:09 +01:00
Dominic Clifton 54424bf3fb Cleanup EEPROM writing code.
Avoid goto/label usage by using a loop instead, remove nesting, improve
and simplify logic, use 8 bit type for attempt counter.
2014-04-21 01:56:14 +01:00
Dominic Clifton bd95c38ff0 Cleanup EEPROM reset and validation methods so that it is obvious what
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.
2014-04-21 01:36:06 +01:00
Dominic Clifton a012cb1c82 Decouple reading EEPROM from writing EEPROM. Now writeEEPROM() does
only what it's name implies and it's method takes no arguments.  This
avoids the 0/1 magic numbers which was a flag to decide whether the user
should be notified after the EEPROM has been read (!).

Introduced a method called readEEPROMAndNotify() which is used in all
cases where writeEEPROM(1) was previously called.

Additionally this avoid re-reading the profile when the reboot command
is issued which speeds up reboots.

Finally this avoid needless comments because the code tells you now what
it is going to do.
2014-04-21 01:18:15 +01:00
Dominic Clifton 3daaf66b14 Removed profile storage code from writeEEProm() to remove the boolean
flag from the method signature.  Now it is clear when the current
profile needs to be stored.
2014-04-21 01:02:53 +01:00
Dominic Clifton e969d184e6 decouple failsafe from the rest of the system.
Note: the pwm_common driver has a dependency on the main failsafe code,
the solution is probably to move some of the code into rx_pwm.
2014-04-21 00:46:16 +01:00
Dominic Clifton aef28c1c08 latest binaries with changes from multiwii/master merged in. 2014-04-19 01:13:27 +01:00
Dominic Clifton c7efcc0521 Merge remote-tracking branch 'multiwii/master' into project-structure-alternative 2014-04-19 01:12:13 +01:00
dongie 63aff7566d Merge pull request #89 from treymarc/bf/msp_write_reboot
Bf/msp write reboot
2014-04-19 09:11:23 +09:00
treymarc 5758a42e77 { 2014-04-19 00:09:01 +00:00
Dominic Clifton b1f7a36ae5 update binaries. 2014-04-19 01:07:39 +01:00
Dominic Clifton 8bda006d97 fix FY90Q build. 2014-04-19 01:07:23 +01:00
treymarc 7c74e0e9ca do no msp_write_eeprom from msp if armed , tel the gui about the error 2014-04-19 00:04:37 +00: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 7b079ca297 Remove code duplication for gimbal servo updates. 2014-04-18 21:05:03 +01:00
Dominic Clifton 799844d933 Provide temporary support for old clients that try and send a channel
index instead of a servo middle when using MSP_SET_SERVO_CONF.

Old GUI clients can still be used to SET channel forwarding, but cannot
be used to READ the status of channel forwarding until they are updated
to use MSP_CHANNEL_FORWARDING/MSP_SET_CHANNEL_FORWARDING.

To the user it will mean their GUI may not match the stored
configuration.  However there is no way to DISABLE channel forwarding
other than a reset if they have enabled it using an old client.

This situation is not ideal, but without this commit it would mean that
bad data could be stored and used incorrectly by baseflight if a user
enables channel forwarding using an old client.
2014-04-18 20:51:16 +01:00
Dominic Clifton 3c1b0b1998 Use constants for PWM ranges instead of the magic numbers 0, 1000 and
2000.
2014-04-18 20:41:49 +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 b8e7c2d14f Fix servo middle/channel forwarding variable re-use. Adds a new
capability flag which is returned by MSP IDENT (CAP_CHANNEL_FORWARDING).
Adds two new MSP commands that are specifically for configuring channel
forwarding (MSP_CHANNEL_FORWARDING/MSP_SET_CHANNEL_FORWARDING).  Servo
'middle' and 'forward from channel' are now stored independently, as
they probably should always have been.
2014-04-18 19:19:37 +01:00
Dominic Clifton 43258c045d build of latest binaries with spektrum 2048 8channel support. 2014-04-18 17:31:28 +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
dongie 33614a5b22 Merge pull request #86 from treymarc/patch_speed
Remove unnecessary var, inline accsum_reset, lrintf , rename smallAngle
2014-04-18 22:27:23 +09:00
Dominic Clifton d777bac39d move printf and typeconversion to common to reduce visual clutter of
main source directory.
2014-04-18 14:03:42 +01:00
Dominic Clifton a85bfa51e3 Remove config.c's dependencies on the mw.h/board.h files. Moved some RX
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
2014-04-18 12:13:37 +01:00
Dominic Clifton 8477b45061 Cleanup declarations of failsafeCnt so that it is only in failsafe.h and
failsafe.c.  Now it is clear from the list of includes that each
serialrx provider supports failsafe.
2014-04-18 00:37:03 +01:00
Dominic Clifton 6a9d38783c Fixing and unifying Serial RX initialisation. Destination arguments now
go last and each init method is passed the rxConfig.
2014-04-18 00:08:48 +01:00
Dominic Clifton f06c8bb99b Relocate common code which can be used by drivers and by main into
'common'.  Cleanup includes.  Fix FY90Q target compilation.
2014-04-17 23:50:13 +01:00
Dominic Clifton d4ebd8a748 Rename 'altimeter' related files to 'barometer' since GPS and other
sensors handle altitude too - requested by @treymarc
2014-04-17 23:23:06 +01:00
Dominic Clifton c658e31b62 Remove spektrum and sumd's dependencies on the mw.h/board.h files. 2014-04-17 23:11:13 +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 d7eb416aa9 de-duplicate degrees to radians code.
Note, this also makes the operator precedence clearer.
2014-04-17 22:53:18 +01:00
treymarc e39636cc00 format 2014-04-17 20:45:09 +00:00