1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 14:55:21 +03:00

Fix for old telemetry sent to RPM filter during a re-arming sequence

This commit is contained in:
iso9660 2022-09-23 06:50:47 +02:00
parent ce3354d1d3
commit 7a5b60e8c1
3 changed files with 9 additions and 0 deletions

View file

@ -23,6 +23,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <math.h> #include <math.h>
#include <string.h>
#include "platform.h" #include "platform.h"
@ -178,6 +179,11 @@ dshotTelemetryType_t dshot_get_telemetry_type_to_decode(uint8_t motorIndex)
return type; return type;
} }
void dshotCleanTelemetryData(void)
{
memset(dshotTelemetryState.motorState, 0, MAX_SUPPORTED_MOTORS * sizeof(dshotTelemetryMotorState_t));
}
FAST_CODE void dshotUpdateTelemetryData(uint8_t motorIndex, dshotTelemetryType_t type, uint16_t value) FAST_CODE void dshotUpdateTelemetryData(uint8_t motorIndex, dshotTelemetryType_t type, uint16_t value)
{ {
// Update telemetry data // Update telemetry data

View file

@ -117,5 +117,6 @@ void validateAndfixMotorOutputReordering(uint8_t *array, const unsigned size);
dshotTelemetryType_t dshot_get_telemetry_type_to_decode(uint8_t motorIndex); dshotTelemetryType_t dshot_get_telemetry_type_to_decode(uint8_t motorIndex);
uint32_t dshot_decode_telemetry_value(uint32_t value, dshotTelemetryType_t *type); uint32_t dshot_decode_telemetry_value(uint32_t value, dshotTelemetryType_t *type);
void dshotCleanTelemetryData(void);
void dshotUpdateTelemetryData(uint8_t motorIndex, dshotTelemetryType_t type, uint16_t value); void dshotUpdateTelemetryData(uint8_t motorIndex, dshotTelemetryType_t type, uint16_t value);

View file

@ -509,9 +509,11 @@ void tryArm(void)
return; return;
} }
#if defined(USE_ESC_SENSOR) && defined(USE_DSHOT_TELEMETRY) #if defined(USE_ESC_SENSOR) && defined(USE_DSHOT_TELEMETRY)
// Try to activate extended DSHOT telemetry only if no esc sensor exists and dshot telemetry is active // Try to activate extended DSHOT telemetry only if no esc sensor exists and dshot telemetry is active
if (isMotorProtocolDshot() && !featureIsEnabled(FEATURE_ESC_SENSOR) && motorConfig()->dev.useDshotTelemetry) { if (isMotorProtocolDshot() && !featureIsEnabled(FEATURE_ESC_SENSOR) && motorConfig()->dev.useDshotTelemetry) {
dshotCleanTelemetryData();
dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_EXTENDED_TELEMETRY_ENABLE, DSHOT_CMD_TYPE_INLINE); dshotCommandWrite(ALL_MOTORS, getMotorCount(), DSHOT_CMD_EXTENDED_TELEMETRY_ENABLE, DSHOT_CMD_TYPE_INLINE);
} }
#endif #endif