mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-19 22:35:17 +03:00
Merge pull request #379 from mikeller/reorder_dshot_protocols
Reordered DShot protocols in ascending order.
This commit is contained in:
commit
603ea4e328
2 changed files with 29 additions and 7 deletions
|
@ -25,8 +25,29 @@ function MspHelper () {
|
|||
};
|
||||
}
|
||||
|
||||
MspHelper.prototype.reorderPwmProtocols = function (protocol) {
|
||||
var result = protocol;
|
||||
if (semver.lt(CONFIG.apiVersion, "1.26.0")) {
|
||||
switch (protocol) {
|
||||
case 5:
|
||||
result = 7;
|
||||
|
||||
break;
|
||||
case 7:
|
||||
result = 5;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
MspHelper.prototype.process_data = function(dataHandler) {
|
||||
var self = this;
|
||||
|
||||
var data = dataHandler.dataView; // DataView (allowing us to view arrayBuffer as struct/union)
|
||||
var code = dataHandler.code;
|
||||
if (!dataHandler.unsupported) switch (code) {
|
||||
|
@ -615,7 +636,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
PID_ADVANCED_CONFIG.gyro_sync_denom = data.readU8();
|
||||
PID_ADVANCED_CONFIG.pid_process_denom = data.readU8();
|
||||
PID_ADVANCED_CONFIG.use_unsyncedPwm = data.readU8();
|
||||
PID_ADVANCED_CONFIG.fast_pwm_protocol = data.readU8();
|
||||
PID_ADVANCED_CONFIG.fast_pwm_protocol = self.reorderPwmProtocols(data.readU8());
|
||||
PID_ADVANCED_CONFIG.motor_pwm_rate = data.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
PID_ADVANCED_CONFIG.digitalIdlePercent = data.readU16() / 100;
|
||||
|
@ -1134,12 +1155,12 @@ MspHelper.prototype.crunch = function(code) {
|
|||
buffer.push8(SENSOR_ALIGNMENT.align_gyro)
|
||||
.push8(SENSOR_ALIGNMENT.align_acc)
|
||||
.push8(SENSOR_ALIGNMENT.align_mag);
|
||||
break
|
||||
break;
|
||||
case MSPCodes.MSP_SET_ADVANCED_CONFIG:
|
||||
buffer.push8(PID_ADVANCED_CONFIG.gyro_sync_denom)
|
||||
.push8(PID_ADVANCED_CONFIG.pid_process_denom)
|
||||
.push8(PID_ADVANCED_CONFIG.use_unsyncedPwm)
|
||||
.push8(PID_ADVANCED_CONFIG.fast_pwm_protocol)
|
||||
.push8(self.reorderPwmProtocols(PID_ADVANCED_CONFIG.fast_pwm_protocol))
|
||||
.push16(PID_ADVANCED_CONFIG.motor_pwm_rate);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
buffer.push16(PID_ADVANCED_CONFIG.digitalIdlePercent * 100);
|
||||
|
|
|
@ -206,17 +206,18 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||
escprotocols.push('DSHOT600');
|
||||
escprotocols.push('DSHOT300');
|
||||
escprotocols.push('DSHOT150');
|
||||
escprotocols.push('DSHOT300');
|
||||
escprotocols.push('DSHOT600');
|
||||
}
|
||||
|
||||
var esc_protocol_e = $('select.escprotocol');
|
||||
|
||||
for (var i = 0; i < escprotocols.length; i++) {
|
||||
esc_protocol_e.append('<option value="' + (i+1) + '">'+ escprotocols[i] + '</option>');
|
||||
esc_protocol_e.append('<option value="' + (i + 1) + '">'+ escprotocols[i] + '</option>');
|
||||
}
|
||||
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol+1);
|
||||
|
||||
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
||||
|
||||
esc_protocol_e.change(function () {
|
||||
if ($(this).val() - 1 >= self.DSHOT_PROTOCOL_MIN_VALUE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue