1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 06:15:13 +03:00

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')
This commit is contained in:
Krasiyan Nedelchev 2022-02-07 00:49:21 +01:00
parent 3c776758a3
commit 3873f82c23
11 changed files with 254 additions and 47 deletions

View file

@ -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() {