gueei / DShot-Arduino

DShot implementation for Arduino using bit-banging method
68 stars 25 forks source link

Seems like there is a problen with createPacket function. #10

Open jopandla opened 1 year ago

jopandla commented 1 year ago

You test throttle for beeing command after bit shifting, effectively multiplying it by 2.

static inline uint16_t createPacket(uint16_t throttle) {
  uint8_t csum = 0;
  throttle <<= 1;
  // Indicate as command if less than 48
  if (throttle < 48 && throttle > 0)
    throttle |= 1;
  uint16_t csum_data = throttle;
...}

You should have tested for 482. `if (throttle < 482 && throttle > 0)` Or am I wrong?