1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 03:19:54 +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

@ -331,6 +331,19 @@ function onConnect() {
*/
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 () {
$('#msp-version').text("MSP version: " + MSP.protocolVersion.toFixed(0));
$('#msp-load').text("MSP load: " + helper.mspQueue.getLoad().toFixed(1));