* Add LED functions: Battery Bar, GPS Bar
Battery Bar:
Indicates the battery percentage with a loading bar style
GPS Bar:
Indicates the amount of locked GPS satellites with a loading bar style
* LED altitude function
Adds a new function: LED altitude.
Sets the LED color based on the altitude, measured from the initialized position.
* set led color to background if value decreases
Even if the gps satellite count decreases at a later point in time, the LEDs update correctly now.
It is the same for the battery level function.
LEDs color changes more strongly now when based on altitude.
* Added proper ifdefs for GPS and Barometer
* fixed unittest and use estimate altitute
- fixed unittest
- cleaner indentation
- the altitude function now uses the estimate function instead of the raw value (gps+barometer)
* counters in struct, gps bar color gradient
- Counters for the led bar are now handled in a structure.
- Moved the led bar code to a seperate function that is only called when the led config changes.
- improved usefulness of the gps led bar with less than 4 leds installed by adding a color gradient.
* Update src/main/io/ledstrip.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/ledstrip.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/ledstrip.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/ledstrip.h
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/io/ledstrip.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* one min led for very low battery, use failsafe sats to interpolate
- at least one led is lit up for the battery/gps bar at all time (to show color gradient, also making the function more useful when only applying it to 1 led).
- gps bar now takes the failsafe min sats (or default 8) to interpolate between red and green.
- rewrote the led codes to be less fragile
- some structural changes that also adress comments on the pull request
* fix code if no gps rescue is used
fixes code if no gps rescue is used.
sets the default min sats to 8.
* Update src/main/io/ledstrip.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Fixes per review ledvinap
* Fixes per review Ledvinap 2
* Update src/main/io/ledstrip.c
* Update src/main/io/ledstrip.c
---------
Co-authored-by: jonas-becker <jonas@Thinkpad>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* battery - fix BATTERY_NOT_PRESENT detection, detection logic change
Detection logic is refactored - battery voltage delta is tested each
50ms, voltage is considered stable when difference of last 10 samples
is smaller than 100mV
This makes stable threshold more forgiving than #13350 (time for
comparison is 50 instead of 500ms).
* battery - improve stable voltage detection
- voltageStablePrevFiltered every time delta is exceeded
- voltage within range is ANDed over 100ms periods
- voltage is stable if it was within range for 10 out of 11 periods
- slowly changing voltage will update threshold, but voltage will be
considered stable
- 1 update/s (100mV/s) is tolerated
* battery - fuix typos, improve comments
* Fix smartport over softserial
* Constrain baudrateIndex does not work
* Reapply 57600 for SmartPort
* Use custom define for baudrate override
* Return when baudrate requested is above set limit of softserial
* Thanks ledvinap
* Fix macro name
* Cloud Build API does not allow define size > 32
Remove functionality to enter flash bootloader by sending 'F' on a UART
configured for MSP.
* The proper way to reboot to the boot loader is by sending an
MSP_REBOOT command.
* RX - minor optimizations/minor cleanup
- reuse millis() in rxInit
- rcData[] is float
- cleanup some float math
- fix GET_FRAME_ERR_LPF_FREQUENCY macro argument
* Update src/main/pg/rx.h
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
---------
Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
* unittest - fix duplicate symbols in unittests
Some symbols were declared again
With clang -fcommon, this resulted in allocatin in common segment and
prevented error.
(tentative definitions in C standard).
-fno-common (now default in clang https://reviews.llvm.org/D75056)
causes compilation errors.
Declarations are now marked extern.
* unittest - fix scheduler array size for unittest
Unittest needs extra space for canary
* unittest - fix missing include (needed for clang-16)
* unittest - remove unused varibles
-Werror in clang 15+
* unittest - increase max supported version to clang-16
* unittest - conditionaly disable useless output in unittests
* unittest - C++11 version of STATIC_ASSERT
* unittest - fix initializers for g++
- Change order of initializers to match order in struct
- make valueTable initializion consistent (necessary for C++)
- adapt controlRateConfig
* unittest - adapt scheduler_unitest for g++
scheduler_stubs.c is necessary to initialize task_attributes
* unittest - fix ledstrip unittest
only part of config was zeroed
* unittest - fix g++ warnings
- memcpy when length is known and \0 is not copied
- isError is local stub, no extern
- serialReadStub - don't memcpy into object, use initializer
* cli - cleanup cliGetSettingIndex
- compare only passed bytes (old version may read data after
name)
- input string is const
* unittest - fix ld warning from PG sections
move pg data sections after .rodata. Sections were marked as writable
due to relocation (!?). That marked .text output section
(containing .pg_data) as writable too and linker correctly complained
that executable section is writable.
* unittest - cleanup
* unittest - adapt after code cleanup, add gcc
- remove clang flags that are not necessary now (tested on clang-11
and clang-16)
- add support for gcc ( make test CC=gcc CXX=g++ )
- add suport for different optimization level (detects some code
problems) : make test OPTIMIZE=-O2
- fallback to clang on Linux too
* fixup! unittest - conditionaly disable useless output in unittests
* set default of spec prearm screen to false if race pro not defined
* Simple variant - thanks Ledvinap
---------
Co-authored-by: Eike Ahmels <ea@weslink.de>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
* I2C - unify i2cUnstick implemntation, improve unstick a bit
Three copies were spread in I2C implementations.
- i2cUnstick is a bit more carefull about clock stretching
- bus status is returned (return true when bus in idle state)
* fixup! I2C - unify i2cUnstick implemntation, improve unstick a bit
* fixup! I2C - unify i2cUnstick implemntation, improve unstick a bit
---------
Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
* Baro and Mag driver check for I2C bus being busy
* Update src/main/drivers/bus_i2c_busdev.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
---------
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Config - add error checking into config_streamer.c,
CONFIG_STREAMER_BUFFER_SIZE does not match actually writen data in
some cases
* Config - fix buffer read ovefrflow
CONFIG_IN_RAM and CONFIG_IN_SDCARD used 4 byte byffer, but 32 bytes
got actually copied
CONFIG_IN_MEMORY_MAPPED_FLASH used 8byte buffer, but but 32 bytes
got actually copied
* Config - add write functions into header
---------
Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
* Add ez_landing_speed parameter
The parameter is the speed at which ez_landing will be effectively disabled in tenths of meters per second.
Default value 50 (5 m/s).
EZLANDING bug field 5 is the contribution from this parameter to the ezlanding throttle cap.
* Correct ez_landing_speed logic and scaling
* ez_landing_speed should now raise the limit when the speed is above ez_landing_speed (previously only raised the limit if the speed was bellow, and had no effect above the limit)
* ez_landing_speed should now be scaled so that EzLanding is effectively disabled when speed >= ez_landing_speed (previously EzLanding would be disabeld when speed was at half of ez_landing_speed)
* Add stick input upper limit as EZLANDING debug 4
* Check for gps 3D fix before using gps speed for EzLanding
* Prevent division by 0 if ez_landing_threshold is set to 0
* Scale EzLanding speed to m/s from cm/s
* Update src/main/flight/mixer.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
---------
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* mag cal improvements
reduced threshold to start updating the previous cal
LED0 goes 'solid' only when the calibration start threshold is met
Don't zero previous Cal values until the update threshold is met
Mag_calib debug shows cal values at zero unltil they start being updated.
* beep ready, acc_calibration, and gyro_calibrated, for audio feedback
s
* improvements, thanks to feedback from PL
* change magCalEndTimeUs to magCalProcessEndTimeUs
* make process names more obvious
* use static boolean for initation and termination
* magCalProcessEndTimeUs to magCalEndTime
* LED ON, not toggle
* ensure that division is a float
* change logging, improve logic for recalibration
* Increase sensitivity, smooth center, higher max cogYawGain, renaming
* use non thrust vector maths, revise and add comments
* three factors to reduce ez_ef - speed, thrust vector, stick movement
re-naming and comments
* fix unittest, update comment
* normalize heading magnitude, add pitch and roll suppression factors
* ignore pitch factor on wings
because they 'normally' have forward velocity while flat
and their path while rolled usually does not change abruptly
* fix unit test
* fix dumb mistake blocking pitch suppression for non-wings
* fixes from review thanks PL
* refactor vector2normalize - thanks to karate
* Use X and Y for 0 and 1 in rMat
* Revert debugs, update comments from review
* lrintf for floats in debugs
* vector.h - implement some vector2* code as vector*
* Refactor IMU code
Move compass and Cog code into separate functions, separate gain
heuristics
- imuCalcGroundspeedGain
- imuCalcCourseErr
- imuCalcMagErr
Temporary refactor od imuDebug_GPS_RESCUE_HEADING, to be removed of optimized
* Simplify simulator build conditional compilation
* Adapt unittests to IMU after refactoring
* Maybe fix the test?
=
* Update src/main/flight/imu.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/flight/imu.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/flight/imu.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/flight/imu.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Update src/main/flight/imu.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
---------
Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
* Add support for GoerTek SPA006_003 barometer - based on DPS310
* Fix missing coefficients
* Fix tabs
* Fix per review Ledvinap
* Add missing coefs for pressure calculation
* Use chunk size of 9 bytes
* Fix MIN
* Update comment
* Be more explicit
* Update src/main/drivers/barometer/barometer_dps310.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
---------
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
Data registers are locked until last/unlock register is read. New data
are not stored when locked and DRDY is not set.
On bus error, read may finish early (not reading unlock register) and thus
cause driver lockup.
Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
* Use intptr_t for casting void * to an integer
* Update src/main/cms/cms.c
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
---------
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>