1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00
Commit graph

14003 commits

Author SHA1 Message Date
Dominic Clifton
11863e5c34 Avoid passing a uint8_t to a gyro method that is only used during gyro
calibration.
Conflicts:

	src/config.c
	src/flight_imu.c
	src/mw.h
	src/sensors.c
	src/serial_cli.c
2014-04-23 02:25:46 +01:00
dongie
5a05de5da7 fixing some typos and inconsistencies in cli/set variable naming. 2014-04-23 09:53:05 +09:00
Dominic Clifton
9d56b4a00f Remove sensor_initialisation.c's dependency on mw.h/board.h.
Extracted sensor alignment variables to sensorAlignmentConfig

This commit marks the end of the sensor dependency cleanup.
2014-04-23 00:41:21 +01:00
Dominic Clifton
e963496263 Remove sensor_compass.c's dependency on mw.h/board.h.
Also changed type of magZero from int16_t[3] to
int16_flightDynamicsTrims_t.
2014-04-23 00:15:55 +01:00
Dominic Clifton
1464b7398a Remove sensor_sonar.c's dependency on mw.h/board.h. 2014-04-23 00:05:11 +01:00
Dominic Clifton
53b7edd843 Add the name of the fork to the output of the cli version command. 2014-04-23 00:01:07 +01:00
Dominic Clifton
e2550ee5e1 Remove sensor_barometer.c's dependency on mw.h/board.h.
This also cleans the code - No magic numbers, clearly defines states,
config variables grouped together, avoiding some global variable use.
2014-04-22 23:46:25 +01:00
Dominic Clifton
c08d0ac1b3 BUGFIX - gyro calibration too short when movement detected during
calibration.

When the model is moved during the gyro calibration period too much the
code that detects the movement (gyroMovementCalibrationThreshold aka
'moron threshold') did not restart the calibration correctly and one too
few calibration cycles were used when restarting.

In addition to this there was unnecessary calibration reset code - the
reset of calibration variables is supposed to happen at the start of
calibration; due to the bug the first calibration cycle could not be
detected when restarting so the old reset code was required. 

This commit also cleans up the Gyro code so the it is in a similar style
to the recently cleaned acceleration code.
2014-04-22 20:39:44 +01:00
Dominic Clifton
db9042757d Remove sensor_gyro.c's dependency on mw.h/board.h. 2014-04-22 20:18:33 +01:00
Dominic Clifton
fbfb75b24a Remove sensor_acceleration.c's dependency on mw.h/board.h.
In doing so accelerometer sensor and trim code had to be cleaned.
Added a new method to buzzer.c to avoid exposing toggleBeep.
Renamed current_profile to current_profile_index to avoid confusion.
2014-04-22 19:41:46 +01:00
treymarc
b14b058fa0 add msp telemtry 2014-04-22 13:48:57 +02:00
Dominic Clifton
56dc59722a Adding FIXME regarding content of flags_t. 2014-04-22 02:46:14 +01:00
Dominic Clifton
9f26018abd Cleanup baro/mag/gyro/acc method names from old sensors.c 2014-04-22 02:43:39 +01:00
Dominic Clifton
7e76fd6995 Fix OLIMEXINO build (no-baro) 2014-04-22 02:07:11 +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
2c80094b0e Remove gps_common.c's dependencies on the mw.h/board.h.
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().
2014-04-22 00:37:35 +01:00
Dominic Clifton
f8d0dd98f7 Split config_storage.h into config_master.h and config_profile.h to
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.
2014-04-21 23:08:25 +01:00
Dominic Clifton
3813c5027f Allow user provided sensor alignment to override NAZE defaults.
This should have been in 297609d4c3.
2014-04-21 16:16:28 +01:00
Dominic Clifton
6c4caabfae Fixing failsafe initialisation, failsafe work as it did before
e969d184e6
2014-04-21 14:42:25 +01:00
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
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
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
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
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
c7efcc0521 Merge remote-tracking branch 'multiwii/master' into project-structure-alternative 2014-04-19 01:12:13 +01:00
treymarc
5758a42e77 { 2014-04-19 00:09:01 +00: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
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
d777bac39d move printf and typeconversion to common to reduce visual clutter of
main source directory.
2014-04-18 14:03:42 +01:00