All changes up to now

This commit is contained in:
Wastl Kraus 2025-11-28 02:07:56 +01:00
parent 7a5c425fa8
commit f1db875521
5 changed files with 11 additions and 10 deletions

View File

@ -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.

View File

@ -1,5 +1,5 @@
name=DShotRMT
version=0.9.1
version=0.9.2
author=Wastl Kraus <wir-sind-die-matrix.de>
maintainer=Wastl Kraus <wir-sind-die-matrix.de>
license=MIT

View File

@ -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.

View File

@ -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

View File

@ -10,9 +10,7 @@
#include <Arduino.h>
#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: ");