diff --git a/README.md b/README.md index c75ede7..116a117 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Here's an example of the output from the `dshot300` example sketch: ## How it Works -The library is architected around a single C++ class, `DShotRMT`. It abstracts the ESP32's RMT (Remote Control) peripheral, which is a hardware timer peripheral capable of generating and receiving precisely timed signals. +The library is architected around a single C++ class, `DShotRMT`. It abstracts the ESP32's RMT (Remote Control) peripheral, which is a hardware timer peripheral capable of generating and receiving precisely timed signals. For a more detailed explanation of the DShot protocol, refer to this excellent article: [DShot and Bidirectional DShot](https://brushlesswhoop.com/dshot-and-bidirectional-dshot/). 1. **Signal Generation (TX):** The library uses an RMT 'bytes_encoder'. This encoder is configured with the specific pulse durations for DShot '0' and '1' bits based on the selected speed (e.g., DSHOT300, DSHOT600). When a user calls `sendThrottle()`, the library constructs a 16-bit DShot frame (11-bit throttle, 1-bit telemetry request, 4-bit CRC) and hands it to the RMT encoder. The RMT hardware then autonomously generates the correct electrical signal on the specified GPIO pin. diff --git a/library.properties b/library.properties index be0ea08..6db6e5e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=DShotRMT -version=0.9.1 +version=0.9.2 author=Wastl Kraus maintainer=Wastl Kraus license=MIT diff --git a/src/DShotRMT.cpp b/src/DShotRMT.cpp index 893d984..657af05 100644 --- a/src/DShotRMT.cpp +++ b/src/DShotRMT.cpp @@ -401,8 +401,7 @@ dshot_result_t DShotRMT::_sendPacket(const dshot_packet_t &packet) // The DShot frame is 16 bits, which is 2 bytes size_t tx_size_bytes = sizeof(swapped_value); - rmt_transmit_config_t tx_config = {}; // Initialize all members to zero - tx_config.loop_count = 0; // No automatic loops - real-time calculation + rmt_transmit_config_t tx_config = { .loop_count = 0 }; // No automatic loops - real-time calculation // In bidirectional mode, the RMT RX channel must be disabled before transmitting. // This is to prevent the receiver from picking up the transmitted signal, which would cause a loopback issue. diff --git a/src/DShotRMT.h b/src/DShotRMT.h index 03f25f6..072d897 100644 --- a/src/DShotRMT.h +++ b/src/DShotRMT.h @@ -18,9 +18,10 @@ #include "dshot_definitions.h" #include "dshot_init.h" -// Forward declaration for the RMT receive callback -class DShotRMT; -void IRAM_ATTR rmt_rx_done_callback(rmt_channel_handle_t rx_chan, const rmt_rx_done_event_data_t *edata, void *user_data); +// DShotRMT Library Version +static constexpr uint8_t DSHOTRMT_MAJOR_VERSION = 0; +static constexpr uint8_t DSHOTRMT_MINOR_VERSION = 9; +static constexpr uint8_t DSHOTRMT_PATCH_VERSION = 2; // DShot Protocol Constants static constexpr auto DSHOT_THROTTLE_FAILSAFE = 0; @@ -132,3 +133,5 @@ private: }; #include "dshot_utils.h" // Include for helper functions + + diff --git a/src/dshot_utils.h b/src/dshot_utils.h index 753815c..f69dcbf 100644 --- a/src/dshot_utils.h +++ b/src/dshot_utils.h @@ -10,9 +10,7 @@ #include #include "dshot_definitions.h" - -// Forward declaration of the DShotRMT class to break circular dependency -class DShotRMT; +#include "DShotRMT.h" // Error Messages static constexpr char NONE[] = ""; @@ -137,6 +135,7 @@ inline void printDShotResult(dshot_result_t &result, Stream &output = Serial) inline void printDShotInfo(const DShotRMT &dshot_rmt, Stream &output = Serial) { output.println("\n === DShot Signal Info === "); + output.printf("Library Version: %d.%d.%d\n", DSHOTRMT_MAJOR_VERSION, DSHOTRMT_MINOR_VERSION, DSHOTRMT_PATCH_VERSION); output.printf("Current Mode: %s\n", get_dshot_mode_str(dshot_rmt.getMode())); output.printf("Bidirectional: %s\n", dshot_rmt.isBidirectional() ? "YES" : "NO"); output.printf("Current Packet: ");