1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00
Commit graph

142 commits

Author SHA1 Message Date
Jon Mahoney
a2d356dc78 Watt Hours Drawn OSD Element and Post Flight Stat
The Watt hours used element was added per a feature request to give
another way of interpreting the battery usage. It was also added as a
post flight stat to show consumption similar to the mAh post flight
stat. This once again is just giving pilots another option that some may
find useful.
2022-09-19 23:36:23 -04:00
J Blackman
c50372019d
Merge pull request #11275 from P-I-Engineer/VTX-power-OSD 2022-09-18 09:09:02 +10:00
iso9660
0dd6d4d47a Unified all eRPM calculations into one single function
Fixed some review findings

Unified dshot average rpm calculations into one single function

Renamed calcEscRpm to erpmToRpm, and moved function to dshot.c

Removed unused esc_sensor.h header file from dshot.c

Removed esc_sensor.h header from modules that no longer needs it

Average RPM calculated by demmand only when rpm data is updated

Renamed rpm to averageRpm and fixed a bug

Update average rpm when telemetry data is received

Removed blank line

Fixed review findings

Fixed return values for erpmToRpm and getDshotAverageRpm so rpm value doesn't truncate

Restored osd_esc_rmp_alarm setting. This setting is used to set an alarm to notify when rpm  goes down a specified threshold. Rpm can go over 109krpm (1s 26kv motors setup), but a low rpm alarm doesn't have to be set to a so high value so at this time [0-32767] seems an acceptable range

Rebased to master
2022-09-17 00:26:17 +02:00
danmos
21b3fc15b7 Extended Bidir DShot
Extended DSHOT telemetry
Fixed broken unit testing

Rebased to master

Extended DSHOT telemetry

Added DSHOT ESC fail to OSD warnings

Initial extended DSHOT implementation

DSHOT telemetry ranges readjusted

Added shot_telemetry_data to cli

Added DSHOT telemetry warnings

Added extended DSHOT telemetry temperature data to osd elements

Fixed DSHOT telemetry osd warnings

Make cli dshot telemetry types human readable

Fixed ESC temperature OSD element

Added extended dshot telemetry enable command to dshot command queue to enable it in tryArm function.

Fixed broken automated unit testing

Fixed text output for dshot_telemetry_data cli command

Decode extended telemetry only when it has been activated in the ESC

DSHOT extended telemetry is only enabled when an extended telemetry enable frame is being processed

Fixed broken automated unit testing

Update tail's dshot command in queue when running blocking commands, so extended dshot telemetry command responses can be associated to their corresponding extended dshot telemetry enable/disable command request

Added clariffication to dshot_get_telemetry_type_to_decode to explain mechanish used for processing DSHOT_CMD_EXTENDED_TELEMETRY_ENABLE response

Tabs cleanup
Added dshot motor stop fix when writting blocking commands

Added extended DSHOT telemetry to osd warnings
Fixed extended DSHOT telemetry in osd elements

Implemented msp extended dshot telemetry
Optimized osd warnings

Fixed code style

Added max temp to osd stats

Fixed automated unit testing

Fixed broken automated unit testing

Fixed missing extended dshot telemetry voltage and wrong current
Fixed unadverted change in gitignore file

Print esc number besides max esc tempetature in osd stats

issues and some other minor issues

ESC temperature is coded as an uint8 going from 0 to 255. Updated osd config esc_temp_alarm from int8_t to uint8_t to match esc temperature coding

issues and some other minor issues

Enable extended dshot telemetry when no esc sensors avaliable and dshot telemetry is enabled

Arranged dshot.h header and removed unnecessary headers from dshot.c

Updated dshot_telemetry_data cli command output

Fixed dshot_telemetry_data command

motor_output_unittest fixed

Fixed motor number printing in dshot_telemetry_data cli command

fixed motor_output_unittest

Merged dshot_telemetry_data into dshot_telemetry_info cli command

Fixed tabs

Fixed motor_output_unittest

Support extended DSHOT telemetry on DJI FPV

Fixed Compiling fails without USE_ESC_SENSOR and USE_DSHOT_TELEMETRY defines.

Fixed whencompiling without USE_ESC_SENSOR and USE_DSHOT_TELEMETRY

Reworked so code can be compiled with USE_ESC_SENSOR and USE_DSHOT_TELEMETRY separately

Enabling EDT the correct way

Removed unecessary conversions

Changed motorIndex datatype to uint8_t in dshot functions
2022-09-14 20:11:58 +02:00
ctzsnooze
09ee27cd97 Refactor sat count checks and GPS trust code
single minimum GPS satellite setting
single required GPS satellite setting
CLI Baro vs GPS trust user interface
GPS trust refactoring
allow arming with GPS_FIX even if not enough sats
required sats must be present to arm
set required sat count to 8
add blackbox headers
2022-09-07 09:55:35 +10:00
howels
07f882aed1 Lower max CraftName length to avoid inadvertent data loss 2022-08-16 12:17:56 +01:00
J Blackman
2bb3fef844
Merge pull request #11761 from SteveCEvans/semicolon
Remove superfluous double ;
2022-08-05 08:28:20 +10:00
howels
04994e5439 Add USE_CRAFTNAME_MSGS to insert additional data into CraftName when osd_craftname_msgs is true 2022-08-04 21:59:49 +01:00
Steve Evans
cf3615938b Remove superfluous double ; 2022-07-24 14:49:35 +01:00
J Blackman
40900658fc
Merge pull request #11670 from limonspb/osd_toupper_refactoring
Extract function toUpperCase for osd elements
2022-06-28 00:47:44 +10:00
Ivan Efimov
191294aad0 Extract function toUpperCase for osd elements 2022-06-23 05:00:30 -05:00
ctzsnooze
f7c645bfcd update GPS code 2022-06-13 09:43:52 +10:00
Robert Cisneros
874911c359 Update for Battery Efficiency Fix Issue #11277 2022-02-13 07:32:47 -06:00
Dominic Clifton
e2c0388a6a OSD - Add support for async screen clearing to display API.
No screen clearing is actually done asynchronously yet.
2022-01-22 18:59:11 +01:00
p-i-engineer
5cf79f0b2b added vtx osd channel variant element 2022-01-12 16:59:40 -08:00
Štěpán Dalecký
12dc2eb3fb Get rid of double math on <512kB targets 2021-12-23 00:15:57 +01:00
Štěpán Dalecký
4c034d67ee
Merge pull request #11099 from DusKing1/fix-aligning-in-osd-code
Fix code aligning in osd_elements.c
2021-12-21 01:45:58 +01:00
Steve Evans
ab1baccc66 Track state execution time for OSD, baro, rx and GPS tasks and inform scheduler of next state execution time 2021-12-17 15:40:01 +00:00
DusKing1
b6c317fbca fix aligning 2021-12-04 10:18:49 +08:00
Tony Cabello Miguel
c56d81457f Fixed tests, replaced hyphen with NC 2021-05-05 08:55:50 +02:00
Tony Cabello Miguel
aad83f5705 OSD Fix: show hyphen when no sats 2021-05-05 06:48:10 +02:00
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