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

@ -2086,5 +2086,32 @@
}, },
"emergencyDescentRate": { "emergencyDescentRate": {
"message": "Emergency landing speed [cm/s]" "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"
} }
} }

View file

@ -7426,6 +7426,8 @@ var MSPCodes = {
MSP_RTH_AND_LAND_CONFIG: 21, MSP_RTH_AND_LAND_CONFIG: 21,
MSP_SET_RTH_AND_LAND_CONFIG: 22, MSP_SET_RTH_AND_LAND_CONFIG: 22,
MSP_FW_CONFIG: 23,
MSP_SET_FW_CONFIG: 24,
// MSP commands for Cleanflight original features // MSP commands for Cleanflight original features
MSP_CHANNEL_FORWARDING: 32, MSP_CHANNEL_FORWARDING: 32,
@ -8509,6 +8511,21 @@ var mspHelper = (function (gui) {
console.log('RTH_AND_LAND_CONFIG saved'); console.log('RTH_AND_LAND_CONFIG saved');
break; 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: case MSPCodes.MSP_SET_MODE_RANGE:
console.log('Mode range saved'); console.log('Mode range saved');
break; break;
@ -8890,6 +8907,27 @@ var mspHelper = (function (gui) {
buffer.push(highByte(RTH_AND_LAND_CONFIG.emergencyDescentRate)); buffer.push(highByte(RTH_AND_LAND_CONFIG.emergencyDescentRate));
break; 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: case MSPCodes.MSP_SET_FILTER_CONFIG:
buffer.push(FILTER_CONFIG.gyroSoftLpfHz); 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; return self;
})(GUI); })(GUI);
@ -10928,7 +10982,8 @@ var CONFIG,
SENSOR_CONFIG, SENSOR_CONFIG,
NAV_POSHOLD, NAV_POSHOLD,
POSITION_ESTIMATOR, POSITION_ESTIMATOR,
RTH_AND_LAND_CONFIG; RTH_AND_LAND_CONFIG,
FW_CONFIG;
var FC = { var FC = {
isRatesInDps: function () { isRatesInDps: function () {
@ -11257,6 +11312,17 @@ var FC = {
failsafe_procedure: 0 failsafe_procedure: 0
}; };
FW_CONFIG = {
cruiseThrottle: null,
minThrottle: null,
maxThrottle: null,
maxBankAngle: null,
maxClimbAngle: null,
maxDiveAngle: null,
pitchToThrottle: null,
loiterRadius: null
};
RXFAIL_CONFIG = []; RXFAIL_CONFIG = [];
}, },
getFeatures: function () { getFeatures: function () {
@ -14368,7 +14434,8 @@ TABS.advanced_tuning.initialize = function (callback) {
loadChainer.setChain([ loadChainer.setChain([
mspHelper.loadNavPosholdConfig, mspHelper.loadNavPosholdConfig,
mspHelper.loadPositionEstimationConfig, mspHelper.loadPositionEstimationConfig,
mspHelper.loadRthAndLandConfig mspHelper.loadRthAndLandConfig,
mspHelper.loadFwConfig
]); ]);
loadChainer.setExitPoint(loadHtml); loadChainer.setExitPoint(loadHtml);
loadChainer.execute(); loadChainer.execute();
@ -14377,6 +14444,7 @@ TABS.advanced_tuning.initialize = function (callback) {
mspHelper.saveNavPosholdConfig, mspHelper.saveNavPosholdConfig,
mspHelper.savePositionEstimationConfig, mspHelper.savePositionEstimationConfig,
mspHelper.saveRthAndLandConfig, mspHelper.saveRthAndLandConfig,
mspHelper.saveFwConfig,
mspHelper.saveToEeprom mspHelper.saveToEeprom
]); ]);
saveChainer.setExitPoint(reboot); saveChainer.setExitPoint(reboot);

View file

@ -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('deploy', ['deploy-css', 'deploy-js', 'deploy-receiver-msp-js', 'deploy-receiver-css']);
gulp.task('watch', function () { gulp.task('watch', function () {
gulp.watch('js/*.js', ['build-js']); gulp.watch('js/**/*.js', ['build-js']);
gulp.watch('css/*.css', ['build-css']); gulp.watch('css/*.css', ['build-css']);
gulp.watch('main.css', ['build-css']); gulp.watch('main.css', ['build-css']);
gulp.watch('main.js', ['build-js']); gulp.watch('main.js', ['build-js']);

View file

@ -45,7 +45,8 @@ var CONFIG,
SENSOR_CONFIG, SENSOR_CONFIG,
NAV_POSHOLD, NAV_POSHOLD,
POSITION_ESTIMATOR, POSITION_ESTIMATOR,
RTH_AND_LAND_CONFIG; RTH_AND_LAND_CONFIG,
FW_CONFIG;
var FC = { var FC = {
isRatesInDps: function () { isRatesInDps: function () {
@ -374,6 +375,17 @@ var FC = {
failsafe_procedure: 0 failsafe_procedure: 0
}; };
FW_CONFIG = {
cruiseThrottle: null,
minThrottle: null,
maxThrottle: null,
maxBankAngle: null,
maxClimbAngle: null,
maxDiveAngle: null,
pitchToThrottle: null,
loiterRadius: null
};
RXFAIL_CONFIG = []; RXFAIL_CONFIG = [];
}, },
getFeatures: function () { getFeatures: function () {

View file

@ -18,6 +18,8 @@ var MSPCodes = {
MSP_RTH_AND_LAND_CONFIG: 21, MSP_RTH_AND_LAND_CONFIG: 21,
MSP_SET_RTH_AND_LAND_CONFIG: 22, MSP_SET_RTH_AND_LAND_CONFIG: 22,
MSP_FW_CONFIG: 23,
MSP_SET_FW_CONFIG: 24,
// MSP commands for Cleanflight original features // MSP commands for Cleanflight original features
MSP_CHANNEL_FORWARDING: 32, MSP_CHANNEL_FORWARDING: 32,

View file

@ -958,6 +958,21 @@ var mspHelper = (function (gui) {
console.log('RTH_AND_LAND_CONFIG saved'); console.log('RTH_AND_LAND_CONFIG saved');
break; 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: case MSPCodes.MSP_SET_MODE_RANGE:
console.log('Mode range saved'); console.log('Mode range saved');
break; break;
@ -1339,6 +1354,27 @@ var mspHelper = (function (gui) {
buffer.push(highByte(RTH_AND_LAND_CONFIG.emergencyDescentRate)); buffer.push(highByte(RTH_AND_LAND_CONFIG.emergencyDescentRate));
break; 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: case MSPCodes.MSP_SET_FILTER_CONFIG:
buffer.push(FILTER_CONFIG.gyroSoftLpfHz); 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; return self;
})(GUI); })(GUI);

View file

@ -213,6 +213,72 @@
</div> </div>
</div> </div>
<div class="config-section gui_box grey requires-v1_7_1">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="fixedWingConfiguration"></div>
</div>
<div class="spacer_box">
<div class="number">
<input id="cruiseThrottle" type="number" data-simple-bind="FW_CONFIG.cruiseThrottle" step="1" min="1000" max="2000">
<label for="cruiseThrottle">
<span data-i18n="cruiseThrottle"></span>
</label>
</div>
<div class="number">
<input id="minThrottle" type="number" data-simple-bind="FW_CONFIG.minThrottle" step="1" min="1000" max="2000">
<label for="minThrottle">
<span data-i18n="minThrottle"></span>
</label>
</div>
<div class="number">
<input id="maxThrottle" type="number" data-simple-bind="FW_CONFIG.maxThrottle" step="1" min="1000" max="2000">
<label for="maxThrottle">
<span data-i18n="maxThrottle"></span>
</label>
</div>
<div class="number">
<input id="maxBankAngle" type="number" data-simple-bind="FW_CONFIG.maxBankAngle" step="1" min="5" max="80">
<label for="maxBankAngle">
<span data-i18n="maxBankAngle"></span>
</label>
</div>
<div class="number">
<input id="maxClimbAngle" type="number" data-simple-bind="FW_CONFIG.maxClimbAngle" step="1" min="5" max="80">
<label for="maxClimbAngle">
<span data-i18n="maxClimbAngle"></span>
</label>
</div>
<div class="number">
<input id="maxDiveAngle" type="number" data-simple-bind="FW_CONFIG.maxDiveAngle" step="1" min="5" max="80">
<label for="maxDiveAngle">
<span data-i18n="maxDiveAngle"></span>
</label>
</div>
<div class="number">
<input id="pitchToThrottle" type="number" data-simple-bind="FW_CONFIG.pitchToThrottle" step="1" min="0" max="100">
<label for="pitchToThrottle">
<span data-i18n="pitchToThrottle"></span>
</label>
</div>
<div class="number">
<input id="loiterRadius" type="number" data-simple-bind="FW_CONFIG.loiterRadius" step="1" min="0" max="10000">
<label for="loiterRadius">
<span data-i18n="loiterRadius"></span>
</label>
</div>
</div>
</div>
</div> </div>
<div class="clear-both"></div> <div class="clear-both"></div>

View file

@ -15,7 +15,8 @@ TABS.advanced_tuning.initialize = function (callback) {
loadChainer.setChain([ loadChainer.setChain([
mspHelper.loadNavPosholdConfig, mspHelper.loadNavPosholdConfig,
mspHelper.loadPositionEstimationConfig, mspHelper.loadPositionEstimationConfig,
mspHelper.loadRthAndLandConfig mspHelper.loadRthAndLandConfig,
mspHelper.loadFwConfig
]); ]);
loadChainer.setExitPoint(loadHtml); loadChainer.setExitPoint(loadHtml);
loadChainer.execute(); loadChainer.execute();
@ -24,6 +25,7 @@ TABS.advanced_tuning.initialize = function (callback) {
mspHelper.saveNavPosholdConfig, mspHelper.saveNavPosholdConfig,
mspHelper.savePositionEstimationConfig, mspHelper.savePositionEstimationConfig,
mspHelper.saveRthAndLandConfig, mspHelper.saveRthAndLandConfig,
mspHelper.saveFwConfig,
mspHelper.saveToEeprom mspHelper.saveToEeprom
]); ]);
saveChainer.setExitPoint(reboot); saveChainer.setExitPoint(reboot);