1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

Correctly initialize variable length PID banks

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-12-27 13:53:39 +01:00
parent b92c852ff9
commit 2d284a6c5c
2 changed files with 14 additions and 5 deletions

View file

@ -130,11 +130,7 @@ var FC = {
}; };
PID_names = []; PID_names = [];
PIDs = new Array(11); PIDs = [];
for (let i = 0; i < PIDs.length; i++) {
PIDs[i] = new Array(4);
}
RC_MAP = []; RC_MAP = [];
// defaults // defaults

View file

@ -331,6 +331,19 @@ function onConnect() {
*/ */
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false); MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false);
/*
* Init PIDs bank with a length that depends on the version
*/
let pidCount;
if (semver.gte(CONFIG.flightControllerVersion, "2.4.0")) {
pidCount = 11;
} else {
pidCount = 10;
}
for (let i = 0; i < pidCount; i++) {
PIDs.push(new Array(4));
}
helper.interval.add('msp-load-update', function () { helper.interval.add('msp-load-update', function () {
$('#msp-version').text("MSP version: " + MSP.protocolVersion.toFixed(0)); $('#msp-version').text("MSP version: " + MSP.protocolVersion.toFixed(0));
$('#msp-load').text("MSP load: " + helper.mspQueue.getLoad().toFixed(1)); $('#msp-load').text("MSP load: " + helper.mspQueue.getLoad().toFixed(1));