Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 217e6ac

Browse files
committedDec 5, 2023
Added new DSHOT debug modes
Added checkbox to activate edt Restore other translation files than the english one Added logic to handle DSHOT edt checkbox in motors tab. Bumped API_VERSION to 1.46. Added dshot_edt setting to MSP_MOTOR_CONFIG frame. Added dshot_edt setting to MSP_SET_MOTOR_CONFIG frame. Updated API_VERSION in generate_filename. Fixed features in motors tab. Added exclusive selection between ESC_SENSOR and EDT options. Fixed a bug Fixed review findings Removed unecessary imports Fixed review findings Fixed review findings Added debug mode to match edt_events Betaflight branch Fixed RPM_LIMIT debug mode name Small refactoring to be coherent to current code style
1 parent 22a2eee commit 217e6ac

File tree

8 files changed

+63
-7
lines changed

8 files changed

+63
-7
lines changed
 

‎locales/en/messages.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -6759,8 +6759,12 @@
67596759
"message": "Bidirectional DShot (requires supported ESC firmware)",
67606760
"description": "Feature for the ESC/Motor"
67616761
},
6762+
"configurationDshotEdt": {
6763+
"message": "Built-in sensors",
6764+
"description": "ESC/Motor feature"
6765+
},
67626766
"configurationDshotBidirHelp": {
6763-
"message": "Sends ESC data to the FC via DShot telemetry. Required by RPM Filtering and dynamic idle. <br> <br>Note: Requires a compatible ESC with appropriate firmware, eg JESC, Jazzmac, BLHeli-32.",
6767+
"message": "Sends ESC data to the FC via DShot telemetry. Required by RPM Filtering and dynamic idle. <br> <br>Note: Requires a compatible ESC with appropriate firmware, eg Bluejay, AM32, JESC, Jazzmac, BLHeli-32.",
67646768
"description": "Description of the Bidirectional DShot feature of the ESC/Motor"
67656769
},
67666770
"configurationGyroSyncDenom": {

‎src/css/tabs/onboard_logging.less

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
.blackboxRate {
168168
select {
169169
float: left;
170-
width: 180px;
170+
width: 260px;
171171
height: 20px;
172172
margin: 0 10px 5px 0;
173173
border: 1px solid var(--subtleAccent);
@@ -202,7 +202,7 @@
202202
.blackboxDebugMode {
203203
select {
204204
float: left;
205-
width: 180px;
205+
width: 260px;
206206
height: 20px;
207207
margin: 0 10px 5px 0;
208208
border: 1px solid var(--subtleAccent);
@@ -215,7 +215,7 @@
215215
.blackboxDevice {
216216
select {
217217
float: left;
218-
width: 180px;
218+
width: 260px;
219219
height: 20px;
220220
margin: 0 10px 5px 0;
221221
border: 1px solid var(--subtleAccent);

‎src/js/VirtualFC.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const VirtualFC = {
3737
motor_count: 4,
3838
motor_poles: 14,
3939
use_dshot_telemetry: true,
40+
use_dshot_edt: true,
4041
use_esc_sensor: false,
4142
};
4243

‎src/js/debug.js

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ const DEBUG = {
8989
{text: "RC_STATS"},
9090
{text: "MAG_CALIB"},
9191
{text: "MAG_TASK_RATE"},
92+
{text: "DSHOT_STATUS_N_TEMPERATURE"},
93+
{text: "DSHOT_STATUS_N_VOLTAGE"},
94+
{text: "DSHOT_STATUS_N_CURRENT"},
95+
{text: "DSHOT_STATUS_N_DEBUG1"},
96+
{text: "DSHOT_STATUS_N_DEBUG2"},
97+
{text: "DSHOT_STATUS_N_STRESS_LVL"},
98+
{text: "DSHOT_STATUS_N_ERPM_FRACTION_18"},
9299
],
93100

94101
fieldNames : {

‎src/js/fc.js

+1
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ const FC = {
359359
motor_count: 0,
360360
motor_poles: 0,
361361
use_dshot_telemetry: false,
362+
use_dshot_edt: false,
362363
use_esc_sensor: false,
363364
};
364365

‎src/js/msp/MSPHelper.js

+6
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
497497
FC.MOTOR_CONFIG.use_dshot_telemetry = data.readU8() != 0;
498498
FC.MOTOR_CONFIG.use_esc_sensor = data.readU8() != 0;
499499
}
500+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
501+
FC.MOTOR_CONFIG.use_dshot_edt = data.readU8() != 0;
502+
}
500503
break;
501504
case MSPCodes.MSP_GPS_CONFIG:
502505
FC.GPS_CONFIG.provider = data.readU8();
@@ -1799,6 +1802,9 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
17991802
buffer.push8(FC.MOTOR_CONFIG.motor_poles);
18001803
buffer.push8(FC.MOTOR_CONFIG.use_dshot_telemetry ? 1 : 0);
18011804
}
1805+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
1806+
buffer.push8(FC.MOTOR_CONFIG.use_dshot_edt ? 1 : 0);
1807+
}
18021808
break;
18031809
case MSPCodes.MSP_SET_GPS_CONFIG:
18041810
buffer.push8(FC.GPS_CONFIG.provider)

‎src/js/tabs/motors.js

+35-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import FC from "../fc";
1212
import MSP from "../msp";
1313
import { mixerList } from "../model";
1414
import MSPCodes from "../msp/MSPCodes";
15-
import { API_VERSION_1_42, API_VERSION_1_44 } from "../data_storage";
15+
import { API_VERSION_1_42, API_VERSION_1_44, API_VERSION_1_46 } from "../data_storage";
1616
import EscProtocols from "../utils/EscProtocols";
1717
import { updateTabList } from "../utils/updateTabList";
1818
import { isInt, getMixerImageSrc } from "../utils/common";
@@ -22,6 +22,7 @@ import $ from 'jquery';
2222

2323
const motors = {
2424
previousDshotBidir: null,
25+
previousDshotEdt: null,
2526
previousFilterDynQ: null,
2627
previousFilterDynCount: null,
2728
analyticsChanges: {},
@@ -279,6 +280,7 @@ motors.initialize = async function (callback) {
279280
feature12: FC.FEATURE_CONFIG.features.isEnabled('3D'),
280281
feature27: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
281282
dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry,
283+
dshotEdt: FC.MOTOR_CONFIG.use_dshot_edt,
282284
motorPoles: FC.MOTOR_CONFIG.motor_poles,
283285
digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent,
284286
idleMinRpm: FC.ADVANCED_TUNING.idleMinRpm,
@@ -700,6 +702,7 @@ motors.initialize = async function (callback) {
700702
dshotBidirElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_telemetry).trigger("change");
701703

702704
self.previousDshotBidir = FC.MOTOR_CONFIG.use_dshot_telemetry;
705+
self.previousDshotEdt = FC.MOTOR_CONFIG.use_dshot_edt;
703706
self.previousFilterDynQ = FC.FILTER_CONFIG.dyn_notch_q;
704707
self.previousFilterDynCount = FC.FILTER_CONFIG.dyn_notch_count;
705708

@@ -708,6 +711,12 @@ motors.initialize = async function (callback) {
708711
const newValue = (value !== FC.MOTOR_CONFIG.use_dshot_telemetry) ? 'On' : 'Off';
709712
self.analyticsChanges['BidirectionalDshot'] = newValue;
710713
FC.MOTOR_CONFIG.use_dshot_telemetry = value;
714+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46) && !value) {
715+
const dshotEdtElement = $('input[id="dshotEdt"]');
716+
717+
FC.MOTOR_CONFIG.use_dshot_edt = value;
718+
dshotEdtElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_edt).trigger("change");
719+
}
711720

712721
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
713722
const rpmFilterIsDisabled = FC.FILTER_CONFIG.gyro_rpm_notch_harmonics === 0;
@@ -742,6 +751,19 @@ motors.initialize = async function (callback) {
742751
}
743752
});
744753

754+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
755+
const dshotEdtElement = $('input[id="dshotEdt"]');
756+
757+
dshotEdtElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_edt).trigger("change");
758+
dshotEdtElement.on("change", function () {
759+
const value = dshotEdtElement.is(':checked');
760+
const newValue = (value !== FC.MOTOR_CONFIG.use_dshot_edt) ? 'On' : 'Off';
761+
762+
self.analyticsChanges['DshotEdt'] = newValue;
763+
FC.MOTOR_CONFIG.use_dshot_edt = value;
764+
});
765+
}
766+
745767
$('input[name="motorPoles"]').val(FC.MOTOR_CONFIG.motor_poles);
746768
}
747769

@@ -780,14 +802,20 @@ motors.initialize = async function (callback) {
780802
$('div.digitalIdlePercent').hide();
781803
}
782804

783-
$('.escSensor').toggle(protocolConfigured && digitalProtocol);
805+
$('.escSensor').toggle(
806+
protocolConfigured && digitalProtocol && (
807+
semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_46) ||
808+
semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46) && !FC.MOTOR_CONFIG.use_dshot_edt));
784809

785810
$('div.checkboxDshotBidir').toggle(protocolConfigured && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42) && digitalProtocol);
786811
$('div.motorPoles').toggle(protocolConfigured && rpmFeaturesVisible && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42));
787812

788813
$('.escMotorStop').toggle(protocolConfigured);
789814

790815
$('#escProtocolDisabled').toggle(!protocolConfigured);
816+
$('.checkboxDshotEdt').toggle(
817+
protocolConfigured && digitalProtocol && dshotBidirElement.is(':checked') &&
818+
!$("input[name='ESC_SENSOR']").is(':checked') && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46));
791819

792820
//trigger change unsyncedPWMSwitch to show/hide Motor PWM freq input
793821
unsyncedPWMSwitchElement.trigger("change");
@@ -809,6 +837,11 @@ motors.initialize = async function (callback) {
809837

810838
//trigger change dshotBidir and ESC_SENSOR to show/hide Motor Poles tab
811839
dshotBidirElement.change(updateVisibility).trigger("change");
840+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
841+
const dshotEdtElement = $('input[id="dshotEdt"]');
842+
843+
dshotEdtElement.change(updateVisibility).trigger("change");
844+
}
812845
$("input[name='ESC_SENSOR']").on("change", updateVisibility).trigger("change");
813846

814847
// fill throttle

‎src/tabs/motors.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@
8989
<div class="number checkboxDshotBidir">
9090
<div style="float: left; height: 20px; margin-right: 14px; margin-left: 3px;">
9191
<input type="checkbox" id="dshotBidir" class="toggle" />
92+
<span class="freelabel" i18n="configurationDshotBidir"></span>
93+
</div>
94+
<div style="float: left; height: 20px; margin-right: 14px; margin-left: 3px;" class="checkboxDshotEdt">
95+
<input type="checkbox" id="dshotEdt" class="toggle" />
96+
<span class="freelabel" id="dshotEdtLabel" i18n="configurationDshotEdt"></span>
9297
</div>
93-
<span class="freelabel" i18n="configurationDshotBidir"></span>
9498
<div class="helpicon cf_tip" i18n_title="configurationDshotBidirHelp"></div>
9599
</div>
96100
<div class="number motorPoles">

0 commit comments

Comments
 (0)
Please sign in to comment.