Skip to content

Commit

Permalink
Update OSD
Browse files Browse the repository at this point in the history
- Remove references to CRSF where features are now shared with MSP RC
- Add new elements for downlink power and LQ
  • Loading branch information
MrD-RC committed Nov 4, 2024
1 parent 34591d2 commit 4ab8cf9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 36 deletions.
32 changes: 19 additions & 13 deletions locale/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3825,19 +3825,19 @@
"message": "Maximum ESC temperature"
},
"osd_snr_alarm": {
"message": "CRSF SNR Alarm Level"
"message": "SNR Alarm Level"
},
"osdalarmSNR_HELP": {
"message": "SNR is only shown below this value. 0dB (1:1 ratio), indicates that received signal equals noise floor."
},
"osd_link_quality_alarm": {
"message": "CRSF Link Quality Alarm"
"message": "Link Quality Alarm"
},
"osdalarmLQ_HELP": {
"message": "For Crossfire use 70%. For Tracer use 50%."
},
"osd_rssi_dbm_alarm": {
"message": "CRSF RSSI dBm Alarm"
"message": "RSSI dBm Alarm"
},
"osd_adsb_distance_warning": {
"message": "ADSB distance warning"
Expand Down Expand Up @@ -3884,8 +3884,8 @@
"osdGroupVTX": {
"message": "VTX"
},
"osdGroupCRSF": {
"message": "CRSF RX Statistics"
"osdGroupRx": {
"message": "RX Statistics"
},
"osdGroupMapsAndRadars": {
"message": "Maps & Radars"
Expand Down Expand Up @@ -4112,24 +4112,30 @@
"osdElement_VTX_CHANNEL_HELP": {
"message": "Shows the current band and channel of the VTX. Requires either a VTX with SmartAudio or Tramp or either a VTX integrated in the flight controller."
},
"osdElement_CRSF_RSSI_DBM": {
"osdElement_RSSI_DBM": {
"message": "RX RSSI in dBm"
},
"osdElement_CRSF_LQ": {
"message": "RX Link Quality %"
"osdElement_LQ_UPLINK": {
"message": "RX Uplink Quality %"
},
"osdElement_CRSF_LQ_HELP": {
"message": "Use Crossfire LQ Format setting to select format type."
"osdElement_LQ_UPLINK_HELP": {
"message": "If using CRSF, use Crossfire LQ Format setting to select format type."
},
"osdElement_CRSF_SNR_DB": {
"osdElement_LQ_DOWNLINK": {
"message": "RX Downlink Quality %"
},
"osdElement_SNR_DB": {
"message": "RX Uplink SNR in dB"
},
"osdElement_CRSF_SNR_DB_HELP": {
"osdElement_SNR_DB_HELP": {
"message": "Shown only when SNR goes below alarm level. At 0dB, received signal level equals noise floor level."
},
"osdElement_CRSF_TX_POWER": {
"osdElement_TX_POWER_UPLINK": {
"message": "TX power in mW"
},
"osdElement_OSD_RX_POWER_DOWNLINK": {
"message": "RX power in mW"
},
"osdElement_MAP_NORTH": {
"message": "Map (Up is north)"
},
Expand Down
12 changes: 6 additions & 6 deletions tabs/osd.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,18 @@ <h1 class="tab_title" data-i18n="tabOSD"></h1>
<input id="osd_rssi_alarm" data-setting="osd_rssi_alarm" data-setting-multiplier="1" type="number" data-step="1" />
<span data-i18n="osd_rssi_alarm"></span>
</label>
<div for="link_quality_alarm" class="helpicon cf_tip osd_use_crsf" data-i18n_title="osdalarmLQ_HELP"></div>
<label for="link_quality_alarm" class="osd_use_crsf">
<div for="link_quality_alarm" class="helpicon cf_tip osd_use_rx" data-i18n_title="osdalarmLQ_HELP"></div>
<label for="link_quality_alarm" class="osd_use_rx">
<input id="link_quality_alarm" data-setting="osd_link_quality_alarm" data-setting-multiplier="1" type="number" data-step="1" />
<span data-i18n="osd_link_quality_alarm"></span>
</label>
<div for="rssi_dbm_alarm" class="helpicon cf_tip osd_use_crsf" data-i18n_title="osd_rssi_dbm_alarm_HELP"></div>
<label for="rssi_dbm_alarm" class="osd_use_crsf">
<div for="rssi_dbm_alarm" class="helpicon cf_tip osd_use_rx" data-i18n_title="osd_rssi_dbm_alarm_HELP"></div>
<label for="rssi_dbm_alarm" class="osd_use_rx">
<input id="rssi_dbm_alarm" data-setting="osd_rssi_dbm_alarm" data-setting-multiplier="1" type="number" data-step="1" />
<span data-i18n="osd_rssi_dbm_alarm"></span>
</label>
<div for="snr_alarm" class="helpicon cf_tip osd_use_crsf" data-i18n_title="osdalarmSNR_HELP"></div>
<label for="snr_alarm" class="osd_use_crsf">
<div for="snr_alarm" class="helpicon cf_tip osd_use_rx" data-i18n_title="osdalarmSNR_HELP"></div>
<label for="snr_alarm" class="osd_use_rx">
<input id="snr_alarm" data-setting="osd_snr_alarm" data-setting-multiplier="1" type="number" data-step="1" />
<span data-i18n="osd_snr_alarm"></span>
</label>
Expand Down
51 changes: 34 additions & 17 deletions tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ SYM.PILOT_LOGO_SML_L = 0x1D5;
SYM.PILOT_LOGO_SML_C = 0x1D6;
SYM.PILOT_LOGO_SML_R = 0x1D7;

SYM.ARROW_DOWN = 0x144;

SYM.AH_AIRCRAFT0 = 0x1A2;
SYM.AH_AIRCRAFT1 = 0x1A3;
SYM.AH_AIRCRAFT2 = 0x1A4;
Expand Down Expand Up @@ -595,7 +597,7 @@ OSD.DjiElements = {
"GForce",
"Timers",
"VTX",
"CRSF",
"RX",
"SwitchIndicators",
"OSDCustomElements",
"GVars",
Expand Down Expand Up @@ -1820,45 +1822,57 @@ OSD.constants = {
]
},
{
name: 'osdGroupCRSF',
name: 'osdGroupRx',
enabled: function() {
return HARDWARE.capabilities.useCRSFRx;
return HARDWARE.capabilities.useRx;
},
items: [
{
name: 'CRSF_RSSI_DBM',
name: 'RSSI_DBM',
id: 109,
positionable: true,
preview: FONT.symbol(SYM.RSSI) + '-100' + FONT.symbol(SYM.DBM)
},
{
name: 'CRSF_LQ',
name: 'LQ_UPLINK',
id: 110,
positionable: true,
preview: function(osd_data) {
var crsflqformat;
if (Settings.getInputValue('osd_crsf_lq_format') == 0) {
crsflqformat = FONT.symbol(SYM.LQ) + '100';
} else if (Settings.getInputValue('osd_crsf_lq_format') == 1){
crsflqformat = FONT.symbol(SYM.LQ) + '2:100';
var lqFormat;
if (HARDWARE.capabilities.useCRSF && Settings.getInputValue('osd_crsf_lq_format') == 1){
lqFormat = FONT.symbol(SYM.LQ) + '2:100';
} else if (HARDWARE.capabilities.useCRSF && Settings.getInputValue('osd_crsf_lq_format') == 2) {
lqFormat = FONT.symbol(SYM.LQ) + '300';
} else {
crsflqformat = FONT.symbol(SYM.LQ) + '300';
lqFormat = FONT.symbol(SYM.LQ) + '100';
}
return crsflqformat;
return lqFormat;
}
},
{
name: 'CRSF_SNR_DB',
name: 'LQ_DOWNLINK',
id: 159,
positionable: true,
preview: FONT.symbol(SYM.LQ) + '100' + FONT.symbol(SYM.ARROW_DOWN)
},
{
name: 'SNR_DB',
id: 111,
positionable: true,
preview: FONT.symbol(SYM.SNR) + '-12' + FONT.symbol(SYM.DB)
},
{
name: 'CRSF_TX_POWER',
name: 'TX_POWER_UPLINK',
id: 112,
positionable: true,
preview: ' 10' + FONT.symbol(SYM.MW)
},
{
name: 'RX_POWER_DOWNLINK',
id: 160,
positionable: true,
preview: ' 10' + FONT.symbol(SYM.MW) + FONT.symbol(SYM.ARROW_DOWN)
},
]
},
{
Expand Down Expand Up @@ -3001,7 +3015,8 @@ OSD.GUI.updateAlarms = function() {
$(".osd_use_airspeed_alarm").toggle(HARDWARE.capabilities.usePitot);
$(".osd_use_baro_temp_alarm").toggle(HARDWARE.capabilities.useBaro);
$(".osd_use_esc_telemetry").toggle(HARDWARE.capabilities.useESCTelemetry);
$(".osd_use_crsf").toggle(HARDWARE.capabilities.useCRSFRx);
$(".osd_use_rx").toggle(HARDWARE.capabilities.useRx);
$(".osd_use_crsf").toggle(HARDWARE.capabilities.useCRSF);
};

OSD.GUI.updateMapPreview = function(mapCenter, name, directionSymbol, centerSymbol) {
Expand Down Expand Up @@ -3318,7 +3333,8 @@ HARDWARE.init = function() {
isDjiHdFpv: false,
isMspDisplay: false,
useESCTelemetry: false,
useCRSFRx: false,
useRx: false,
useCRSF: false,
useBaro: false,
usePitot: false
};
Expand All @@ -3343,7 +3359,8 @@ HARDWARE.update = function(callback) {

// Update RX data for Crossfire detection
mspHelper.loadRxConfig(function() {
HARDWARE.capabilities.useCRSFRx = (FC.RX_CONFIG.serialrx_provider == 6);
HARDWARE.capabilities.useCRSF = (FC.RX_CONFIG.serialrx_provider == 6); // CRSF
HARDWARE.capabilities.useRx = (FC.RX_CONFIG.serialrx_provider == 6 || FC.RX_CONFIG.receiver_type == 2); // CRSF or MSP

mspHelper.loadSensorConfig(function () {
HARDWARE.capabilities.useBaro = (FC.SENSOR_CONFIG.barometer != 0);
Expand Down

0 comments on commit 4ab8cf9

Please sign in to comment.