Add tooltips for OSD elements and ststistics

10.3.x-maintenance
Dan Nixon 2017-05-22 18:10:32 +01:00
parent 7ef4334dfa
commit beecf9868c
2 changed files with 216 additions and 14 deletions

View File

@ -2151,6 +2151,130 @@
"message": "Reset Settings" "message": "Reset Settings"
}, },
"osdDescElementMainBattVoltage": {
"message": "Instantaneous main battery voltage (flashes when below alarm threshold)"
},
"osdDescElementRssiValue": {
"message": "Instantaneous RSSI value (flashes when below alarm threshold)"
},
"osdDescElementThrottlePosition": {
"message": "Current throttle channel value"
},
"osdDescElementArmed": {
"message": "Textual armed message"
},
"osdDescElementDisarmed": {
"message": "Textual disarmed message"
},
"osdDescElementCrosshairs": {
"message": "Center of screen crosshair"
},
"osdDescElementArtificialHorizon": {
"message": "Graphical artificial horizon indicator"
},
"osdDescElementHorizonSidebars": {
"message": "Sidebars around artificial horizon indicator"
},
"osdDescElementCurrentDraw": {
"message": "Instantaneous battery current draw"
},
"osdDescElementMahDrawn": {
"message": "Total battery capacity used"
},
"osdDescElementCraftName": {
"message": "Craft name as set in Configuration tab"
},
"osdDescElementAltitude": {
"message": "Current altitude (flashes when above alarm threshold)"
},
"osdDescElementOnTime": {
"message": "Total time the craft has been powered on"
},
"osdDescElementFlyTime": {
"message": "Total time the craft has been armed in the current power cycle (flashes when above alarm threshold)"
},
"osdDescElementFlyMode": {
"message": "Current flight mode"
},
"osdDescElementGPSSpeed": {
"message": "GPS provided speed"
},
"osdDescElementGPSSats": {
"message": "Number of satellites providing GPS fix"
},
"osdDescElementGPSLon": {
"message": "GPS longitude"
},
"osdDescElementGPSLat": {
"message": "GPS latitude"
},
"osdDescElementDebug": {
"message": "Debug variables"
},
"osdDescElementPIDRoll": {
"message": "Roll axis PID gains"
},
"osdDescElementPIDPitch": {
"message": "Pitch axis PID gains"
},
"osdDescElementPIDYaw": {
"message": "Yaw axis PID gains"
},
"osdDescElementPower": {
"message": "Instantaneous electrical power consumption"
},
"osdDescElementPIDRateProfile": {
"message": "Numerical display of the active PID and rate profiles"
},
"osdDescElementBatteryWarning": {
"message": "Warning text that appears when the battery voltage falls below warning threshold"
},
"osdDescElementAvgCellVoltage": {
"message": "Average cell voltage (main battery voltage / cell count)"
},
"osdDescElementPitchAngle": {
"message": "Numerical pitch angle in degrees"
},
"osdDescElementRollAngle": {
"message": "Numerical roll angle in degrees"
},
"osdDescElementMainBattUsage": {
"message": "Graphical representation of battery capacity usage"
},
"osdDescElementArmedTime": {
"message": "Time since the craft was last armed"
},
"osdDescStatMaxSpeed": {
"message": "Maximum recorded speed"
},
"osdDescStatMinBattery": {
"message": "Minimum recorded main battery voltage"
},
"osdDescStatMinRssi": {
"message": "Minimum recorded RSSI"
},
"osdDescStatMaxCurrent": {
"message": "Maximum recorded current draw"
},
"osdDescStatUsedMah": {
"message": "Battery capacity used"
},
"osdDescStatMaxAltitude": {
"message": "Maximum recorded altitude"
},
"osdDescStatBlackbox": {
"message": "Percentage of total blackbox use"
},
"osdDescStatEndBattery": {
"message": "Battery voltage at time of disarm"
},
"osdDescStatFlyTime": {
"message": "Total time craft has been armed on current power cycle"
},
"osdDescStatArmedTime": {
"message": "Time since craft was last armed"
},
"mainHelpArmed": { "mainHelpArmed": {
"message": "Motor Arming" "message": "Motor Arming"

View File

@ -217,7 +217,8 @@ OSD.initData = function() {
display_items: [], display_items: [],
last_positions: {}, last_positions: {},
preview_logo: true, preview_logo: true,
preview: [] preview: [],
tooltips: []
}; };
}; };
OSD.initData(); OSD.initData();
@ -248,12 +249,14 @@ OSD.constants = {
ALL_DISPLAY_FIELDS: { ALL_DISPLAY_FIELDS: {
MAIN_BATT_VOLTAGE: { MAIN_BATT_VOLTAGE: {
name: 'MAIN_BATT_VOLTAGE', name: 'MAIN_BATT_VOLTAGE',
desc: 'osdDescElementMainBattVoltage',
default_position: -29, default_position: -29,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.BATTERY) + '16.8' + FONT.symbol(SYM.VOLT) preview: FONT.symbol(SYM.BATTERY) + '16.8' + FONT.symbol(SYM.VOLT)
}, },
RSSI_VALUE: { RSSI_VALUE: {
name: 'RSSI_VALUE', name: 'RSSI_VALUE',
desc: 'osdDescElementRssiValue',
default_position: -59, default_position: -59,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.RSSI) + '99' preview: FONT.symbol(SYM.RSSI) + '99'
@ -266,6 +269,7 @@ OSD.constants = {
}, },
THROTTLE_POSITION: { THROTTLE_POSITION: {
name: 'THROTTLE_POSITION', name: 'THROTTLE_POSITION',
desc: 'osdDescElementThrottlePosition',
default_position: -9, default_position: -9,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.THR) + FONT.symbol(SYM.THR1) + ' 69' preview: FONT.symbol(SYM.THR) + FONT.symbol(SYM.THR1) + ' 69'
@ -290,51 +294,60 @@ OSD.constants = {
}, },
ARMED: { ARMED: {
name: 'ARMED', name: 'ARMED',
desc: 'osdDescElementArmed',
default_position: -107, default_position: -107,
positionable: true, positionable: true,
preview: 'ARMED' preview: 'ARMED'
}, },
DISARMED: { DISARMED: {
name: 'DISARMED', name: 'DISARMED',
desc: 'osdDescElementDisarmed',
default_position: -109, default_position: -109,
positionable: true, positionable: true,
preview: 'DISARMED' preview: 'DISARMED'
}, },
CROSSHAIRS: { CROSSHAIRS: {
name: 'CROSSHAIRS', name: 'CROSSHAIRS',
desc: 'osdDescElementCrosshairs',
default_position: -1, default_position: -1,
positionable: false positionable: false
}, },
ARTIFICIAL_HORIZON: { ARTIFICIAL_HORIZON: {
name: 'ARTIFICIAL_HORIZON', name: 'ARTIFICIAL_HORIZON',
desc: 'osdDescElementArtificialHorizon',
default_position: -1, default_position: -1,
positionable: false positionable: false
}, },
HORIZON_SIDEBARS: { HORIZON_SIDEBARS: {
name: 'HORIZON_SIDEBARS', name: 'HORIZON_SIDEBARS',
desc: 'osdDescElementHorizonSidebars',
default_position: -1, default_position: -1,
positionable: false positionable: false
}, },
CURRENT_DRAW: { CURRENT_DRAW: {
name: 'CURRENT_DRAW', name: 'CURRENT_DRAW',
desc: 'osdDescElementCurrentDraw',
default_position: -23, default_position: -23,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.AMP) + '42.0' preview: FONT.symbol(SYM.AMP) + '42.0'
}, },
MAH_DRAWN: { MAH_DRAWN: {
name: 'MAH_DRAWN', name: 'MAH_DRAWN',
desc: 'osdDescElementMahDrawn',
default_position: -18, default_position: -18,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.MAH) + '690' preview: FONT.symbol(SYM.MAH) + '690'
}, },
CRAFT_NAME: { CRAFT_NAME: {
name: 'CRAFT_NAME', name: 'CRAFT_NAME',
desc: 'osdDescElementCraftName',
default_position: -77, default_position: -77,
positionable: true, positionable: true,
preview: 'CRAFT_NAME' preview: 'CRAFT_NAME'
}, },
ALTITUDE: { ALTITUDE: {
name: 'ALTITUDE', name: 'ALTITUDE',
desc: 'osdDescElementAltitude',
default_position: 62, default_position: 62,
positionable: true, positionable: true,
preview: function(osd_data) { preview: function(osd_data) {
@ -343,114 +356,133 @@ OSD.constants = {
}, },
ONTIME: { ONTIME: {
name: 'ONTIME', name: 'ONTIME',
desc: 'osdDescElementOnTime',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.ON_M) + '05:42' preview: FONT.symbol(SYM.ON_M) + '05:42'
}, },
FLYTIME: { FLYTIME: {
name: 'FLYTIME', name: 'FLYTIME',
desc: 'osdDescElementFlyTime',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.FLY_M) + '04:11' preview: FONT.symbol(SYM.FLY_M) + '04:11'
}, },
FLYMODE: { FLYMODE: {
name: 'FLYMODE', name: 'FLYMODE',
desc: 'osdDescElementFlyMode',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: 'STAB' preview: 'STAB'
}, },
GPS_SPEED: { GPS_SPEED: {
name: 'GPS_SPEED', name: 'GPS_SPEED',
desc: 'osdDescElementGPSSpeed',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: '40' preview: '40'
}, },
GPS_SATS: { GPS_SATS: {
name: 'GPS_SATS', name: 'GPS_SATS',
desc: 'osdDescElementGPSSats',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.GPS_SAT) + '14' preview: FONT.symbol(SYM.GPS_SAT) + '14'
}, },
GPS_LON: { GPS_LON: {
name: 'GPS_LON', name: 'GPS_LON',
desc: 'osdDescElementGPSLon',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.ARROW_SOUTH) + '00.00000000' preview: FONT.symbol(SYM.ARROW_SOUTH) + '00.00000000'
}, },
GPS_LAT: { GPS_LAT: {
name: 'GPS_LAT', name: 'GPS_LAT',
desc: 'osdDescElementGPSLat',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.ARROW_EAST) + '00.00000000' preview: FONT.symbol(SYM.ARROW_EAST) + '00.00000000'
}, },
DEBUG: { DEBUG: {
name: 'DEBUG', name: 'DEBUG',
desc: 'osdDescElementDebug',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: 'DBG 0 0 0 0' preview: 'DBG 0 0 0 0'
}, },
PID_ROLL: { PID_ROLL: {
name: 'PID_ROLL', name: 'PID_ROLL',
desc: 'osdDescElementPIDRoll',
default_position: 0x800 | (10 << 5) | 2, // 0x0800 | (y << 5) | x default_position: 0x800 | (10 << 5) | 2, // 0x0800 | (y << 5) | x
positionable: true, positionable: true,
preview: 'ROL 43 40 20' preview: 'ROL 43 40 20'
}, },
PID_PITCH: { PID_PITCH: {
name: 'PID_PITCH', name: 'PID_PITCH',
desc: 'osdDescElementPIDPitch',
default_position: 0x800 | (11 << 5) | 2, // 0x0800 | (y << 5) | x default_position: 0x800 | (11 << 5) | 2, // 0x0800 | (y << 5) | x
positionable: true, positionable: true,
preview: 'PIT 58 50 22' preview: 'PIT 58 50 22'
}, },
PID_YAW: { PID_YAW: {
name: 'PID_YAW', name: 'PID_YAW',
desc: 'osdDescElementPIDYaw',
default_position: 0x800 | (12 << 5) | 2, // 0x0800 | (y << 5) | x default_position: 0x800 | (12 << 5) | 2, // 0x0800 | (y << 5) | x
positionable: true, positionable: true,
preview: 'YAW 70 45 20' preview: 'YAW 70 45 20'
}, },
POWER: { POWER: {
name: 'POWER', name: 'POWER',
desc: 'osdDescElementPower',
default_position: (15 << 5) | 2, default_position: (15 << 5) | 2,
positionable: true, positionable: true,
preview: '142W' preview: '142W'
}, },
PID_RATE_PROFILE: { PID_RATE_PROFILE: {
name: 'PID_RATE_PROFILE', name: 'PID_RATE_PROFILE',
desc: 'osdDescElementPIDRateProfile',
default_position: 0x800 | (13 << 5) | 2, // 0x0800 | (y << 5) | x default_position: 0x800 | (13 << 5) | 2, // 0x0800 | (y << 5) | x
positionable: true, positionable: true,
preview: '1-2' preview: '1-2'
}, },
BATTERY_WARNING: { BATTERY_WARNING: {
name: 'BATTERY_WARNING', name: 'BATTERY_WARNING',
desc: 'osdDescElementBatteryWarning',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: 'LOW VOLTAGE' preview: 'LOW VOLTAGE'
}, },
AVG_CELL_VOLTAGE: { AVG_CELL_VOLTAGE: {
name: 'AVG_CELL_VOLTAGE', name: 'AVG_CELL_VOLTAGE',
desc: 'osdDescElementAvgCellVoltage',
default_position: 12 << 5, default_position: 12 << 5,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.BATTERY) + '3.98' + FONT.symbol(SYM.VOLT) preview: FONT.symbol(SYM.BATTERY) + '3.98' + FONT.symbol(SYM.VOLT)
}, },
PITCH_ANGLE: { PITCH_ANGLE: {
name: 'PITCH_ANGLE', name: 'PITCH_ANGLE',
desc: 'osdDescElementPitchAngle',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: '-00.0' preview: '-00.0'
}, },
ROLL_ANGLE: { ROLL_ANGLE: {
name: 'ROLL_ANGLE', name: 'ROLL_ANGLE',
desc: 'osdDescElementRollAngle',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: '-00.0' preview: '-00.0'
}, },
MAIN_BATT_USAGE: { MAIN_BATT_USAGE: {
name: 'MAIN_BATT_USAGE', name: 'MAIN_BATT_USAGE',
desc: 'osdDescElementMainBattUsage',
default_position: -17, default_position: -17,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.PB_START) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_END) + FONT.symbol(SYM.PB_EMPTY) + FONT.symbol(SYM.PB_CLOSE) preview: FONT.symbol(SYM.PB_START) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_FULL) + FONT.symbol(SYM.PB_END) + FONT.symbol(SYM.PB_EMPTY) + FONT.symbol(SYM.PB_CLOSE)
}, },
ARMED_TIME: { ARMED_TIME: {
name: 'ARMED_TIME', name: 'ARMED_TIME',
desc: 'osdDescElementArmedTime',
default_position: -1, default_position: -1,
positionable: true, positionable: true,
preview: FONT.symbol(SYM.FLY_M) + '02:07' preview: FONT.symbol(SYM.FLY_M) + '02:07'
@ -470,37 +502,46 @@ OSD.constants = {
} }
} }
}, },
ALL_STATISTIC_FIELDS: { ALL_STATISTIC_FIELDS: {
MAX_SPEED: { MAX_SPEED: {
name: 'MAX_SPEED' name: 'MAX_SPEED',
desc: 'osdDescStatMaxSpeed'
}, },
MIN_BATTERY: { MIN_BATTERY: {
name: 'MIN_BATTERY' name: 'MIN_BATTERY',
desc: 'osdDescStatMinBattery'
}, },
MIN_RSSI: { MIN_RSSI: {
name: 'MIN_RSSI' name: 'MIN_RSSI',
desc: 'osdDescStatMinRssi'
}, },
MAX_CURRENT: { MAX_CURRENT: {
name: 'MAX_CURRENT' name: 'MAX_CURRENT',
desc: 'osdDescStatMaxCurrent'
}, },
USED_MAH: { USED_MAH: {
name: 'USED_MAH' name: 'USED_MAH',
desc: 'osdDescStatUsedMah'
}, },
MAX_ALTITUDE: { MAX_ALTITUDE: {
name: 'MAX_ALTITUDE' name: 'MAX_ALTITUDE',
desc: 'osdDescStatMaxAltitude'
}, },
BLACKBOX: { BLACKBOX: {
name: 'BLACKBOX' name: 'BLACKBOX',
desc: 'osdDescStatBlackbox'
}, },
END_BATTERY: { END_BATTERY: {
name: 'END_BATTERY' name: 'END_BATTERY',
desc: 'osdDescStatEndBattery'
}, },
FLYTIME: { FLYTIME: {
name: 'FLY_TIME' name: 'FLY_TIME',
desc: 'osdDescStatFlyTime'
}, },
ARMEDTIME: { ARMEDTIME: {
name: 'ARMED_TIME' name: 'ARMED_TIME',
desc: 'osdDescStatArmedTime'
}, },
MAX_DISTANCE: { MAX_DISTANCE: {
name: 'MAX_DISTANCE' name: 'MAX_DISTANCE'
@ -725,6 +766,7 @@ OSD.msp = {
var c = OSD.constants.DISPLAY_FIELDS[j]; var c = OSD.constants.DISPLAY_FIELDS[j];
d.display_items.push($.extend({ d.display_items.push($.extend({
name: c.name, name: c.name,
desc: c.desc,
index: j, index: j,
positionable: c.positionable, positionable: c.positionable,
preview: typeof(c.preview) === 'function' ? c.preview(d) : c.preview preview: typeof(c.preview) === 'function' ? c.preview(d) : c.preview
@ -739,6 +781,7 @@ OSD.msp = {
var c = OSD.constants.STATISTIC_FIELDS[j]; var c = OSD.constants.STATISTIC_FIELDS[j];
d.stat_items.push({ d.stat_items.push({
name: c.name, name: c.name,
desc: c.desc,
index: j, index: j,
enabled: v === 1 enabled: v === 1
}); });
@ -913,6 +956,14 @@ TABS.osd.initialize = function (callback) {
if (!field.name) { continue; } if (!field.name) { continue; }
var $field = $('<div class="stat-field field-'+field.index+'"/>'); var $field = $('<div class="stat-field field-'+field.index+'"/>');
var desc = null;
if (field.desc && field.desc.length) {
desc = chrome.i18n.getMessage(field.desc);
}
if (desc && desc.length) {
$field[0].classList.add('osd_tip');
$field.attr('title', desc);
}
$field.append( $field.append(
$('<input type="checkbox" name="'+field.name+'" class="togglesmall"></input>') $('<input type="checkbox" name="'+field.name+'" class="togglesmall"></input>')
.data('field', field) .data('field', field)
@ -949,6 +1000,14 @@ TABS.osd.initialize = function (callback) {
var checked = field.isVisible ? 'checked' : ''; var checked = field.isVisible ? 'checked' : '';
var $field = $('<div class="display-field field-'+field.index+'"/>'); var $field = $('<div class="display-field field-'+field.index+'"/>');
var desc = null;
if (field.desc && field.desc.length) {
desc = chrome.i18n.getMessage(field.desc);
}
if (desc && desc.length) {
$field[0].classList.add('osd_tip');
$field.attr('title', desc);
}
$field.append( $field.append(
$('<input type="checkbox" name="'+field.name+'" class="togglesmall"></input>') $('<input type="checkbox" name="'+field.name+'" class="togglesmall"></input>')
.data('field', field) .data('field', field)
@ -1085,6 +1144,25 @@ TABS.osd.initialize = function (callback) {
$row = $('<div class="row"/>'); $row = $('<div class="row"/>');
} }
} }
// Remove last tooltips
for (var tt of OSD.data.tooltips) {
tt.destroy();
}
OSD.data.tooltips = [];
// Generate tooltips for OSD elements
$('.osd_tip').each(function() {
OSD.data.tooltips.push($(this).jBox('Tooltip', {
delayOpen: 100,
delayClose: 100,
position: {
x: 'right',
y: 'center'
},
outside: 'x'
}));
});
}); });
}; };