* Adding common source location in ./src/platform
To enable the continued clean up of multiple files still in ./src/main/driver (more PRs to follow) that are specifically for AT32, APM32 and STM32
Source will be moved to MCU_COMMON_SRC where it is specifically for that MCU (or variant). The test will be to ensure no files in the MCU_EXCLUDES for SITL.
* Use of +=
* added attitude fields desriptions
* the attitude (imu pitch, roll, yaw) added to blackbox log
* Global variable imuAttitudeQuaternion[3] is added to store current normalized imu attitude quaternion
* IMU attitude quaternion added to log instead of Euler angles
* blackbox logging of IMU attitude quaterions is replaced to GYRO group
* Revert "blackbox logging of IMU attitude quaterions is replaced to GYRO group"
This reverts commit a6020ed6b6.
* code refactoring: use quaternion as global variable instead of float[3] array
* USE_ACC apply for attitude log
* quaterion struct data type is changed to union quaternion_t
* resolved issue of Test module
* Code style improvement: removed empty codes row
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* Added STATIC_ASSERT check of quaternion components sequence.
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Code style improvement
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Resolved code issue
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* resolved wrong data type name
* STATIC_ASSERT error resolved
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* Improved assert condition
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* added ATTITUDE condition for attitude blackbox log
* added blackbox_disable_attitude cli command
* Attitude position changed in blackbox disabling fields list
* resolved issue wrong quaternion log record condition
---------
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Driver for CADDX camera GM3 gimbal
* Update src/main/cli/settings.c
Fix copy-paste error on variable name.
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/gimbal_control.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/gimbal_control.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/gimbal_control.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Only forward gimbal data with good CRC
---------
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* MSP Range Finder added (configured and tested on the MTF-01P Lidar)
* MSP Range Finder added (configured and tested on the MTF-01P Lidar)
* fix the license of the added files from INAV
* Update src/main/drivers/rangefinder/rangefinder_virtual.c
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* Update src/main/msp/msp.c
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* Update src/main/io/rangefinder.h
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* Update src/main/msp/msp.c
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* refactored the code of INAV for the MSP rangefinder, to be extendable to other MSP rangefinder and more specific about the parameters of the supported ones
* Update src/main/drivers/rangefinder/rangefinder_lidarmt.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/drivers/rangefinder/rangefinder_lidarmt.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactored the code for readability
* mt lidar msp address
* us the delay MS from the dev directly
* todo
* MT device type datatype
* refactored the code for readability
* spacing
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* refactoring
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* after the edits fix
* rm idx
* typo fixed
* i think this shouldn't be here
* spacing
* Update src/main/drivers/rangefinder/rangefinder_lidarmt.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* fix mt models ranges
* remove mt01p model, it doesn't map
* rm "MT01P", it doesn't support map
* rm mt01p, it doesn't support msp
* Update rangefinder_lidarmt.h
* update mt lidar deadzone
* Update rangefinder_lidarmt.c
* Update rangefinder_lidarmt.c
* rm unused variable mtfConnected
---------
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* angle pitch offset (for wings)
* made angle_pitch_offset int16, and changed direction to follow BF convention
* Update src/main/blackbox/blackbox.c
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
---------
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
* VCP - zero-init USB port in usbVcpOpen
* Serial - serialPortIdentifier_e is signed
* UART - remove unused serialPortCount
* UART - allow compiling spectrum without UART
* UART - minor improvements
closeSerialPort tests for NULL,
no other functional changes
* serial - refactor serial resource handling
- port related resources (tx/rx/inverted,dma)
- are stored sequentially, with space in place of ports that are not
enabled (RESOURCE_UART_COUNT + RESOURCE_LPUART_COUNT +
RESOURCE_SOFTSERIAL_COUNT)
- RESOURCE_UART_OFFSET, RESOURCE_LPUART_OFFSET, RESOURCE_SOFTSERIAL_OFFSET
- resource entries are pointing into this array (UART, LPUART, SOFTSERIAL)
- both pins and DMA
- inverter is supproted only for UART + LPUART (makes sense only
for UART, to be removed)
- softSerialPinConfig is removed, it is no longer necessary
- serialResourceIndex(identifier) is used universally to get correct
index into resource array
- unified handling of resources where possible
- serialOwnerTxRx() + serialOwnerIndex() are used for displaying resources
correctly to user.
- serialType(identifier) implemented
- serialOwnerTxRx / serialOwnerIndex are trivial with it
- large switch() statemens are greatly simplified
* serial - merge code duplicated in all UART implementations
- drivers/serial_uart_hw.c contains merged serialUART code.
Code did not match exactly. Obvious cases are fixed, more complicated
use #ifs
- pin inversion unified
- uartOpen is refactored a bit
* serial - refactor uartDevice
- use 'compressed' enum from uartDeviceIdx_e. Only enabled ports are
in this enum.
- uartDeviceIdx directly indexes uartDevice (no search necessary, no
wasted space)
- use `serialPortIdentifier_e identifier;` for uartHardware
- for DMA remap, define only entries for enabled ports (uartDeviceIdx_e
does not exist disabled port)
* serial - apply changes to inverter
New implementation is trivial
* serial - HAL - rxIrq, txIrq replaces by irqn
There is only one IRQ for serial
* serial - serial_post.h
Generated code to normalize target configuration.
jinja2 template is used to generate header file. Port handling is
unified a lot.
SERIAL_<type><n>_USED 0/1 - always defined, value depends on target configuration
SERIAL_<type>_MASK - bitmask of used ports or given type. <port>1 is BIT(0)
SERIAL_<type>_COUNT - number of enabled ports of given type
SERIAL_<type>_MAX - <index of highest used port> + 1, 0 when no port is enabled
* targets - remove automatically calculated valued from configs
serial_post.h generated it
* serial - remove definitions replaced by serial_post.h
* serial - change LPUART to UART_LP1 in places
LPUART is mostly handled as another UART port, this change reflects it
* serial - use ARRAYLEN / ARRAYEND in some places
replaces constant that may not match actual array size
* serial - adapt softserial to changes
* serial - whitespace, comments
* softserial - fix serialTimerConfigureTimebase
* serial - suspicious code
* serial - unittests
* serial - cleanup
* serial - simpler port names
Is this useful ?
* serial - no port count for SITL necessary
* serial - fix unittests
include serial_post.h, some ports are defined, so normalization will
work fine
* timers - remove obsolete defines from SITL and unittests
* serial - cosmetic improvements
comments, whitespace, minor refactoring
* serial - fix serialInit bug
serialPortToDisable was preventing further tests
* serial - fix possible NULL pointer dereference
* serial - move serialResourceIndex to drivers
* serial - refactor pp/od and pulldown/pullup/nopull
Centralize serial options handling, decouple it from MCU type
Move some code into new drivers/serial_impl.c
* serial - make port.identifier valid early in port initialization
* serial - fix unittest
Code is moved around a bit to make unittests implementation easier
* serial - bug - fix off-by-one error
uart1/softserial1/lpuart was not working properly because of this
* serial - whipespace + formating + style + comments
No functional changes
* utils - add popcount functions
Wrap __builtin_popcount for easier use. Refactor existing code using
it. Update code using BITCOUNT macro in dynamic context (BITCOUNT is
for compile-time use only)
* serial - inverter - simplify code
* pinio - prevent array access overflow
* serial - refactor SERIAL_BIDIR_*
SERIAL_BIDIR_OD / SERIAL_BIDIR_PP
SERIAL_PULL_DEFAULT / SERIAL_PULL_NONE / SERIAL_PULL_PD
* serial - simplify code
minor refactoring
- cleaner AVOID_UARTx_FOR_PWM_PPM (unused anyway)
- serialFindPortConfiguration* - remove code duplication
- use serialType in smartaudio
* serial - add port names
- const string is assiociated with each compiled-in port (easy to pass around)
- findSerialPortByName
* cli - improve serialpassthrough
- support port options (in current mode argument)
- support port names (`serialpassthrough uart1`)
- improve error handling; check more parse errors
* cli - resources - minor refactor
- prevent SERIAL_TX_NONSENSE when parsing resource type
- fix possible NULL pointer dereference
- store resource tag only after checking all conditions
- slighty better error reporting
- `resource serial_tx 1` will print resource assignment
* serial - remane pulldown to SERIAL_PULL_SMARTAUDIO
Make sure nobody uses it by
mistake. SERIAL_PULL_SMARTAUDIO_SUPER_DANGEROUS_USE_AT_YOUR_OWN_RISK_THIS_WILL_BREAK_EVERYTHING_AND_KILL_YOUR_PET_FISH
would be better choice, but try shorter version first.
* smartaudio - minor refactor/improvement
- Fix softserial on AT32
- make it easier to handle SA on per-cpu basis
* softserial - minor refactoring
no functional changes
* UART - move AF handling before MCU dependent code
* UART - adapt APM32 / APM32F4 code
- Modeled after F4 where possible
- come code moved from APM32 to APM32F4, possbily not necessary, but
it improves similarity with STM32F4
* UART - APM32 - remove per-pin AF
* UART - APM32 - bugfix - fix pinswap #if conditions
* UART - apply some improvemnts from APM32 to STM32
* UART - add todo for F4 serial speed
* UART - fix typo
* UART - refactor support for USE_SMARTAUDIO_NOPULLDOWN
* UART - typos, comments, minor improvements
* UART - move code into enableRxIrq
TODO: split into mcu-specific filer (but in sepatate PR)
* UART - add UART_TRAIT_xx
makes #if test easier and more consistent
more traits shall follow
* UART - fix variable name
unused branch, would trigger compilation error otherwise
* UART - use tables instead of switch
* UART - smartaudio
minor style change + better comments
* UART - unify mspPorts iteration
* UART - fix spelling
* UART - another typo
* UART - fix serialResourceIndex
offset must be added, not subtracted
offset can be negative
* UART - fix typo
Bad day ...
* UART - use const table
GCC does optimize it better.
Should not cause functional change
* UART - use OwnerIndex for inverter
- 1 based
- only UART has inversion
* UART - refactor serial_resource a bit
Single table + helper function. New table is easier to read
* UART - serial_impl header is necessary
* UART - style-only changes
typos
unify whitespace
comment improvement
add some const modifiers
use cfg in uartConfigureDma
minor improvemnt of for loops
* UART - remove LPUART inverter
LPUART always supports internal inversion, code was incomplete and
unused
* UART - update jinja template, regenerate files
* UART - enable UART module RCC clk before configuring DMA
Does not change anything, UART RCCs are enabled unconditionally
* Yaw type rudder or diff_thrust for TPA calculations (for wings)
* Added yaw_type to blackbox header
* KarateBrot review
* KarateBrot break
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
---------
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
* use wasThrottleRaised in place of isAirmodeActivated where airmode isn't really needed
* fix unit test
* fix typo
* remove unnecessary check
* final changes and clarificartions
* Update src/main/flight/mixer.c
Co-authored-by: Ivan Efimov <gendalf44@yandex.ru>
---------
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Ivan Efimov <gendalf44@yandex.ru>
* Altitude control code shared
fewer debugs
subtract D
* remove #include comments, simplify coding, restructuring
thanks JP and MH
* fix cms limits for throttle control
* Use altitude_control debug, fix throttle calculation
minor refactoring
* use AUTO_CONTROL_ALTITUDE debug in place of GPS Rescue throttle pid
* use autopilot for position control names
* fixes from reviews - thanks
* Re-organise included files and functions thanks Karate
* missed init and other typos
* remove old unused unit test file, tidy up thanks Mark
* fix indentation on one line
* tpa speed speed estimation (for wings)
* Some renaming based on Karatebrot review
* Fix with currentPidProfile
* Ledvinap's review
* minor fixes
* Karatebrot and ledvinap review
* Review by haslinghuis
* use idleOffset, simplify idle : check PWM idle
* remove get for dshot idle and calculate it once only
* fixes from reviews, thanks
* use motor_idle for CLI name
* use motorConfig->motorIdle not idleOffset
* rename dshotmotorIdle variable to motorIdlePercent
* small comment improvement
* stop motors after 90 degrees of rotation and with max rate
* handle no accelerometer data
* improve check for acc, although seems to be OK without it
* disable all attenuation if rate is set to zero
* refactoring thanks Karate
* use sensors.h
* remove unnecessary arming check
* exit crashFlip immediately switch is reverted if throttle is zero
* add Crashflip Rate to OSD
* Revert unnecessary changes in crashflip core.c code
and clarify comments about crashflip switch
* update / minimise comments, thanks Karate
* ensure all names say `crashflip` consistently
* Undo quick re-arm because motrors were not reversed
* fix issue with reversed motors, we must disarm
* ignore yaw rotation and set gyro limit to 1900 deg/s
* default attenuation to off (crashflip_rate = 0)
* refactoring, increase rate limit to allow stronger inhibition
* enable in race_pro mode
* don't attenuate on attitude until a significant change occurs
* no attenuation for small changes
* Updates from review by PL
* remove whitespace
* refactor motorOutput, update comments, renaming variables
thanks PL
* changes from review PL
* only permit fast re-arm if crashflip rate set and crashflip was successful
* properly exit turtle mode
* add crashFlipSuccessful to unit test extern c
* small updates from review
* improved crashflip switch handling
* remove unnecessary motors normal check