1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-14 20:10:11 +03:00

MSP_FW_CONFIG frame support

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-05-26 14:22:49 +02:00
parent a86c3138d5
commit 0777ef391c
8 changed files with 234 additions and 5 deletions

View file

@ -958,6 +958,21 @@ var mspHelper = (function (gui) {
console.log('RTH_AND_LAND_CONFIG saved');
break;
case MSPCodes.MSP_FW_CONFIG:
FW_CONFIG.cruiseThrottle = data.getUint16(0, true);
FW_CONFIG.minThrottle = data.getUint16(2, true);
FW_CONFIG.maxThrottle = data.getUint16(4, true);
FW_CONFIG.maxBankAngle = data.getUint8(6);
FW_CONFIG.maxClimbAngle = data.getUint8(7);
FW_CONFIG.maxDiveAngle = data.getUint8(8);
FW_CONFIG.pitchToThrottle = data.getUint8(9);
FW_CONFIG.loiterRadius = data.getUint16(10, true);
break;
case MSPCodes.MSP_SET_FW_CONFIG:
console.log('FW_CONFIG saved');
break;
case MSPCodes.MSP_SET_MODE_RANGE:
console.log('Mode range saved');
break;
@ -1339,6 +1354,27 @@ var mspHelper = (function (gui) {
buffer.push(highByte(RTH_AND_LAND_CONFIG.emergencyDescentRate));
break;
case MSPCodes.MSP_SET_FW_CONFIG:
buffer.push(lowByte(FW_CONFIG.cruiseThrottle));
buffer.push(highByte(FW_CONFIG.cruiseThrottle));
buffer.push(lowByte(FW_CONFIG.minThrottle));
buffer.push(highByte(FW_CONFIG.minThrottle));
buffer.push(lowByte(FW_CONFIG.maxThrottle));
buffer.push(highByte(FW_CONFIG.maxThrottle));
buffer.push(FW_CONFIG.maxBankAngle);
buffer.push(FW_CONFIG.maxClimbAngle);
buffer.push(FW_CONFIG.maxDiveAngle);
buffer.push(FW_CONFIG.pitchToThrottle);
buffer.push(lowByte(FW_CONFIG.loiterRadius));
buffer.push(highByte(FW_CONFIG.loiterRadius));
break;
case MSPCodes.MSP_SET_FILTER_CONFIG:
buffer.push(FILTER_CONFIG.gyroSoftLpfHz);
@ -2105,5 +2141,21 @@ var mspHelper = (function (gui) {
}
};
self.loadFwConfig = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "1.7.1")) {
MSP.send_message(MSPCodes.MSP_FW_CONFIG, false, false, callback);
} else {
callback();
}
};
self.saveFwConfig = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "1.7.1")) {
MSP.send_message(MSPCodes.MSP_SET_FW_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FW_CONFIG), false, callback);
} else {
callback();
}
};
return self;
})(GUI);