Skip to content

Commit e8ee32e

Browse files
authored
Merge pull request #9898 from iNavFlight/dzikuvx-drop-dji-proto-workarounds
Remove workarounds as not used and obsolete
2 parents d1a8469 + 1336981 commit e8ee32e

File tree

4 files changed

+4
-64
lines changed

4 files changed

+4
-64
lines changed

docs/Settings.md

-10
Original file line numberDiff line numberDiff line change
@@ -752,16 +752,6 @@ Re-purpose the craft name field for messages.
752752

753753
---
754754

755-
### dji_workarounds
756-
757-
Enables workarounds for different versions of MSP protocol used
758-
759-
| Default | Min | Max |
760-
| --- | --- | --- |
761-
| 1 | 0 | 255 |
762-
763-
---
764-
765755
### dshot_beeper_enabled
766756

767757
Whether using DShot motors as beepers is enabled

src/main/fc/settings.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -4008,12 +4008,6 @@ groups:
40084008
headers: ["io/osd_dji_hd.h"]
40094009
condition: USE_DJI_HD_OSD
40104010
members:
4011-
- name: dji_workarounds
4012-
description: "Enables workarounds for different versions of MSP protocol used"
4013-
field: proto_workarounds
4014-
min: 0
4015-
max: UINT8_MAX
4016-
default_value: 1
40174011
- name: dji_use_name_for_messages
40184012
description: "Re-purpose the craft name field for messages."
40194013
default_value: ON

src/main/io/osd_dji_hd.c

+4-47
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@
122122
* but reuse the packet decoder to minimize code duplication
123123
*/
124124

125-
PG_REGISTER_WITH_RESET_TEMPLATE(djiOsdConfig_t, djiOsdConfig, PG_DJI_OSD_CONFIG, 2);
125+
PG_REGISTER_WITH_RESET_TEMPLATE(djiOsdConfig_t, djiOsdConfig, PG_DJI_OSD_CONFIG, 3);
126126
PG_RESET_TEMPLATE(djiOsdConfig_t, djiOsdConfig,
127127
.use_name_for_messages = SETTING_DJI_USE_NAME_FOR_MESSAGES_DEFAULT,
128128
.esc_temperature_source = SETTING_DJI_ESC_TEMP_SOURCE_DEFAULT,
129-
.proto_workarounds = SETTING_DJI_WORKAROUNDS_DEFAULT,
130129
.messageSpeedSource = SETTING_DJI_MESSAGE_SPEED_SOURCE_DEFAULT,
131130
.rssi_source = SETTING_DJI_RSSI_SOURCE_DEFAULT,
132131
.useAdjustments = SETTING_DJI_USE_ADJUSTMENTS_DEFAULT,
@@ -1347,12 +1346,11 @@ static mspResult_e djiProcessMspCommand(mspPacket_t *cmd, mspPacket_t *reply, ms
13471346
break;
13481347

13491348
case DJI_MSP_ESC_SENSOR_DATA:
1350-
if (djiOsdConfig()->proto_workarounds & DJI_OSD_USE_NON_STANDARD_MSP_ESC_SENSOR_DATA) {
1351-
// Version 1.00.06 of DJI firmware is not using the standard MSP_ESC_SENSOR_DATA
1349+
{
13521350
uint16_t protoRpm = 0;
13531351
int16_t protoTemp = 0;
13541352

1355-
#if defined(USE_ESC_SENSOR)
1353+
#if defined(USE_ESC_SENSOR)
13561354
if (STATE(ESC_SENSOR_ENABLED) && getMotorCount() > 0) {
13571355
uint32_t motorRpmAcc = 0;
13581356
int32_t motorTempAcc = 0;
@@ -1366,7 +1364,7 @@ static mspResult_e djiProcessMspCommand(mspPacket_t *cmd, mspPacket_t *reply, ms
13661364
protoRpm = motorRpmAcc / getMotorCount();
13671365
protoTemp = motorTempAcc / getMotorCount();
13681366
}
1369-
#endif
1367+
#endif
13701368

13711369
switch (djiOsdConfig()->esc_temperature_source) {
13721370
// This is ESC temperature (as intended)
@@ -1391,47 +1389,6 @@ static mspResult_e djiProcessMspCommand(mspPacket_t *cmd, mspPacket_t *reply, ms
13911389
sbufWriteU8(dst, protoTemp);
13921390
sbufWriteU16(dst, protoRpm);
13931391
}
1394-
else {
1395-
// Use standard MSP_ESC_SENSOR_DATA message
1396-
sbufWriteU8(dst, getMotorCount());
1397-
for (int i = 0; i < getMotorCount(); i++) {
1398-
uint16_t motorRpm = 0;
1399-
int16_t motorTemp = 0;
1400-
1401-
// If ESC_SENSOR is enabled, pull the telemetry data and get motor RPM
1402-
#if defined(USE_ESC_SENSOR)
1403-
if (STATE(ESC_SENSOR_ENABLED)) {
1404-
const escSensorData_t * escSensor = getEscTelemetry(i);
1405-
motorRpm = escSensor->rpm;
1406-
motorTemp = escSensor->temperature;
1407-
}
1408-
#endif
1409-
1410-
// Now populate temperature field (which we may override for different purposes)
1411-
switch (djiOsdConfig()->esc_temperature_source) {
1412-
// This is ESC temperature (as intended)
1413-
case DJI_OSD_TEMP_ESC:
1414-
// No-op, temperature is already set to ESC
1415-
break;
1416-
1417-
// Re-purpose the field for core temperature
1418-
case DJI_OSD_TEMP_CORE:
1419-
getIMUTemperature(&motorTemp);
1420-
motorTemp = motorTemp / 10;
1421-
break;
1422-
1423-
// Re-purpose the field for baro temperature
1424-
case DJI_OSD_TEMP_BARO:
1425-
getBaroTemperature(&motorTemp);
1426-
motorTemp = motorTemp / 10;
1427-
break;
1428-
}
1429-
1430-
// Add data for this motor to the packet
1431-
sbufWriteU8(dst, motorTemp);
1432-
sbufWriteU16(dst, motorRpm);
1433-
}
1434-
}
14351392
break;
14361393

14371394
case DJI_MSP_OSD_CONFIG:

src/main/io/osd_dji_hd.h

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ enum djiOsdProtoWorkarounds_e {
8484
typedef struct djiOsdConfig_s {
8585
uint8_t use_name_for_messages;
8686
uint8_t esc_temperature_source;
87-
uint8_t proto_workarounds;
8887
uint8_t messageSpeedSource;
8988
uint8_t rssi_source;
9089
uint8_t useAdjustments;

0 commit comments

Comments
 (0)