parent
1c8a0ed572
commit
9539a0055f
|
|
@ -64,8 +64,8 @@ void DShotRMT::begin()
|
||||||
// Encodes and transmits a valid DShot Throttle value (48 - 2047)
|
// Encodes and transmits a valid DShot Throttle value (48 - 2047)
|
||||||
void DShotRMT::setThrottle(uint16_t throttle)
|
void DShotRMT::setThrottle(uint16_t throttle)
|
||||||
{
|
{
|
||||||
// Safety first - double check input range and 10 bit "translation"
|
// Safety first - double check input range and 11 bit "translation"
|
||||||
throttle = (constrain(throttle, DSHOT_THROTTLE_MIN, DSHOT_THROTTLE_MAX)) & 0b0000011111111111;
|
throttle = constrain(throttle, DSHOT_THROTTLE_MIN, DSHOT_THROTTLE_MAX) & 0b0000011111111111;
|
||||||
|
|
||||||
// Has Throttle really changed?
|
// Has Throttle really changed?
|
||||||
if (throttle == _lastThrottle)
|
if (throttle == _lastThrottle)
|
||||||
|
|
@ -181,7 +181,7 @@ uint16_t DShotRMT::assambleDShotPaket(uint16_t value)
|
||||||
// Clear container
|
// Clear container
|
||||||
_tx_packet = DSHOT_NULL_PACKET;
|
_tx_packet = DSHOT_NULL_PACKET;
|
||||||
|
|
||||||
// dummy 10bit convertion
|
// dummy 11bit convertion
|
||||||
_tx_packet = value & 0b0000011111111111;
|
_tx_packet = value & 0b0000011111111111;
|
||||||
|
|
||||||
// Assemble raw DShot packet and add checksum
|
// Assemble raw DShot packet and add checksum
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ private:
|
||||||
uint16_t _lastThrottle = DSHOT_FULL_PACKET;
|
uint16_t _lastThrottle = DSHOT_FULL_PACKET;
|
||||||
uint16_t _received_packet = DSHOT_NULL_PACKET;
|
uint16_t _received_packet = DSHOT_NULL_PACKET;
|
||||||
uint16_t _tx_packet = DSHOT_NULL_PACKET;
|
uint16_t _tx_packet = DSHOT_NULL_PACKET;
|
||||||
uint16_t _packet_crc = DSHOT_NULL_PACKET;
|
uint16_t _packet_crc = 0;
|
||||||
|
|
||||||
// --- RMT Channel ---
|
// --- RMT Channel ---
|
||||||
rmt_channel_handle_t _rmt_rx_channel = nullptr;
|
rmt_channel_handle_t _rmt_rx_channel = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue