Skip to content

Commit 096920a

Browse files
authored
Add support for conditional number of rate profiles (msp) (#4331)
* Revert reducing number of rate profiles * Add support for numberOfRateProfiles from STATUS_EX (msp)
1 parent 5c4d3da commit 096920a

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/js/fc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const INITIAL_CONFIG = {
3131
rateProfileNames: ["", "", "", ""],
3232
numProfiles: 3,
3333
rateProfile: 0,
34+
numberOfRateProfiles: 0,
3435
boardType: 0,
3536
armingDisableCount: 0,
3637
armingDisableFlags: 0,

src/js/msp/MSPHelper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ MspHelper.prototype.process_data = function (dataHandler) {
237237
FC.CONFIG.cpuTemp = data.readU16();
238238
}
239239

240+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
241+
FC.CONFIG.numberOfRateProfiles = data.readU8();
242+
}
240243
break;
241244

242245
case MSPCodes.MSP_RAW_IMU:

src/js/tabs/pid_tuning.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,10 @@ pid_tuning.initialize = function (callback) {
11861186
numberOfRateProfiles = 4;
11871187
}
11881188

1189+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
1190+
numberOfRateProfiles = FC.CONFIG.numberOfRateProfiles;
1191+
}
1192+
11891193
const rateProfileElements = [];
11901194
for (let i = 0; i < numberOfRateProfiles; i++) {
11911195
rateProfileElements.push(i18n.getMessage("pidTuningRateProfileOption", [i + 1]));

0 commit comments

Comments
 (0)