1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00
Commit graph

121 commits

Author SHA1 Message Date
Bruce Luckcuck
37dbbd0755 Add GPS coordinates OSD elements display variants; add support for Open Location Code display
Adds variations in GPS coordinate OSD element display:
1. Fractional degrees with 7 digits (default) - 000.0000000
2. Fractional degrees with 4 digits - 000.0000
3. Degrees, minutes, seconds - 000^00'00.0"E
4. Open Location Code (sometimed called Google Plus Code) - 23ABC4R8+M37

Uses Open Location Code library from:
https://github.com/google/open-location-code

Added support for `STATE(GPS_FIX_EVER)` to differentiate from having a fix now (`STATE(GPS_FIX)`) vs. ever having a fix.

Logic change to only display coordinates from the GPS module once a fix has been initially established. This prevents displaying interim coordinates supplied by the GPS while the fix is still being establised as these coordinates can be inaccurate by hundreds of miles. Once a fix is established initially then the coordinates will continue to be displayed even if the fix is lost or degrades in quality.

Add logic to "blink" the coordinates if the 3D fix is lost after initially being established. Alerts the user that the coordinate display may be inaccurate or no longer being updated. We want to keep the coordinates displayed to aid recovery if the user loses the fix (like crashing upside down).

Replace GPS defines `LAT` and `LON` used throughout the code with the enumeration:
```
typedef enum {
    GPS_LATITUDE,
    GPS_LONGITUDE
} gpsCoordinateType_e;
```

The Open Location Code option is bounded with `USE_GPS_PLUS_CODE` to allow it to be excluded if needed for targets with limited flash space. It currently fits for F411 but we may have to remove it in the future.
2021-04-26 23:43:11 +12:00
Davor Kustec
dd184dd67f Named everything well 2021-02-25 18:07:18 +01:00
Bruce Luckcuck
b5bf9c2b4c Add a common function used to print formatted floats in the OSD
Updated the OSD element and stats rendering code to use this fuction to print floating point values of varying precisions.

Will make adding OSD element variants that provide different decimal precisions (like voltage, amperage, etc.) easy to implement since all that needs to change is the `decimalPlaces` passed to the function. As an example, see the `osdFormatAltitudeString()` function.

If at some later date a more capable `printf` package is inplemented, then the guts of the `osdPrintFloat()` function could just be simplified while leaving the abstraction in place.
2021-02-17 08:09:52 -05:00
Michael Keller
e331111789
Merge pull request #10551 from etracer65/osd_altitude_element_variants
Add OSD element variants for altitude
2021-02-18 00:20:18 +13:00
Michael Keller
d2867ef9ce
Merge pull request #10540 from etracer65/osd_warnings_msp
Separate OSD warnings from OSD task and make available via MSP
2021-02-17 07:52:37 +13:00
Bruce Luckcuck
9b66ef31eb Add OSD element variants for altitude
Variant 1 (default): Altitude displays with one decimal place. No change in behavior.

Variant 2: Altitude displays as whole number (no decimal) so it will represent meters or feet depending on the units selected.
2021-02-14 20:11:33 -05:00
Michael Keller
28d3156e8b
Merge pull request #10517 from etracer65/osd_element_types
Add support for OSD element type variants
2021-02-14 16:01:37 +13:00
Bruce Luckcuck
84b6730cdd Separate OSD warnings from OSD task and make available via MSP
Provides a properly implemented way for MSP query type OSD implementations (like DJI) to display OSD warnings. Separates the warnings generation from the OSD task and shares common code to make the text available for the OSD and/or via MSP. Eliminates the need to implement hacks and workarounds like using the `CRAFT_NAME` field to display warnings. Since the warnings logic is now separate, the OSD task does not need to be running unlike other hacks.

Adds the `MSP2_GET_OSD_WARNINGS` message formatted as follows:
```
byte  description
0     Display attributes including blink (see displayPortAttr_e in drivers/display.h)
1     Length of warning text
2-n   Warning text characters
```
2021-02-13 14:11:38 -05:00
Robert Cisneros
9e5cdbf2be Enable Up/Down reference for artificial horizon in OSD
This mod adds an arrow symbol showing the location of the up/down on the OSD.  The arrow direction points in the direction of up or down.

Update osd_elements.c

Making the Up/Down OSD reference its own element

Removing the Up/Down reference from the artificial horizon and making a specific element for this feature.  Activation via CLI (for now)

Updates to Up/Down refernce OSD element

Changed the up/down reference so that it is its own separarte element.  The position is absolute on the screen and immutable by the user for consistent operation. Updated settings to include CLI option for turning the feature on and off.

Update cms_menu_osd.c

Updated file to add Up/Down reference selection from OSD menu

Updates to simplify/correct Up/Down OSD element

Simplified/corrected logic and removed arcsine function.  OSD up/down reference is now positionable by the user in the configurator.

Tweaks and codestyle updates

Feedback from Michael Keller

Updates to Up/Down OSD indicator

Created a bounding box of +/- 25 degrees for indicator

Coding style correction

minor correction to match BF coding style

Enable Up/Down reference in OSD

This mod adds an arrow symbol showing the location of the up/down on the OSD.  The arrow direction points in the direction of up or down.

Update osd_elements.c

Making the Up/Down OSD reference its own element

Removing the Up/Down reference from the artificial horizon and making a specific element for this feature.  Activation via CLI (for now)

Updates to Up/Down refernce OSD element

Changed the up/down reference so that it is its own separarte element.  The position is absolute on the screen and immutable by the user for consistent operation. Updated settings to include CLI option for turning the feature on and off.

Updates to simplify/correct Up/Down OSD element

Simplified/corrected logic and removed arcsine function.  OSD up/down reference is now positionable by the user in the configurator.

Tweaks and codestyle updates

Feedback from Michael Keller

Enable Up/Down reference for artificial horizon in OSD

This mod adds an arrow symbol showing the location of the up/down on the OSD.  The arrow direction points in the direction of up or down.

Update osd_elements.c

Making the Up/Down OSD reference its own element

Removing the Up/Down reference from the artificial horizon and making a specific element for this feature.  Activation via CLI (for now)

Updates to Up/Down refernce OSD element

Changed the up/down reference so that it is its own separarte element.  The position is absolute on the screen and immutable by the user for consistent operation. Updated settings to include CLI option for turning the feature on and off.

Updates to simplify/correct Up/Down OSD element

Simplified/corrected logic and removed arcsine function.  OSD up/down reference is now positionable by the user in the configurator.

Tweaks and codestyle updates

Feedback from Michael Keller

Coding style correction

minor correction to match BF coding style

Enable Up/Down reference for artificial horizon in OSD

This mod adds an arrow symbol showing the location of the up/down on the OSD.  The arrow direction points in the direction of up or down.

Update osd_elements.c

Making the Up/Down OSD reference its own element

Removing the Up/Down reference from the artificial horizon and making a specific element for this feature.  Activation via CLI (for now)

Updates to Up/Down refernce OSD element

Changed the up/down reference so that it is its own separarte element.  The position is absolute on the screen and immutable by the user for consistent operation. Updated settings to include CLI option for turning the feature on and off.

Updates to simplify/correct Up/Down OSD element

Simplified/corrected logic and removed arcsine function.  OSD up/down reference is now positionable by the user in the configurator.

Tweaks and codestyle updates

Feedback from Michael Keller

Corrections to unit tests

Corrected unit tests link failing due to not being able to find rMat[3][3]
2021-02-08 16:03:45 +13:00
Bruce Luckcuck
45aad0d379 Add support for OSD element type variants
Extends the OSD element position setting to include a 2 bit selector for alternate representations of the element. So up to 4 variants of an element can be supported. Meant to be used instead of adding new elements when the request is a mutually exclusive variant of an existing element. If there are no variants of an element then the logic falls back to "type 1" (`OSD_ELEMENT_TYPE_1`) which is the only representation of the element.

As an example, in this PR the "Battery usage" element has been extended to 4 types:
1. The original capacity remaining graphical bar (shrinks as battery is used) - this is the default.
2. Capacity used graphical bar (grows as battery is used).
3. Remaining capacity numerical percentage (goes down as battery is used).
4. Capacity used numerical percentage (goes up as battery is used).

When extending an element it is not necessary to support all 4 types and the element rendering code should default to the original type 1 version for unsupported types.

Will require Configurator support. Since the 2 high bits of the `uint16` were previously unused the setting will default to the "type 1" original variant in all cases where an incompatible Configurator is used.
2021-01-26 19:35:13 -05:00
Michael Keller
a702ee1a5b Simplified the OSD blink frequency calculation. 2021-01-02 01:04:13 +01:00
Bruce Luckcuck
f7d992b2bd Improve OSD blink logic
Changes the blink logic to be OSD task loop based instead of time based.

The previous logic used a 200ms time interval for the blinking which didn't align well with the default 12hz OSD update frequency resulting in the logic periodically missing intervals resulting in an inconsistent blinking.

As the revised logic is now tied to the OSD task iterations the blinking will be consistent. However due to the timing the blink will be slightly faster - 167ms (6hz) vs. the previous 200ms (5hz) intervals. Technically the blinking was 6hz before but stuttered every 5th blink.

Since the OSD task rate can be changed from the default 60hz, the logic will fall back to the time-based implementation for non-default task rates.
2020-12-25 12:41:44 -05:00
anthonycake
8c6fcf2995 Implement RSSI (dBm and Pct), LQ, in GHST driver
Issue #10336

Fix Typo in Ghost driver

Update src/main/osd/osd.c

Co-authored-by: haslinghuis <mark@numloq.nl>

Update src/main/rx/ghst.c

Co-authored-by: haslinghuis <mark@numloq.nl>

Update src/main/rx/rx.c

Co-authored-by: haslinghuis <mark@numloq.nl>

Future-proof GHST driver, while adding RSSI and LQ support

Ensure that future packet types which contain 4 channels of data, plus auxiliary data, are correctly handled by BF releases that predate them.

Implement changes suggested by reviewers

Cosmetics
2020-11-22 18:47:20 +01:00
limonspb
806595a7d4 Total flights stats for OSD 2020-10-25 01:32:51 -05:00
Bruce Luckcuck
a4ce46779e Add feedforward to OSD PID elements
Elements were never updated and only displayed the P, I and D gains.
2020-10-07 08:47:32 -04:00
Igor Shpakov
17706e3b65 Show stopped motors in Motor Diagnostic OSD element
When motor is stopped and not spinning properly, show letter S instead
of expected esc output.

This is useful after crash recovery or during turtle mode.
2020-09-22 17:28:22 +01:00
mikeller
7836bc220c Fixed motorOutputLimitLow in blackbox and OSD. 2020-08-31 22:00:23 +12:00
haslinghuis
9ae3adaa51 Measurement units for OSD elements and FRSKY hub telemetry. 2020-08-23 16:23:57 +02:00
Miguel Angel Mulero Martinez
10a67e3a1a OSD: Move crosshair to active elements and not background 2020-06-25 13:50:16 +02:00
mikeller
b9462c386f Fixed inconsistency in ANGLE mode naming. 2020-04-08 13:24:34 +12:00
fgiudice98
9093c46456 Fix osd vbat digits
IE was showing 4.9 instead of 4.09
2020-03-31 21:41:06 +02:00
Bruce Luckcuck
13f83ee4a4 Prevent division by 0 error in battery usage OSD element
If the `bat_capacity` was set to 0 (the default) then it would result in a division by 0.
2020-03-26 14:01:18 -04:00
David Boone
93635f62aa Efficiency OSD element in mAh/km or mAh/mi 2020-03-17 15:51:46 -07:00
mikeller
d0cf12a52b Added option to display RX SNR dB for CRSF instead of RSSI dBm. 2020-03-07 17:29:21 +13:00
Michael Keller
3176368bc8
Merge pull request #9454 from rvdveen/low-capacity-warning
Add 'low capacity' warning shown when exceeding configured cap_alarm value
2020-02-15 13:05:43 +13:00
Roy van der Veen
89fad8dc7f Add 'low capacity' warning shown when exceeding configured cap_alarm value 2020-02-14 09:52:29 +01:00
AlessandroAU
925101cdb2 add crsf rf_mode parameter to osd display
make osdRFmode = 0 default

changes as requested

fixed formatting and unittests

remove 3.41 scaling on crsf LQ and simply osd drawing function

Update rx.c

changed loop to only go to 99 instead of 300
2020-02-13 02:52:18 +10:00
jflyper
104990c507 Add device local blinking support 2020-01-21 11:14:22 +09:00
Michael Keller
5b957d02c7
Merge pull request #9329 from fgiudice98/master
Fix battery osd precision
2020-01-17 01:11:47 +13:00
Matylitski Yury
e82dd4a616 fixed CLI segfault when no USE_OSD is set 2020-01-12 22:02:44 +03:00
fgiudice98
09a91aac44
Fix battery osd precision
with voltage <10V
2020-01-02 17:41:53 +01:00
Bruce Luckcuck
afeb88850f Move OSD elements into their own parameter group
Separates the OSD elements position/visible/profile flags from the `osdConfig` PG and moves them to a new `osdElementConfig` PG. Allows new elements to be added without having to constantly update the PG version for `osdConfig`.
2019-12-09 19:13:08 -05:00
Bruce Luckcuck
5c3b8c6eb6 Add camera frame OSD element
Adds an adjustable outline element designed to represent the field of view of the pilot's HD camera for visual framing. The width, height and position of the frame are adjustable.
2019-12-04 11:03:41 -05:00
Michael Keller
9425831756
Refactored 'WAS_EVER_ARMED' arming flag to be only enabled on f… (#9248)
Refactored 'WAS_EVER_ARMED' arming flag to be only enabled on first disarm.
2019-12-01 15:14:02 +13:00
Alberto García Hierro
37e66b3dda Add support for FrSky OSD
- Add displayWriteFontCharacter() for font writing, removing all max7456
specific code.
- Add displayIsReady() for asynchronous display initialization
- Add displayBeginTransaction()/displayCommitTransaction() for display
transactions, which allow performing complex drawing operations without
flickering
- Add displayGetCanvas(), which retrieves the canvas associated with a
display (if it has it)
- Add canvas implementation for pixel based access for a display
- Add FrSkyOSD driver and displayPort driver
- Enable FrSkyOSD driver for targets with flash > 256
- Rename max7456_symbols.h to osd_symbols.h
2019-11-30 22:06:36 +00:00
mikeller
93c708f57d Refactored 'WAS_EVER_ARMED' arming flag to be only enabled on first disarm. 2019-11-30 15:01:55 +13:00
jflyper
2e84b0c442 Add support for character attribute rich displayport 2019-11-25 10:43:29 +09:00
mikeller
cc8b8d3bf6 Improved detection of upright / 'SMALL_ANGLE' state. 2019-11-18 14:09:06 +13:00
Michael Keller
04c97c849e
Show blackbox log number in OSD only when available. (#9141)
Show blackbox log number in OSD only when available.
2019-11-04 14:45:39 +13:00
Bruce Luckcuck
4b600fbcb0 Blink the Launch Control warning element when throttle is withing 10% of the trigger setting
Provides a visual indication that throttle is close to the trigger limit.
2019-11-02 17:52:33 -04:00
mikeller
53955a4a6b Show blackbox log number in OSD only when available. 2019-11-03 02:29:38 +13:00
Michael Keller
8548189bc6
Add OSD background support for the static portions of display e… (#9129)
Add OSD background support for the static portions of display elements
2019-10-31 00:10:01 +13:00
Bruce Luckcuck
5f5ee33718 Add OSD background support for the static portions of display elements
Significantly reduces the time the OSD task spends drawing elements that are completely or mostly static. The larger the element the more time savings are realized. Currently implemented support for:
- Crosshairs
- Artificial Horizon Sidebars
- Craft name
- Display name
- Stick overlay

Since the static portions are only rendered once, the static elements add no processing time to the OSD task. As an example, enabling the above elements prior to these changes results in a total rendering time of 47us. After the enhancements they take only 6us (basically the rendering phase minimum overhead). So effectively 41us are removed from the OSD task.

Opens the possibility to add large mostly static elements with no additional overhead. An example would be a camera framing element that might draw a "box" around most of the screen. Previously this would add significant processing overhead to the OSD task, but now it will have no impact.
2019-10-28 19:34:29 -04:00
mikeller
4a7904695e Moved 'config.[ch]' into the 'config/' directory. 2019-10-28 11:17:25 +13:00
Bruce Luckcuck
565f1f4db5 Add ACC_CALIB arming disabled reason if ACC is required but not calibrated
Checks various features, modes, and OSD elements to determine if ACC is needed. Generates an arming disabled warning if ACC calibration has never been completed.
2019-10-21 11:13:55 -04:00
Bruce Luckcuck
a021cc7c14 Add OSD distance from home alarm
Adds `osd_distance_alarm` (defaulting to 0 for OFF) which behaves similarly to `osd_alt_alarm`. Causes the OSD distance to home element to blink if the alarm setting is exceeded.

Also added to the CMS menu for consistency with the altitude alarm.
2019-10-21 20:17:12 +13:00
jflyper
d4b4e37f6f Add RC channel values to OSD 2019-09-12 22:53:21 +09:00
Michael Keller
c33cc100ec
Merge pull request #8759 from TonyBlit/3d_speed
Feature: show 3d speed on the OSD
2019-09-01 01:19:03 +12:00
Tony Cabello
0ddcfc097c Feature: show 3d speed on OSD 2019-08-30 08:21:19 +02:00
Tony Cabello
8cd23873a6 Feature: show HDOP next to sats indicator 2019-08-26 22:28:33 +02:00