1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 12:55:14 +03:00

Add display name to config, backup/restore and OSD

This commit is contained in:
Sean M 2018-10-13 00:22:14 -04:00 committed by mikeller
parent d502e69bb2
commit ab83c79315
5 changed files with 25 additions and 2 deletions

View file

@ -3564,6 +3564,9 @@
"osdDescElementCraftName": { "osdDescElementCraftName": {
"message": "Craft name as set in Configuration tab" "message": "Craft name as set in Configuration tab"
}, },
"osdDescElementDisplayName": {
"message": "Display name as set in Configuration tab"
},
"osdDescElementAltitude": { "osdDescElementAltitude": {
"message": "Current altitude (flashes when above alarm threshold)" "message": "Current altitude (flashes when above alarm threshold)"
}, },

View file

@ -143,6 +143,7 @@ function configuration_backup(callback) {
configuration.LED_COLORS = jQuery.extend(true, [], LED_COLORS); configuration.LED_COLORS = jQuery.extend(true, [], LED_COLORS);
configuration.BOARD_ALIGNMENT_CONFIG = jQuery.extend(true, {}, BOARD_ALIGNMENT_CONFIG); configuration.BOARD_ALIGNMENT_CONFIG = jQuery.extend(true, {}, BOARD_ALIGNMENT_CONFIG);
configuration.CRAFT_NAME = CONFIG.name; configuration.CRAFT_NAME = CONFIG.name;
configuration.DISPLAY_NAME = CONFIG.displayName;
configuration.MIXER_CONFIG = jQuery.extend(true, {}, MIXER_CONFIG); configuration.MIXER_CONFIG = jQuery.extend(true, {}, MIXER_CONFIG);
configuration.SENSOR_CONFIG = jQuery.extend(true, {}, SENSOR_CONFIG); configuration.SENSOR_CONFIG = jQuery.extend(true, {}, SENSOR_CONFIG);
configuration.PID_ADVANCED_CONFIG = jQuery.extend(true, {}, PID_ADVANCED_CONFIG); configuration.PID_ADVANCED_CONFIG = jQuery.extend(true, {}, PID_ADVANCED_CONFIG);
@ -833,6 +834,7 @@ function configuration_restore(callback) {
RSSI_CONFIG = configuration.RSSI_CONFIG; RSSI_CONFIG = configuration.RSSI_CONFIG;
BOARD_ALIGNMENT_CONFIG = configuration.BOARD_ALIGNMENT_CONFIG; BOARD_ALIGNMENT_CONFIG = configuration.BOARD_ALIGNMENT_CONFIG;
CONFIG.name = configuration.CRAFT_NAME; CONFIG.name = configuration.CRAFT_NAME;
CONFIG.displayName = configuration.DISPLAY_NAME;
MIXER_CONFIG = configuration.MIXER_CONFIG; MIXER_CONFIG = configuration.MIXER_CONFIG;
SENSOR_CONFIG = configuration.SENSOR_CONFIG; SENSOR_CONFIG = configuration.SENSOR_CONFIG;
PID_ADVANCED_CONFIG = configuration.PID_ADVANCED_CONFIG; PID_ADVANCED_CONFIG = configuration.PID_ADVANCED_CONFIG;

View file

@ -78,6 +78,7 @@ var FC = {
uid: [0, 0, 0], uid: [0, 0, 0],
accelerometerTrims: [0, 0], accelerometerTrims: [0, 0],
name: '', name: '',
displayName: 'JOE PILOT',
numProfiles: 3, numProfiles: 3,
rateProfile: 0, rateProfile: 0,
boardType: 0, boardType: 0,

View file

@ -515,7 +515,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('input[name="craftName"]').val(CONFIG.name); $('input[name="craftName"]').val(CONFIG.name);
if (semver.gte(CONFIG.apiVersion, "1.31.0")) { if (semver.gte(CONFIG.apiVersion, "1.31.0")) {
$('input[name="fpvCamAngleDegrees"]').val(RX_CONFIG.fpvCamAngleDegrees); $('input[name="fpvCamAngleDegrees"]').val(RX_CONFIG.fpvCamAngleDegrees);
} else { } else {
@ -1117,7 +1116,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
function save_sensor_alignment() { function save_sensor_alignment() {
var next_callback = save_esc_protocol; var next_callback = save_esc_protocol;
MSP.send_message(MSPCodes.MSP_SET_SENSOR_ALIGNMENT, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_ALIGNMENT), false, next_callback); MSP.send_message(MSPCodes.MSP_SET_SENSOR_ALIGNMENT, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_ALIGNMENT), false, next_callback);
} }
function save_esc_protocol() { function save_esc_protocol() {
var next_callback = save_acc_trim; var next_callback = save_acc_trim;

View file

@ -295,6 +295,13 @@ OSD.generateCraftName = function (osd_data) {
return preview; return preview;
} }
OSD.generateDisplayName = function(osd_data) {
var preview = 'DISPLAY_NAME';
if (CONFIG.displayName != '')
preview = CONFIG.displayName.toUpperCase();
return preview;
}
OSD.drawStickOverlayPreview = function () { OSD.drawStickOverlayPreview = function () {
function randomInt(count) { function randomInt(count) {
return Math.floor(Math.random() * Math.floor(count)); return Math.floor(Math.random() * Math.floor(count));
@ -914,6 +921,16 @@ OSD.constants = {
positionable: true, positionable: true,
preview: OSD.drawStickOverlayPreview preview: OSD.drawStickOverlayPreview
}, },
DISPLAY_NAME: {
name: 'DISPLAY_NAME',
desc: 'osdDescElementDisplayName',
default_position: -77,
draw_order: 380,
positionable: true,
preview: function(osd_data) {
return OSD.generateDisplayName(osd_data, 1);
}
},
}, },
UNKNOWN_DISPLAY_FIELD: { UNKNOWN_DISPLAY_FIELD: {
name: 'UNKNOWN_', name: 'UNKNOWN_',
@ -1189,6 +1206,7 @@ OSD.chooseFields = function () {
F.FLIGHT_DIST, F.FLIGHT_DIST,
F.STICK_OVERLAY_LEFT, F.STICK_OVERLAY_LEFT,
F.STICK_OVERLAY_RIGHT, F.STICK_OVERLAY_RIGHT,
F.DISPLAY_NAME,
]); ]);
} }
} }