Skip to content

Commit

Permalink
invert csum in telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
joelucid committed May 2, 2019
1 parent 4a7be33 commit f1e9c9f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/main/drivers/pwm_output_dshot_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static uint16_t decodeDshotPacket(uint32_t buffer[])
csum = csum ^ (csum >> 8); // xor bytes
csum = csum ^ (csum >> 4); // xor nibbles

if ((csum & 0xf) != 0) {
if ((csum & 0xf) != 0xf) {
return 0xffff;
}
return value >> 4;
Expand All @@ -176,7 +176,7 @@ static uint16_t decodeProshotPacket(uint32_t buffer[])
csum = csum ^ (csum >> 8); // xor bytes
csum = csum ^ (csum >> 4); // xor nibbles

if ((csum & 0xf) != 0) {
if ((csum & 0xf) != 0xf) {
return 0xffff;
}
return value >> 4;
Expand Down
8 changes: 0 additions & 8 deletions src/main/fc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,6 @@ void tryArm(void)
return;
}

#ifdef USE_DSHOT_TELEMETRY
if (isMotorProtocolDshot()) {
pwmWriteDshotCommand(
255, getMotorCount(), motorConfig()->dev.useDshotTelemetry ?
DSHOT_CMD_SIGNAL_LINE_CONTINUOUS_ERPM_TELEMETRY : DSHOT_CMD_SIGNAL_LINE_TELEMETRY_DISABLE, false);
}
#endif

if (isMotorProtocolDshot() && isModeActivationConditionPresent(BOXFLIPOVERAFTERCRASH)) {
if (!(IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH) || (tryingToArm == ARMING_DELAYED_CRASHFLIP))) {
flipOverAfterCrashActive = false;
Expand Down
21 changes: 0 additions & 21 deletions src/main/fc/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,6 @@ static IO_t busSwitchResetPin = IO_NONE;
}
#endif

#ifdef USE_DSHOT_TELEMETRY
void activateDshotTelemetry(struct dispatchEntry_s* self)
{
if (!ARMING_FLAG(ARMED) && !isDshotTelemetryActive()) {
pwmWriteDshotCommand(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SIGNAL_LINE_CONTINUOUS_ERPM_TELEMETRY, false);
dispatchAdd(self, 1e6); // check again in 1 second
}
}

dispatchEntry_t activateDshotTelemetryEntry =
{
activateDshotTelemetry, 0, NULL, false
};
#endif

void init(void)
{
Expand Down Expand Up @@ -794,13 +780,6 @@ void init(void)

setArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);

#ifdef USE_DSHOT_TELEMETRY
if (motorConfig()->dev.useDshotTelemetry) {
dispatchEnable();
dispatchAdd(&activateDshotTelemetryEntry, 5000000);
}
#endif

fcTasksInit();

systemState |= SYSTEM_STATE_READY;
Expand Down

0 comments on commit f1e9c9f

Please sign in to comment.