mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 05:15:21 +03:00
Merge pull request #2798 from krasiyan/1877-display-name-configuration
Add 'Pilot name' to the Configurator UI; rename 'Display name' to 'Pilot name'; rename 'name' to 'craft_name'
This commit is contained in:
commit
4f9348742d
11 changed files with 254 additions and 47 deletions
|
@ -4998,7 +4998,7 @@
|
||||||
"description": "One of the elements of the OSD"
|
"description": "One of the elements of the OSD"
|
||||||
},
|
},
|
||||||
"osdDescElementCraftName": {
|
"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": {
|
"osdTextElementAltitude": {
|
||||||
"message": "Altitude",
|
"message": "Altitude",
|
||||||
|
@ -5346,7 +5346,14 @@
|
||||||
"description": "One of the elements of the OSD"
|
"description": "One of the elements of the OSD"
|
||||||
},
|
},
|
||||||
"osdDescElementDisplayName": {
|
"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": {
|
"osdTextElementEscRpmFreq": {
|
||||||
"message": "ESC RPM frequency",
|
"message": "ESC RPM frequency",
|
||||||
|
@ -6284,6 +6291,15 @@
|
||||||
"craftName": {
|
"craftName": {
|
||||||
"message": "Craft name"
|
"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": {
|
"configurationFpvCamAngleDegrees": {
|
||||||
"message": "FPV Camera Angle [degrees]"
|
"message": "FPV Camera Angle [degrees]"
|
||||||
},
|
},
|
||||||
|
|
|
@ -144,8 +144,13 @@ function configuration_backup(callback) {
|
||||||
configuration.LED_STRIP = jQuery.extend(true, [], FC.LED_STRIP);
|
configuration.LED_STRIP = jQuery.extend(true, [], FC.LED_STRIP);
|
||||||
configuration.LED_COLORS = jQuery.extend(true, [], FC.LED_COLORS);
|
configuration.LED_COLORS = jQuery.extend(true, [], FC.LED_COLORS);
|
||||||
configuration.BOARD_ALIGNMENT_CONFIG = jQuery.extend(true, {}, FC.BOARD_ALIGNMENT_CONFIG);
|
configuration.BOARD_ALIGNMENT_CONFIG = jQuery.extend(true, {}, FC.BOARD_ALIGNMENT_CONFIG);
|
||||||
configuration.CRAFT_NAME = FC.CONFIG.name;
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||||
configuration.DISPLAY_NAME = FC.CONFIG.displayName;
|
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.MIXER_CONFIG = jQuery.extend(true, {}, FC.MIXER_CONFIG);
|
||||||
configuration.SENSOR_CONFIG = jQuery.extend(true, {}, FC.SENSOR_CONFIG);
|
configuration.SENSOR_CONFIG = jQuery.extend(true, {}, FC.SENSOR_CONFIG);
|
||||||
configuration.PID_ADVANCED_CONFIG = jQuery.extend(true, {}, FC.PID_ADVANCED_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() {
|
MSP.promise(MSPCodes.MSP_ADVANCED_CONFIG).then(function() {
|
||||||
return MSP.promise(MSPCodes.MSP_SENSOR_CONFIG);
|
return MSP.promise(MSPCodes.MSP_SENSOR_CONFIG);
|
||||||
}).then(function() {
|
}).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() {
|
}).then(function() {
|
||||||
return MSP.promise(MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG);
|
return MSP.promise(MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG);
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
|
@ -801,7 +811,13 @@ function configuration_restore(callback) {
|
||||||
];
|
];
|
||||||
|
|
||||||
function update_unique_data_list() {
|
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_SENSOR_CONFIG);
|
||||||
uniqueData.push(MSPCodes.MSP_SET_MIXER_CONFIG);
|
uniqueData.push(MSPCodes.MSP_SET_MIXER_CONFIG);
|
||||||
uniqueData.push(MSPCodes.MSP_SET_BEEPER_CONFIG);
|
uniqueData.push(MSPCodes.MSP_SET_BEEPER_CONFIG);
|
||||||
|
@ -847,8 +863,13 @@ function configuration_restore(callback) {
|
||||||
FC.GPS_CONFIG = configuration.GPS_CONFIG;
|
FC.GPS_CONFIG = configuration.GPS_CONFIG;
|
||||||
FC.RSSI_CONFIG = configuration.RSSI_CONFIG;
|
FC.RSSI_CONFIG = configuration.RSSI_CONFIG;
|
||||||
FC.BOARD_ALIGNMENT_CONFIG = configuration.BOARD_ALIGNMENT_CONFIG;
|
FC.BOARD_ALIGNMENT_CONFIG = configuration.BOARD_ALIGNMENT_CONFIG;
|
||||||
FC.CONFIG.name = configuration.CRAFT_NAME;
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||||
FC.CONFIG.displayName = configuration.DISPLAY_NAME;
|
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.MIXER_CONFIG = configuration.MIXER_CONFIG;
|
||||||
FC.SENSOR_CONFIG = configuration.SENSOR_CONFIG;
|
FC.SENSOR_CONFIG = configuration.SENSOR_CONFIG;
|
||||||
FC.PID_ADVANCED_CONFIG = configuration.PID_ADVANCED_CONFIG;
|
FC.PID_ADVANCED_CONFIG = configuration.PID_ADVANCED_CONFIG;
|
||||||
|
@ -862,10 +883,16 @@ function configuration_restore(callback) {
|
||||||
|
|
||||||
function send_unique_data_item() {
|
function send_unique_data_item() {
|
||||||
if (codeKey < uniqueData.length) {
|
if (codeKey < uniqueData.length) {
|
||||||
MSP.send_message(uniqueData[codeKey], mspHelper.crunch(uniqueData[codeKey]), false, function () {
|
const callback = () => {
|
||||||
codeKey++;
|
codeKey++;
|
||||||
send_unique_data_item();
|
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 {
|
} else {
|
||||||
send_led_strip_config();
|
send_led_strip_config();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,10 @@ const INITIAL_CONFIG = {
|
||||||
profile: 0,
|
profile: 0,
|
||||||
uid: [0, 0, 0],
|
uid: [0, 0, 0],
|
||||||
accelerometerTrims: [0, 0],
|
accelerometerTrims: [0, 0],
|
||||||
name: '',
|
name: '', // present for backwards compatibility before MSP v1.45
|
||||||
displayName: 'JOE PILOT',
|
craftName: '',
|
||||||
|
displayName: '', // present for backwards compatibility before MSP v1.45
|
||||||
|
pilotName: '',
|
||||||
numProfiles: 3,
|
numProfiles: 3,
|
||||||
rateProfile: 0,
|
rateProfile: 0,
|
||||||
boardType: 0,
|
boardType: 0,
|
||||||
|
|
|
@ -763,8 +763,11 @@ function generateFilename(prefix, suffix) {
|
||||||
if (FC.CONFIG.flightControllerIdentifier) {
|
if (FC.CONFIG.flightControllerIdentifier) {
|
||||||
filename = `${FC.CONFIG.flightControllerIdentifier}_${filename}`;
|
filename = `${FC.CONFIG.flightControllerIdentifier}_${filename}`;
|
||||||
}
|
}
|
||||||
if(FC.CONFIG.name && FC.CONFIG.name.trim() !== '') {
|
const craftName = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||||
filename = `${filename}_${FC.CONFIG.name.trim().replace(' ', '_')}`;
|
? 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_BOARD_INFO: 4,
|
||||||
MSP_BUILD_INFO: 5,
|
MSP_BUILD_INFO: 5,
|
||||||
|
|
||||||
MSP_NAME: 10,
|
MSP_NAME: 10, // DEPRECATED IN MSP 1.45
|
||||||
MSP_SET_NAME: 11,
|
MSP_SET_NAME: 11, // DEPRECATED IN MSP 1.45
|
||||||
|
|
||||||
MSP_BATTERY_CONFIG: 32,
|
MSP_BATTERY_CONFIG: 32,
|
||||||
MSP_SET_BATTERY_CONFIG: 33,
|
MSP_SET_BATTERY_CONFIG: 33,
|
||||||
|
@ -192,4 +192,10 @@ const MSPCodes = {
|
||||||
MSP2_SET_MOTOR_OUTPUT_REORDERING: 0x3002,
|
MSP2_SET_MOTOR_OUTPUT_REORDERING: 0x3002,
|
||||||
MSP2_SEND_DSHOT_COMMAND: 0x3003,
|
MSP2_SEND_DSHOT_COMMAND: 0x3003,
|
||||||
MSP2_GET_VTX_DEVICE_STATUS: 0x3004,
|
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,
|
||||||
};
|
};
|
||||||
|
|
|
@ -920,6 +920,25 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case MSPCodes.MSP_SET_CHANNEL_FORWARDING:
|
||||||
console.log('Channel forwarding saved');
|
console.log('Channel forwarding saved');
|
||||||
break;
|
break;
|
||||||
|
@ -1688,6 +1707,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
case MSPCodes.MSP_SET_NAME:
|
case MSPCodes.MSP_SET_NAME:
|
||||||
console.log('Name set');
|
console.log('Name set');
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP2_SET_TEXT:
|
||||||
|
console.log('Text set');
|
||||||
|
break;
|
||||||
case MSPCodes.MSP_SET_FILTER_CONFIG:
|
case MSPCodes.MSP_SET_FILTER_CONFIG:
|
||||||
// removed as this fires a lot with firmware sliders console.log('Filter config set');
|
// removed as this fires a lot with firmware sliders console.log('Filter config set');
|
||||||
break;
|
break;
|
||||||
|
@ -1794,8 +1816,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.
|
* 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 buffer = [];
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
|
@ -2320,6 +2344,44 @@ MspHelper.prototype.crunch = function(code) {
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case MSPCodes.MSP_SET_BLACKBOX_CONFIG:
|
||||||
buffer.push8(FC.BLACKBOX.blackboxDevice)
|
buffer.push8(FC.BLACKBOX.blackboxDevice)
|
||||||
.push8(FC.BLACKBOX.blackboxRateNum)
|
.push8(FC.BLACKBOX.blackboxRateNum)
|
||||||
|
@ -2474,7 +2536,7 @@ MspHelper.prototype.crunch = function(code) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
@ -445,20 +445,37 @@ function processUid() {
|
||||||
GUI.log(i18n.getMessage('uniqueDeviceIdReceived', [uniqueDeviceIdentifier]));
|
GUI.log(i18n.getMessage('uniqueDeviceIdReceived', [uniqueDeviceIdentifier]));
|
||||||
|
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||||
processName();
|
processCraftName();
|
||||||
} else {
|
} else {
|
||||||
setRtc();
|
setRtc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function processName() {
|
async function processCraftName() {
|
||||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, function () {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||||
GUI.log(i18n.getMessage('craftNameReceived', [FC.CONFIG.name]));
|
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;
|
GUI.log(i18n.getMessage('craftNameReceived', semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||||
mspHelper.setArmingEnabled(false, false, setRtc);
|
? [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() {
|
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.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.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.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_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(() => { return MSP.promise(MSPCodes.MSP_ADVANCED_CONFIG); })
|
||||||
.then(() => { load_html(); });
|
.then(() => { load_html(); });
|
||||||
}
|
}
|
||||||
|
@ -368,7 +375,13 @@ configuration.initialize = function (callback) {
|
||||||
$('.hardwareSelection').hide();
|
$('.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)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
|
||||||
$('input[name="fpvCamAngleDegrees"]').val(FC.RX_CONFIG.fpvCamAngleDegrees);
|
$('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.acc_hardware = $('input[id="accHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||||
FC.SENSOR_CONFIG.baro_hardware = $('input[id="baroHardwareSwitch"]').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.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() {
|
function save_serial_config() {
|
||||||
mspHelper.sendSerialConfig(save_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_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_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_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 (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(() => { return MSP.promise(MSPCodes.MSP_EEPROM_WRITE); })
|
||||||
.then(() => { reboot(); });
|
.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_SDCARD_SUMMARY, false, false, function() {
|
||||||
MSP.send_message(MSPCodes.MSP_BLACKBOX_CONFIG, 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_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() {
|
OSD.generateCraftName = function() {
|
||||||
let preview = 'CRAFT_NAME';
|
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;
|
return preview;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// for backwards compatibility before API_VERSION_1_45
|
||||||
OSD.generateDisplayName = function() {
|
OSD.generateDisplayName = function() {
|
||||||
let preview = 'DISPLAY_NAME';
|
let preview = 'DISPLAY_NAME';
|
||||||
if (FC.CONFIG.displayName !== '') {
|
if (FC.CONFIG.displayName) {
|
||||||
preview = FC.CONFIG.displayName.toUpperCase();
|
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;
|
return preview;
|
||||||
};
|
};
|
||||||
|
@ -1203,17 +1217,38 @@ OSD.loadDisplayFields = function() {
|
||||||
positionable: true,
|
positionable: true,
|
||||||
preview: OSD.drawStickOverlayPreview,
|
preview: OSD.drawStickOverlayPreview,
|
||||||
},
|
},
|
||||||
DISPLAY_NAME: {
|
...(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_45)
|
||||||
name: 'DISPLAY_NAME',
|
? {
|
||||||
text: 'osdTextElementDisplayName',
|
DISPLAY_NAME: {
|
||||||
desc: 'osdDescElementDisplayName',
|
name: 'DISPLAY_NAME',
|
||||||
defaultPosition: -77,
|
text: 'osdTextElementDisplayName',
|
||||||
draw_order: 350,
|
desc: 'osdDescElementDisplayName',
|
||||||
positionable: true,
|
defaultPosition: -77,
|
||||||
preview(osdData) {
|
draw_order: 350,
|
||||||
return OSD.generateDisplayName(osdData, 1);
|
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: {
|
ESC_RPM_FREQ: {
|
||||||
name: 'ESC_RPM_FREQ',
|
name: 'ESC_RPM_FREQ',
|
||||||
text: 'osdTextElementEscRpmFreq',
|
text: 'osdTextElementEscRpmFreq',
|
||||||
|
@ -1742,7 +1777,8 @@ 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,
|
// 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,
|
F.ESC_RPM_FREQ,
|
||||||
]);
|
]);
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
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
|
<label> <input type="text" name="craftName" maxlength="32" style="width:100px;"/> <span
|
||||||
i18n="craftName"></span>
|
i18n="craftName"></span>
|
||||||
</label>
|
</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>
|
</div>
|
||||||
</div> <!-- END PERSONALIZATION-->
|
</div> <!-- END PERSONALIZATION-->
|
||||||
|
@ -384,7 +391,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="beepers">
|
<div class="beepers">
|
||||||
<!-- BEEPER -->
|
<!-- BEEPER -->
|
||||||
<div class="beepers">
|
<div class="beepers">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue