Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide MAG and LEVEL PIDF values #3664

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,12 @@ MspHelper.prototype.process_data = function(dataHandler) {
for (let i = 0, needle = 0; i < (data.byteLength / 3); i++, needle += 3) {
// main for loop selecting the pid section
for (let j = 0; j < 3; j++) {
FC.PIDS_ACTIVE[i][j] = data.readU8();
FC.PIDS[i][j] = FC.PIDS_ACTIVE[i][j];
FC.PIDS[i][j] = data.readU8();
}
}
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
FC.PIDS_ACTIVE = FC.PIDS.map(array => array.slice());
}
break;

case MSPCodes.MSP_ARMING_CONFIG:
Expand Down Expand Up @@ -621,7 +623,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
break;
case MSPCodes.MSP_SET_PID:
console.log('PID settings saved');
FC.PIDS_ACTIVE = FC.PIDS.map(array => array.slice());
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
FC.PIDS_ACTIVE = FC.PIDS.map(array => array.slice());
}
break;
case MSPCodes.MSP_SET_RC_TUNING:
console.log('RC Tuning saved');
Expand Down
22 changes: 14 additions & 8 deletions src/js/tabs/pid_tuning.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ pid_tuning.initialize = function (callback) {
// Assign each value
searchRow.each((indexInput, element) => {
if (FC.PIDS[indexPid][indexInput] !== undefined) {
$(element).val(FC.PIDS_ACTIVE[indexPid][indexInput]);
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
$(element).val(FC.PIDS[indexPid][indexInput]);
} else {
$(element).val(FC.PIDS_ACTIVE[indexPid][indexInput]);
}
}
});
});
Expand Down Expand Up @@ -1302,12 +1306,12 @@ pid_tuning.initialize = function (callback) {

let isVisibleBaroMagGps = false;

isVisibleBaroMagGps |= hideSensorPid($('#pid_baro'), have_sensor(FC.CONFIG.activeSensors, 'baro') || have_sensor(FC.CONFIG.activeSensors, 'sonar'));
/* TODO: revise support for baro, mag and gps

isVisibleBaroMagGps |= hideSensorPid($('#pid_baro'), have_sensor(FC.CONFIG.activeSensors, 'baro') || have_sensor(FC.CONFIG.activeSensors, 'sonar'));
isVisibleBaroMagGps |= hideSensorPid($('#pid_mag'), have_sensor(FC.CONFIG.activeSensors, 'mag'));

isVisibleBaroMagGps |= hideSensorPid($('#pid_gps'), have_sensor(FC.CONFIG.activeSensors, 'GPS'));

*/
if (!isVisibleBaroMagGps) {
$('#pid_baro_mag_gps').hide();
}
Expand Down Expand Up @@ -2732,11 +2736,13 @@ pid_tuning.updatePIDColors = function(clear = false) {
element.css({ "background-color": getColorForPercentage(change, colorTables.pidSlider) });
};

FC.PID_NAMES.forEach(function(elementPid, indexPid) {
$(`.pid_tuning .${elementPid} input`).each(function(indexInput) {
setTuningElementColor($(this), FC.PIDS_ACTIVE[indexPid][indexInput], FC.PIDS[indexPid][indexInput]);
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
FC.PID_NAMES.forEach(function(elementPid, indexPid) {
$(`.pid_tuning .${elementPid} input`).each(function(indexInput) {
setTuningElementColor($(this), FC.PIDS_ACTIVE[indexPid][indexInput], FC.PIDS[indexPid][indexInput]);
});
});
});
}

setTuningElementColor($('.pid_tuning input[name="dMinRoll"]'), FC.ADVANCED_TUNING_ACTIVE.dMinRoll, FC.ADVANCED_TUNING.dMinRoll);
setTuningElementColor($('.pid_tuning input[name="dMinPitch"]'), FC.ADVANCED_TUNING_ACTIVE.dMinPitch, FC.ADVANCED_TUNING.dMinPitch);
Expand Down