diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 7b60c7f6..1da6fbb9 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2086,5 +2086,32 @@ }, "emergencyDescentRate": { "message": "Emergency landing speed [cm/s]" + }, + "cruiseThrottle": { + "message": "Cruise throttle" + }, + "minThrottle": { + "message": "Min. throttle" + }, + "maxThrottle": { + "message": "Max. throttle" + }, + "maxBankAngle": { + "message": "Max. bank angle" + }, + "maxClimbAngle": { + "message": "Max. climb angle" + }, + "maxDiveAngle": { + "message": "Max. dive angle" + }, + "pitchToThrottle": { + "message": "Pitch to throttle ratio" + }, + "loiterRadius": { + "message": "Loiter radius [cm]" + }, + "fixedWingConfiguration": { + "message": "Fixed Wing Settings" } } diff --git a/build/script.js b/build/script.js index 0519e456..ff1f1d65 100644 --- a/build/script.js +++ b/build/script.js @@ -7426,6 +7426,8 @@ var MSPCodes = { MSP_RTH_AND_LAND_CONFIG: 21, MSP_SET_RTH_AND_LAND_CONFIG: 22, + MSP_FW_CONFIG: 23, + MSP_SET_FW_CONFIG: 24, // MSP commands for Cleanflight original features MSP_CHANNEL_FORWARDING: 32, @@ -8509,6 +8511,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; @@ -8890,6 +8907,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); @@ -9656,6 +9694,22 @@ 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); @@ -10928,7 +10982,8 @@ var CONFIG, SENSOR_CONFIG, NAV_POSHOLD, POSITION_ESTIMATOR, - RTH_AND_LAND_CONFIG; + RTH_AND_LAND_CONFIG, + FW_CONFIG; var FC = { isRatesInDps: function () { @@ -11257,6 +11312,17 @@ var FC = { failsafe_procedure: 0 }; + FW_CONFIG = { + cruiseThrottle: null, + minThrottle: null, + maxThrottle: null, + maxBankAngle: null, + maxClimbAngle: null, + maxDiveAngle: null, + pitchToThrottle: null, + loiterRadius: null + }; + RXFAIL_CONFIG = []; }, getFeatures: function () { @@ -14368,7 +14434,8 @@ TABS.advanced_tuning.initialize = function (callback) { loadChainer.setChain([ mspHelper.loadNavPosholdConfig, mspHelper.loadPositionEstimationConfig, - mspHelper.loadRthAndLandConfig + mspHelper.loadRthAndLandConfig, + mspHelper.loadFwConfig ]); loadChainer.setExitPoint(loadHtml); loadChainer.execute(); @@ -14377,6 +14444,7 @@ TABS.advanced_tuning.initialize = function (callback) { mspHelper.saveNavPosholdConfig, mspHelper.savePositionEstimationConfig, mspHelper.saveRthAndLandConfig, + mspHelper.saveFwConfig, mspHelper.saveToEeprom ]); saveChainer.setExitPoint(reboot); diff --git a/gulpfile.js b/gulpfile.js index d10d6c7f..3043528b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -164,7 +164,7 @@ gulp.task('deploy-receiver-msp-js', function () { gulp.task('deploy', ['deploy-css', 'deploy-js', 'deploy-receiver-msp-js', 'deploy-receiver-css']); gulp.task('watch', function () { - gulp.watch('js/*.js', ['build-js']); + gulp.watch('js/**/*.js', ['build-js']); gulp.watch('css/*.css', ['build-css']); gulp.watch('main.css', ['build-css']); gulp.watch('main.js', ['build-js']); diff --git a/js/fc.js b/js/fc.js index 41528d7b..41a2273c 100644 --- a/js/fc.js +++ b/js/fc.js @@ -45,7 +45,8 @@ var CONFIG, SENSOR_CONFIG, NAV_POSHOLD, POSITION_ESTIMATOR, - RTH_AND_LAND_CONFIG; + RTH_AND_LAND_CONFIG, + FW_CONFIG; var FC = { isRatesInDps: function () { @@ -374,6 +375,17 @@ var FC = { failsafe_procedure: 0 }; + FW_CONFIG = { + cruiseThrottle: null, + minThrottle: null, + maxThrottle: null, + maxBankAngle: null, + maxClimbAngle: null, + maxDiveAngle: null, + pitchToThrottle: null, + loiterRadius: null + }; + RXFAIL_CONFIG = []; }, getFeatures: function () { diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 753dee06..54d94b30 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -18,6 +18,8 @@ var MSPCodes = { MSP_RTH_AND_LAND_CONFIG: 21, MSP_SET_RTH_AND_LAND_CONFIG: 22, + MSP_FW_CONFIG: 23, + MSP_SET_FW_CONFIG: 24, // MSP commands for Cleanflight original features MSP_CHANNEL_FORWARDING: 32, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 52adb251..12b39f71 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -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); diff --git a/tabs/advanced_tuning.html b/tabs/advanced_tuning.html index e7e02f22..03e7420e 100644 --- a/tabs/advanced_tuning.html +++ b/tabs/advanced_tuning.html @@ -213,6 +213,72 @@ +
+
+
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+
+
diff --git a/tabs/advanced_tuning.js b/tabs/advanced_tuning.js index 47c7b8df..08880b2d 100644 --- a/tabs/advanced_tuning.js +++ b/tabs/advanced_tuning.js @@ -15,7 +15,8 @@ TABS.advanced_tuning.initialize = function (callback) { loadChainer.setChain([ mspHelper.loadNavPosholdConfig, mspHelper.loadPositionEstimationConfig, - mspHelper.loadRthAndLandConfig + mspHelper.loadRthAndLandConfig, + mspHelper.loadFwConfig ]); loadChainer.setExitPoint(loadHtml); loadChainer.execute(); @@ -24,6 +25,7 @@ TABS.advanced_tuning.initialize = function (callback) { mspHelper.saveNavPosholdConfig, mspHelper.savePositionEstimationConfig, mspHelper.saveRthAndLandConfig, + mspHelper.saveFwConfig, mspHelper.saveToEeprom ]); saveChainer.setExitPoint(reboot);