Add 'Pilot name' to the Configurator UI; rename 'Display name' to 'Pilot name'; rename 'name' to 'craft_name'
- add pilot name (display_name) to the Configuration tab - add handling for the 'MSP2_GET_TEXT' and 'MSP2_SET_TEXT' commands - with support for the 'MSP2TEXT_PILOT_DISPLAY_NAME' ('displayName') config prop - backup handling of the 'displayName' config prop - add a text field to configure the pilot name in the 'Configuration/Personalization' box - using the 'display_name' FC config prop and the 'MSP2_GET_TEXT' / 'MSP2_SET_TEXT' MSP commands - add tooltips for both the 'Craft name' and 'Pilot name' fileds - rename the 'Display name' OSD element to 'Display name (Pilot name)' - expand the tooltip descriptions of 'Craft name' and 'Display name (Pilot name)' - change the default 'DISPLAY_NAME' OSD element preview to 'PILOT_NAME' - remove the default 'JOE PILOT' string value of the 'displayName' FC initial config - backwards compatibility handling for 'display_name' pre MSP v1.45 - rename 'display name' to 'pilot name' - add 'FC.CONFIG.pilotName' in place of 'FC.CONFIG.displayName' - add the 'PILOT_NAME' OSD element and keep backwards compatibility for the 'DISPLAY_NAME' OSD element (depending on the MSP version) - rename 'FC.CONFIG.name' to 'FC.CONFIG.craftName' - add the 'MSP2TEXT_CRAFT_NAME' const for 'MSP2_GET_TEXT' / 'MSP2_SET_TEXT' - use 'MSP2_GET_TEXT' / 'MSP2_SET_TEXT' to get/set 'FC.CONFIG.craftName' - keep full backwards compatibility pre MSP v1.45 (using the legacy 'MSP_NAME' / 'MSP_SET_NAME')10.9-maintenance
parent
3c776758a3
commit
3873f82c23
|
@ -4993,7 +4993,7 @@
|
|||
"description": "One of the elements of the OSD"
|
||||
},
|
||||
"osdDescElementCraftName": {
|
||||
"message": "Craft name as set in Configuration tab"
|
||||
"message": "Craft name as set in the Configuration tab.</br>Can also be set via the \"craft_name\" CLI variable."
|
||||
},
|
||||
"osdTextElementAltitude": {
|
||||
"message": "Altitude",
|
||||
|
@ -5341,7 +5341,14 @@
|
|||
"description": "One of the elements of the OSD"
|
||||
},
|
||||
"osdDescElementDisplayName": {
|
||||
"message": "Display name as set by the \"display_name\" cli command"
|
||||
"message": "Can also be set via the \"display_name\" CLI variable."
|
||||
},
|
||||
"osdTextElementPilotName": {
|
||||
"message": "Pilot name",
|
||||
"description": "One of the elements of the OSD"
|
||||
},
|
||||
"osdDescElementPilotName": {
|
||||
"message": "Pilot name as set in the Configuration tab.</br>Can also be set via the \"pilot_name\" CLI variable."
|
||||
},
|
||||
"osdTextElementEscRpmFreq": {
|
||||
"message": "ESC RPM frequency",
|
||||
|
@ -6279,6 +6286,15 @@
|
|||
"craftName": {
|
||||
"message": "Craft name"
|
||||
},
|
||||
"configurationCraftNameHelp": {
|
||||
"message": "Can be show in logs, backup file names and the OSD.</br>Can be set via the <b>craft_name</b> CLI variable."
|
||||
},
|
||||
"configurationPilotName": {
|
||||
"message": "Pilot name"
|
||||
},
|
||||
"configurationPilotNameHelp": {
|
||||
"message": "Can be show in the OSD.</br>Can be set via <b>pilot_name</b> CLI variable."
|
||||
},
|
||||
"configurationFpvCamAngleDegrees": {
|
||||
"message": "FPV Camera Angle [degrees]"
|
||||
},
|
||||
|
|
|
@ -144,8 +144,13 @@ function configuration_backup(callback) {
|
|||
configuration.LED_STRIP = jQuery.extend(true, [], FC.LED_STRIP);
|
||||
configuration.LED_COLORS = jQuery.extend(true, [], FC.LED_COLORS);
|
||||
configuration.BOARD_ALIGNMENT_CONFIG = jQuery.extend(true, {}, FC.BOARD_ALIGNMENT_CONFIG);
|
||||
configuration.CRAFT_NAME = FC.CONFIG.name;
|
||||
configuration.DISPLAY_NAME = FC.CONFIG.displayName;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
configuration.CRAFT_NAME = FC.CONFIG.craftName;
|
||||
configuration.PILOT_NAME = FC.CONFIG.pilotName;
|
||||
} else {
|
||||
configuration.CRAFT_NAME = FC.CONFIG.name;
|
||||
configuration.DISPLAY_NAME = FC.CONFIG.displayName;
|
||||
}
|
||||
configuration.MIXER_CONFIG = jQuery.extend(true, {}, FC.MIXER_CONFIG);
|
||||
configuration.SENSOR_CONFIG = jQuery.extend(true, {}, FC.SENSOR_CONFIG);
|
||||
configuration.PID_ADVANCED_CONFIG = jQuery.extend(true, {}, FC.PID_ADVANCED_CONFIG);
|
||||
|
@ -190,7 +195,12 @@ function configuration_backup(callback) {
|
|||
MSP.promise(MSPCodes.MSP_ADVANCED_CONFIG).then(function() {
|
||||
return MSP.promise(MSPCodes.MSP_SENSOR_CONFIG);
|
||||
}).then(function() {
|
||||
return MSP.promise(MSPCodes.MSP_NAME);
|
||||
return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? MSP.promise(MSPCodes.MSP2_GET_TEXT, mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_CRAFT_NAME))
|
||||
: MSP.promise(MSPCodes.MSP_NAME);
|
||||
}).then(function() {
|
||||
return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? MSP.promise(MSPCodes.MSP2_GET_TEXT, mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_PILOT_NAME)) : Promise.resolve(true);
|
||||
}).then(function() {
|
||||
return MSP.promise(MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG);
|
||||
}).then(function() {
|
||||
|
@ -801,7 +811,13 @@ function configuration_restore(callback) {
|
|||
];
|
||||
|
||||
function update_unique_data_list() {
|
||||
uniqueData.push(MSPCodes.MSP_SET_NAME);
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
uniqueData.push([MSPCodes.MSP2_SET_TEXT, MSPCodes.MSP2TEXT_CRAFT_NAME]);
|
||||
uniqueData.push([MSPCodes.MSP2_SET_TEXT, MSPCodes.MSP2TEXT_PILOT_NAME]);
|
||||
} else {
|
||||
uniqueData.push(MSPCodes.MSP_SET_NAME);
|
||||
}
|
||||
|
||||
uniqueData.push(MSPCodes.MSP_SET_SENSOR_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_SET_MIXER_CONFIG);
|
||||
uniqueData.push(MSPCodes.MSP_SET_BEEPER_CONFIG);
|
||||
|
@ -847,8 +863,13 @@ function configuration_restore(callback) {
|
|||
FC.GPS_CONFIG = configuration.GPS_CONFIG;
|
||||
FC.RSSI_CONFIG = configuration.RSSI_CONFIG;
|
||||
FC.BOARD_ALIGNMENT_CONFIG = configuration.BOARD_ALIGNMENT_CONFIG;
|
||||
FC.CONFIG.name = configuration.CRAFT_NAME;
|
||||
FC.CONFIG.displayName = configuration.DISPLAY_NAME;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
FC.CONFIG.craftName = configuration.CRAFT_NAME;
|
||||
FC.CONFIG.pilotName = configuration.PILOT_NAME;
|
||||
} else {
|
||||
FC.CONFIG.name = configuration.CRAFT_NAME;
|
||||
FC.CONFIG.displayName = configuration.DISPLAY_NAME;
|
||||
}
|
||||
FC.MIXER_CONFIG = configuration.MIXER_CONFIG;
|
||||
FC.SENSOR_CONFIG = configuration.SENSOR_CONFIG;
|
||||
FC.PID_ADVANCED_CONFIG = configuration.PID_ADVANCED_CONFIG;
|
||||
|
@ -862,10 +883,16 @@ function configuration_restore(callback) {
|
|||
|
||||
function send_unique_data_item() {
|
||||
if (codeKey < uniqueData.length) {
|
||||
MSP.send_message(uniqueData[codeKey], mspHelper.crunch(uniqueData[codeKey]), false, function () {
|
||||
const callback = () => {
|
||||
codeKey++;
|
||||
send_unique_data_item();
|
||||
});
|
||||
};
|
||||
|
||||
if (Array.isArray(uniqueData[codeKey])) {
|
||||
MSP.send_message(uniqueData[codeKey][0], mspHelper.crunch(...uniqueData[codeKey]), false, callback);
|
||||
} else {
|
||||
MSP.send_message(uniqueData[codeKey], mspHelper.crunch(uniqueData[codeKey]), false, callback);
|
||||
}
|
||||
} else {
|
||||
send_led_strip_config();
|
||||
}
|
||||
|
|
|
@ -17,8 +17,10 @@ const INITIAL_CONFIG = {
|
|||
profile: 0,
|
||||
uid: [0, 0, 0],
|
||||
accelerometerTrims: [0, 0],
|
||||
name: '',
|
||||
displayName: 'JOE PILOT',
|
||||
name: '', // present for backwards compatibility before MSP v1.45
|
||||
craftName: '',
|
||||
displayName: '', // present for backwards compatibility before MSP v1.45
|
||||
pilotName: '',
|
||||
numProfiles: 3,
|
||||
rateProfile: 0,
|
||||
boardType: 0,
|
||||
|
|
|
@ -757,8 +757,11 @@ function generateFilename(prefix, suffix) {
|
|||
if (FC.CONFIG.flightControllerIdentifier) {
|
||||
filename = `${FC.CONFIG.flightControllerIdentifier}_${filename}`;
|
||||
}
|
||||
if(FC.CONFIG.name && FC.CONFIG.name.trim() !== '') {
|
||||
filename = `${filename}_${FC.CONFIG.name.trim().replace(' ', '_')}`;
|
||||
const craftName = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? FC.CONFIG.craftName
|
||||
: FC.CONFIG.name;
|
||||
if (craftName.trim() !== '') {
|
||||
filename = `${filename}_${craftName.trim().replace(' ', '_')}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ const MSPCodes = {
|
|||
MSP_BOARD_INFO: 4,
|
||||
MSP_BUILD_INFO: 5,
|
||||
|
||||
MSP_NAME: 10,
|
||||
MSP_SET_NAME: 11,
|
||||
MSP_NAME: 10, // DEPRECATED IN MSP 1.45
|
||||
MSP_SET_NAME: 11, // DEPRECATED IN MSP 1.45
|
||||
|
||||
MSP_BATTERY_CONFIG: 32,
|
||||
MSP_SET_BATTERY_CONFIG: 33,
|
||||
|
@ -192,4 +192,10 @@ const MSPCodes = {
|
|||
MSP2_SET_MOTOR_OUTPUT_REORDERING: 0x3002,
|
||||
MSP2_SEND_DSHOT_COMMAND: 0x3003,
|
||||
MSP2_GET_VTX_DEVICE_STATUS: 0x3004,
|
||||
MSP2_GET_TEXT: 0x3006,
|
||||
MSP2_SET_TEXT: 0x3007,
|
||||
|
||||
// MSP2_GET_TEXT and MSP2_SET_TEXT variable types
|
||||
MSP2TEXT_PILOT_NAME: 1,
|
||||
MSP2TEXT_CRAFT_NAME: 2,
|
||||
};
|
||||
|
|
|
@ -919,6 +919,25 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_GET_TEXT:
|
||||
// type byte
|
||||
const textType = data.readU8();
|
||||
// length byte followed by the actual characters
|
||||
const textLength = data.readU8() || 0;
|
||||
|
||||
if (textType === MSPCodes.MSP2TEXT_PILOT_NAME) {
|
||||
FC.CONFIG.pilotName = '';
|
||||
for (let i = 0; i < textLength; i++) {
|
||||
FC.CONFIG.pilotName += String.fromCharCode(data.readU8());
|
||||
}
|
||||
} else if (textType === MSPCodes.MSP2TEXT_CRAFT_NAME) {
|
||||
FC.CONFIG.craftName = '';
|
||||
for (let i = 0; i < textLength; i++) {
|
||||
FC.CONFIG.craftName += String.fromCharCode(data.readU8());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_SET_CHANNEL_FORWARDING:
|
||||
console.log('Channel forwarding saved');
|
||||
break;
|
||||
|
@ -1687,6 +1706,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
case MSPCodes.MSP_SET_NAME:
|
||||
console.log('Name set');
|
||||
break;
|
||||
case MSPCodes.MSP2_SET_TEXT:
|
||||
console.log('Text set');
|
||||
break;
|
||||
case MSPCodes.MSP_SET_FILTER_CONFIG:
|
||||
// removed as this fires a lot with firmware sliders console.log('Filter config set');
|
||||
break;
|
||||
|
@ -1793,8 +1815,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
|
||||
/**
|
||||
* Encode the request body for the MSP request with the given code and return it as an array of bytes.
|
||||
* The second (optional) 'modifierCode' argument can be used to extend/specify the behavior of certain MSP codes
|
||||
* (e.g. 'MSPCodes.MSP2_GET_TEXT' and 'MSPCodes.MSP2_SET_TEXT')
|
||||
*/
|
||||
MspHelper.prototype.crunch = function(code) {
|
||||
MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
|
||||
const buffer = [];
|
||||
const self = this;
|
||||
|
||||
|
@ -2319,6 +2343,44 @@ MspHelper.prototype.crunch = function(code) {
|
|||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_GET_TEXT:
|
||||
if (modifierCode === MSPCodes.MSP2TEXT_PILOT_NAME) {
|
||||
// type byte
|
||||
buffer.push8(MSPCodes.MSP2TEXT_PILOT_NAME);
|
||||
} else if (modifierCode === MSPCodes.MSP2TEXT_CRAFT_NAME) {
|
||||
// type byte
|
||||
buffer.push8(MSPCodes.MSP2TEXT_CRAFT_NAME);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_SET_TEXT:
|
||||
if (modifierCode === MSPCodes.MSP2TEXT_PILOT_NAME) {
|
||||
// type byte
|
||||
buffer.push8(MSPCodes.MSP2TEXT_PILOT_NAME);
|
||||
|
||||
const MAX_NAME_LENGTH = 16;
|
||||
const pilotNameLength = Math.min(MAX_NAME_LENGTH, FC.CONFIG.pilotName.length);
|
||||
// length byte followed by the actual characters
|
||||
buffer.push8(pilotNameLength);
|
||||
|
||||
for (let i = 0; i < pilotNameLength; i++) {
|
||||
buffer.push8(FC.CONFIG.pilotName.charCodeAt(i));
|
||||
}
|
||||
} else if (modifierCode === MSPCodes.MSP2TEXT_CRAFT_NAME) {
|
||||
// type byte
|
||||
buffer.push8(MSPCodes.MSP2TEXT_CRAFT_NAME);
|
||||
|
||||
const MAX_NAME_LENGTH = 16;
|
||||
const craftNameLength = Math.min(MAX_NAME_LENGTH, FC.CONFIG.craftName.length);
|
||||
// length byte followed by the actual characters
|
||||
buffer.push8(craftNameLength);
|
||||
|
||||
for (let i = 0; i < craftNameLength; i++) {
|
||||
buffer.push8(FC.CONFIG.craftName.charCodeAt(i));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_SET_BLACKBOX_CONFIG:
|
||||
buffer.push8(FC.BLACKBOX.blackboxDevice)
|
||||
.push8(FC.BLACKBOX.blackboxRateNum)
|
||||
|
@ -2473,7 +2535,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
|
|
@ -445,20 +445,37 @@ function processUid() {
|
|||
GUI.log(i18n.getMessage('uniqueDeviceIdReceived', [uniqueDeviceIdentifier]));
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
processName();
|
||||
processCraftName();
|
||||
} else {
|
||||
setRtc();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function processName() {
|
||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, function () {
|
||||
GUI.log(i18n.getMessage('craftNameReceived', [FC.CONFIG.name]));
|
||||
async function processCraftName() {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
await MSP.promise(
|
||||
MSPCodes.MSP2_GET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_CRAFT_NAME),
|
||||
);
|
||||
} else {
|
||||
await MSP.promise(MSPCodes.MSP_NAME);
|
||||
}
|
||||
|
||||
FC.CONFIG.armingDisabled = false;
|
||||
mspHelper.setArmingEnabled(false, false, setRtc);
|
||||
});
|
||||
GUI.log(i18n.getMessage('craftNameReceived', semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? [FC.CONFIG.craftName]
|
||||
: [FC.CONFIG.name],
|
||||
));
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
await MSP.promise(
|
||||
MSPCodes.MSP2_GET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_PILOT_NAME),
|
||||
);
|
||||
}
|
||||
|
||||
FC.CONFIG.armingDisabled = false;
|
||||
mspHelper.setArmingEnabled(false, false, setRtc);
|
||||
}
|
||||
|
||||
function setRtc() {
|
||||
|
|
|
@ -30,8 +30,15 @@ configuration.initialize = function (callback) {
|
|||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.17.0") ? MSP.promise(MSPCodes.MSP_RC_DEADBAND) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.16.0") ? MSP.promise(MSPCodes.MSP_SENSOR_CONFIG) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.15.0") ? MSP.promise(MSPCodes.MSP_SENSOR_ALIGNMENT) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.20.0") ? MSP.promise(MSPCodes.MSP_NAME) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.20.0") && semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? MSP.promise(MSPCodes.MSP_NAME)
|
||||
: Promise.resolve(true); })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? MSP.promise(MSPCodes.MSP2_GET_TEXT, mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_CRAFT_NAME))
|
||||
: Promise.resolve(true); })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31) ? MSP.promise(MSPCodes.MSP_RX_CONFIG) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? MSP.promise(MSPCodes.MSP2_GET_TEXT, mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_PILOT_NAME)) : Promise.resolve(true); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_ADVANCED_CONFIG); })
|
||||
.then(() => { load_html(); });
|
||||
}
|
||||
|
@ -368,7 +375,13 @@ configuration.initialize = function (callback) {
|
|||
$('.hardwareSelection').hide();
|
||||
}
|
||||
|
||||
$('input[name="craftName"]').val(FC.CONFIG.name);
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
$('input[name="craftName"]').val(FC.CONFIG.craftName);
|
||||
$('input[name="pilotName"]').val(FC.CONFIG.pilotName);
|
||||
} else {
|
||||
$('input[name="craftName"]').val(FC.CONFIG.name);
|
||||
$('.pilotName').hide();
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
|
||||
$('input[name="fpvCamAngleDegrees"]').val(FC.RX_CONFIG.fpvCamAngleDegrees);
|
||||
|
@ -594,7 +607,12 @@ configuration.initialize = function (callback) {
|
|||
FC.SENSOR_CONFIG.acc_hardware = $('input[id="accHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||
FC.SENSOR_CONFIG.baro_hardware = $('input[id="baroHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||
FC.SENSOR_CONFIG.mag_hardware = $('input[id="magHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||
FC.CONFIG.name = $.trim($('input[name="craftName"]').val());
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
FC.CONFIG.craftName = $('input[name="craftName"]').val().trim();
|
||||
FC.CONFIG.pilotName = $('input[name="pilotName"]').val().trim();
|
||||
} else {
|
||||
FC.CONFIG.name = $('input[name="craftName"]').val().trim();
|
||||
}
|
||||
|
||||
function save_serial_config() {
|
||||
mspHelper.sendSerialConfig(save_config);
|
||||
|
@ -617,7 +635,11 @@ configuration.initialize = function (callback) {
|
|||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_ACC_TRIM, mspHelper.crunch(MSPCodes.MSP_SET_ACC_TRIM)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_ARMING_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ARMING_CONFIG)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_SENSOR_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_CONFIG)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_NAME, mspHelper.crunch(MSPCodes.MSP_SET_NAME)); })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? MSP.promise(MSPCodes.MSP2_SET_TEXT, mspHelper.crunch(MSPCodes.MSP2_SET_TEXT, MSPCodes.MSP2TEXT_CRAFT_NAME))
|
||||
: MSP.promise(MSPCodes.MSP_SET_NAME, mspHelper.crunch(MSPCodes.MSP_SET_NAME)); })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ?
|
||||
MSP.promise(MSPCodes.MSP2_SET_TEXT, mspHelper.crunch(MSPCodes.MSP2_SET_TEXT, MSPCodes.MSP2TEXT_PILOT_NAME)) : Promise.resolve(true); })
|
||||
.then(() => { return (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) ? MSP.promise(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG)) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_EEPROM_WRITE); })
|
||||
.then(() => { reboot(); });
|
||||
|
|
|
@ -26,7 +26,16 @@ onboard_logging.initialize = function (callback) {
|
|||
MSP.send_message(MSPCodes.MSP_SDCARD_SUMMARY, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_BLACKBOX_CONFIG, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, function() {
|
||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, load_html);
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
MSP.send_message(
|
||||
MSPCodes.MSP2_GET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.MSP2TEXT_CRAFT_NAME),
|
||||
false,
|
||||
load_html,
|
||||
);
|
||||
} else {
|
||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, load_html);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -423,16 +423,30 @@ OSD.generateLQPreview = function() {
|
|||
|
||||
OSD.generateCraftName = function() {
|
||||
let preview = 'CRAFT_NAME';
|
||||
if (FC.CONFIG.name !== '') {
|
||||
preview = FC.CONFIG.name.toUpperCase();
|
||||
|
||||
const craftName = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? FC.CONFIG.craftName
|
||||
: FC.CONFIG.name;
|
||||
if (craftName !== '') {
|
||||
preview = craftName.toUpperCase();
|
||||
}
|
||||
return preview;
|
||||
};
|
||||
|
||||
// for backwards compatibility before API_VERSION_1_45
|
||||
OSD.generateDisplayName = function() {
|
||||
let preview = 'DISPLAY_NAME';
|
||||
if (FC.CONFIG.displayName !== '') {
|
||||
preview = FC.CONFIG.displayName.toUpperCase();
|
||||
if (FC.CONFIG.displayName) {
|
||||
preview = FC.CONFIG.displayName?.toUpperCase();
|
||||
}
|
||||
return preview;
|
||||
};
|
||||
|
||||
// added in API_VERSION_1_45
|
||||
OSD.generatePilotName = function() {
|
||||
let preview = 'PILOT_NAME';
|
||||
if (FC.CONFIG.pilotName) {
|
||||
preview = FC.CONFIG.pilotName?.toUpperCase();
|
||||
}
|
||||
return preview;
|
||||
};
|
||||
|
@ -1203,17 +1217,38 @@ OSD.loadDisplayFields = function() {
|
|||
positionable: true,
|
||||
preview: OSD.drawStickOverlayPreview,
|
||||
},
|
||||
DISPLAY_NAME: {
|
||||
name: 'DISPLAY_NAME',
|
||||
text: 'osdTextElementDisplayName',
|
||||
desc: 'osdDescElementDisplayName',
|
||||
defaultPosition: -77,
|
||||
draw_order: 350,
|
||||
positionable: true,
|
||||
preview(osdData) {
|
||||
return OSD.generateDisplayName(osdData, 1);
|
||||
},
|
||||
},
|
||||
...(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? {
|
||||
DISPLAY_NAME: {
|
||||
name: 'DISPLAY_NAME',
|
||||
text: 'osdTextElementDisplayName',
|
||||
desc: 'osdDescElementDisplayName',
|
||||
defaultPosition: -77,
|
||||
draw_order: 350,
|
||||
positionable: true,
|
||||
preview(osdData) {
|
||||
return OSD.generateDisplayName(osdData, 1);
|
||||
},
|
||||
},
|
||||
}
|
||||
: {}
|
||||
),
|
||||
...(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||
? {
|
||||
PILOT_NAME: {
|
||||
name: 'PILOT_NAME',
|
||||
text: 'osdTextElementPilotName',
|
||||
desc: 'osdDescElementPilotName',
|
||||
defaultPosition: -77,
|
||||
draw_order: 350,
|
||||
positionable: true,
|
||||
preview(osdData) {
|
||||
return OSD.generatePilotName(osdData, 1);
|
||||
},
|
||||
},
|
||||
}
|
||||
: {}
|
||||
),
|
||||
ESC_RPM_FREQ: {
|
||||
name: 'ESC_RPM_FREQ',
|
||||
text: 'osdTextElementEscRpmFreq',
|
||||
|
@ -1742,7 +1777,8 @@ OSD.chooseFields = function() {
|
|||
F.FLIGHT_DIST,
|
||||
F.STICK_OVERLAY_LEFT,
|
||||
F.STICK_OVERLAY_RIGHT,
|
||||
F.DISPLAY_NAME,
|
||||
// show either DISPLAY_NAME or PILOT_NAME depending on the MSP version
|
||||
(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? F.PILOT_NAME : F.DISPLAY_NAME),
|
||||
F.ESC_RPM_FREQ,
|
||||
]);
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
|
|
|
@ -78,6 +78,13 @@
|
|||
<label> <input type="text" name="craftName" maxlength="32" style="width:100px;"/> <span
|
||||
i18n="craftName"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationCraftNameHelp"></div>
|
||||
</div>
|
||||
<div class="number pilotName">
|
||||
<label> <input type="text" name="pilotName" maxlength="32" style="width:100px;"/> <span
|
||||
i18n="configurationPilotName"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationPilotNameHelp"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- END PERSONALIZATION-->
|
||||
|
@ -384,7 +391,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="beepers">
|
||||
<!-- BEEPER -->
|
||||
<div class="beepers">
|
||||
|
|
Loading…
Reference in New Issue