diff --git a/locales/en/messages.json b/locales/en/messages.json index 904af7eac1..8a52b6f62d 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1608,6 +1608,18 @@ "pidTuningSubTabFilter": { "message": "Filter Settings" }, + "pidProfileName": { + "message": "PID profile name" + }, + "pidProfileNameHelp": { + "message": "PID profile name which can describe what conditions this profile was tuned to: lighter/heavier battery, action camera/no action camera, higher elevation, etc." + }, + "rateProfileName": { + "message": "Rate profile name" + }, + "rateProfileNameHelp": { + "message": "Rate profile name which can describe what type of flying this profile is for: cine, race, freestyle, etc." + }, "pidTuningShowAllPids": { "message": "Show all PIDs" }, diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index 67032c3709..19badb7604 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -2033,10 +2033,10 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) { self.setText(buffer, modifierCode, FC.CONFIG.pidProfileNames[FC.CONFIG.profile], 8); break; case MSPCodes.RATE_PROFILE_NAME: - self.setText(buffer, modifierCode, FC.CONFIG.pidProfileNames[FC.CONFIG.rateProfile], 8); + self.setText(buffer, modifierCode, FC.CONFIG.rateProfileNames[FC.CONFIG.rateProfile], 8); break; default: - console.log('Unsupport text type'); + console.log('Unsupported text type'); break; } break; diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 2c6d86a200..30b29c92ba 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -48,6 +48,10 @@ pid_tuning.initialize = function (callback) { .then(() => MSP.promise(MSPCodes.MSP_FILTER_CONFIG)) .then(() => MSP.promise(MSPCodes.MSP_RC_DEADBAND)) .then(() => MSP.promise(MSPCodes.MSP_MOTOR_CONFIG)) + .then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_GET_TEXT, + mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.PID_PROFILE_NAME)) : true) + .then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_GET_TEXT, + mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.RATE_PROFILE_NAME)) : true) .then(() => { let promise; if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { @@ -68,6 +72,14 @@ pid_tuning.initialize = function (callback) { self.setProfile(); self.setRateProfile(); + // Profile names + if (semver.gte(FC.CONFIG.apiVersion, "1.45.0")) { + $('input[name="pidProfileName"]').val(FC.CONFIG.pidProfileNames[FC.CONFIG.profile]); + $('input[name="rateProfileName"]').val(FC.CONFIG.rateProfileNames[FC.CONFIG.rateProfile]); + } else { + $('.profile_name').hide(); + } + // Fill in the data from PIDs array for each pid name FC.PID_NAMES.forEach(function(elementPid, indexPid) { @@ -1000,6 +1012,12 @@ pid_tuning.initialize = function (callback) { // Fill in the data from PIDs array // Catch all the changes and stuff the inside PIDs array + // Profile names + if (semver.gte(FC.CONFIG.apiVersion, "1.45.0")) { + FC.CONFIG.pidProfileNames[FC.CONFIG.profile] = $('input[name="pidProfileName"]').val().trim(); + FC.CONFIG.rateProfileNames[FC.CONFIG.rateProfile] = $('input[name="rateProfileName"]').val().trim(); + } + // For each pid name FC.PID_NAMES.forEach(function(elementPid, indexPid) { @@ -2188,6 +2206,10 @@ pid_tuning.initialize = function (callback) { MSP.promise(MSPCodes.MSP_SET_PID, mspHelper.crunch(MSPCodes.MSP_SET_PID)) .then(() => MSP.promise(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED))) + .then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_SET_TEXT, + mspHelper.crunch(MSPCodes.MSP2_SET_TEXT, MSPCodes.PID_PROFILE_NAME)) : true) + .then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_SET_TEXT, + mspHelper.crunch(MSPCodes.MSP2_SET_TEXT, MSPCodes.RATE_PROFILE_NAME)) : true) .then(() => { self.updatePIDColors(); return MSP.promise(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG)); diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index 6256b7d95d..9ccc411832 100644 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -63,6 +63,14 @@
+
+
+ +
+
+

@@ -919,7 +927,14 @@