1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 20:10:18 +03:00
Commit graph

44 commits

Author SHA1 Message Date
Dominic Clifton
f232b831d2 Replace cli command gps_initial_baudrate_index with gps_baudrate.
The index is not really a user concern and leads to confusion.  gps
baudrate is not set like any other baud date and the determination of an
appropriate index is hidden from the user.

If the user specifies a baudrate that is not supported the default index
is used which is current the index for 115200.

This also allows GPS to work on softserial ports at up to 19200.
2014-05-23 11:54:00 +01:00
Dominic Clifton
e010f6fbf1 Update failsafe_max_usec to use the correct range. 2014-05-15 17:48:24 +01:00
Dominic Clifton
032202ef8f BUGFIX - Cleanup failsafe system so it works correctly with Serial RX
systems and Parallel PWM/PPM systems.

Added setting for failsafe_max_usec.  Renamed failsafe_detect_threshold
to failsafe_min_usec.

Failsafe now detects when a PPM/PWM RX isn't sending ANY data out on
CH1-4.  See documentation notes regarding Graupner receivers in
Failsafe.md.

Documented failsafe system.
2014-05-15 14:28:57 +01:00
Dominic Clifton
21207ca940 Improvement: Add support for upto 18 channels. Allow RSSI to be read
from any channel, not just AUX1-4.

See documentation changes in this commit.
2014-05-14 19:23:27 +01:00
Dominic Clifton
5d460766e9 RXMSP is no longer a serial rx provider since it uses MSP and not it's
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.
2014-05-12 13:23:20 +01:00
Dominic Clifton
b3ee895f97 Merge branch 'multiwii-master'
Conflicts:
	src/board.h
	src/buzzer.c
	src/config.c
	src/drivers/serial_common.h
	src/drivers/system_common.c
	src/drv_gpio.h
	src/drv_pwm.c
	src/drv_timer.c
	src/drv_uart.c
	src/flight_imu.c
	src/mw.c
	src/rx_sbus.c
	src/sensors.c
	src/serial_cli.c
2014-05-12 00:16:03 +01:00
treymarc
cabc57774c format code properly
match the comment from pullrequest about spacing
remains : some hand alignment for comment and wrong /** */ usage.
Conflicts:

	src/board.h
	src/buzzer.c
	src/config.c
	src/drivers/serial_common.h
	src/drivers/system_common.c
	src/drv_gpio.h
	src/drv_pwm.c
	src/drv_timer.c
	src/drv_uart.c
	src/flight_imu.c
	src/mw.c
	src/serial_cli.c
2014-05-11 18:04:05 +01:00
Dominic Clifton
5c4bfd4e58 Configuration validation.
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.
2014-05-10 14:12:24 +01:00
Dominic Clifton
0fd127bf60 Allow the user to specify their serial port scenarios. 2014-05-10 14:11:01 +01:00
Dominic Clifton
f1d38c0fa2 Rename serialrx_type to serialrx_provider to match gps_provider and
telemetry_provider.
2014-05-10 00:32:42 +01:00
Dominic Clifton
1777d8feda First cut of configurable serial port functionality.
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.
2014-05-09 23:39:10 +01:00
treymarc
9e8b05dc0e add serial_rx msp
Conflicts:

	Makefile
	src/board.h
	src/main.c
	src/mw.h
	src/serial_cli.c
2014-05-03 18:20:17 +01:00
Dominic Clifton
4febeb3969 Ported some I2C code from AQ32PlusF3 which itself looked ported from the
STM32 examples.
2014-04-28 19:18:57 +01:00
Dominic Clifton
cde26ac1a2 Fix eeprom writing. Update some clocks. Add fake implementation of acc
and gyro to allow the main loop to run.
2014-04-25 03:50:33 +01:00
Dominic Clifton
cb63f6e2b5 Remove telemetry_*.c's dependency on mw.h/board.h.
Finally, the only dependency on mw.h/board.h is now mw.c itself.
2014-04-24 01:44:58 +01:00
Dominic Clifton
695db3523a Remove flight_mixer.c's dependency on mw.h/board.h.
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.
2014-04-24 00:18:24 +01:00
Dominic Clifton
a5f0999c26 Remove serial_cli.c's dependency on mw.h/board.h.
Rename yawdeadband to yaw_deadband to match other variables/cli
commands.

Fix a couple of usages of MAX_MOTORS where MAX_SUPPORTED_MOTORS should
be used instead.
2014-04-23 20:42:38 +01:00
Dominic Clifton
e4c9fb585c Merge remote-tracking branch 'multiwii/master'
Conflicts:
	obj/baseflight.hex
	src/config.c
	src/main.c
	src/mw.c
	src/mw.h
	src/serial_cli.c
2014-04-23 02:38:39 +01:00
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
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
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
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
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
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
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
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
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
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
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
41b5a01958 Decouple board alignment code. 2014-04-17 19:31:01 +01:00
Dominic Clifton
7e45a0c7e6 Fixing FY90Q build. Cleanup of printf support and initialisation.
Remove duplicate inclusion of math.h in board.h.
2014-04-17 17:37:43 +01:00
Dominic Clifton
89612bd881 De-couple battery code.
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.
2014-04-17 16:36:01 +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
001de4cdf3 Move FY90q acc/gyro code to accgyro_fy90q.c. Update ADC drivers so they
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.
2014-04-16 18:58:20 +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
Dominic Clifton
c493a1579c Merge remote-tracking branch 'multiwii/master'
Conflicts:
	obj/baseflight.hex
	src/sensors.c
2014-04-14 16:18:44 +01:00
Dominic Clifton
3bd4cd2ed2 Use slightly flatter directory structure since some developers did not
like too many folders.
Extracted code from some files into separate files to fit with the new
layout.
2014-04-08 22:07:37 +01:00
Renamed from src/ui/cli.c (Browse further)