New led functions gps bar battery bar altitude (#13404)
* 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>