...changed some return types
This commit is contained in:
parent
443d032d56
commit
d7bcd523e0
|
|
@ -11,8 +11,8 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
ARDUINO_CLI_VERSION: 'latest'
|
||||
ESP32_CORE_VERSION: 'latest'
|
||||
ARDUINO_CLI_VERSION: '1.3.0'
|
||||
ESP32_CORE_VERSION: '3.3.0'
|
||||
|
||||
jobs:
|
||||
# ============================================================================
|
||||
|
|
@ -27,6 +27,25 @@ jobs:
|
|||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Arduino CLI
|
||||
uses: arduino/setup-arduino-cli@v1
|
||||
with:
|
||||
version: ${{ env.ARDUINO_CLI_VERSION }}
|
||||
|
||||
- name: Cache Arduino data
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.arduino15
|
||||
key: ${{ runner.os }}-arduino-${{ env.ESP32_CORE_VERSION }}-${{ hashFiles('**/libraries/**') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-arduino-${{ env.ESP32_CORE_VERSION }}-
|
||||
|
||||
- name: Install ESP32 core
|
||||
run: |
|
||||
arduino-cli core update-index
|
||||
arduino-cli core install esp32:esp32@${{ env.ESP32_CORE_VERSION }}
|
||||
|
||||
- name: Arduino Lint
|
||||
uses: arduino/arduino-lint-action@v1
|
||||
with:
|
||||
|
|
@ -55,12 +74,28 @@ jobs:
|
|||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Compile Example (${{ matrix.build-flags.name }})
|
||||
uses: arduino/compile-sketches@v1
|
||||
- name: Setup Arduino CLI
|
||||
uses: arduino/setup-arduino-cli@v1
|
||||
with:
|
||||
fqbn: esp32:esp32:esp32
|
||||
libraries: |
|
||||
- source-path: ${{ github.workspace }}
|
||||
version: ${{ env.ARDUINO_CLI_VERSION }}
|
||||
|
||||
- name: Cache Arduino data
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.arduino15
|
||||
key: ${{ runner.os }}-arduino-${{ env.ESP32_CORE_VERSION }}-${{ hashFiles('**/libraries/**') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-arduino-${{ env.ESP32_CORE_VERSION }}-
|
||||
|
||||
- name: Install ESP32 core
|
||||
run: |
|
||||
arduino-cli core update-index
|
||||
arduino-cli core install esp32:esp32@${{ env.ESP32_CORE_VERSION }}
|
||||
|
||||
- name: Compile Example (${{ matrix.build-flags.name }})
|
||||
run: |
|
||||
arduino-cli compile --fqbn esp32:esp32:esp32 ${{ matrix.example }}
|
||||
|
||||
# ============================================================================
|
||||
# Static Code Analysis
|
||||
|
|
@ -74,6 +109,25 @@ jobs:
|
|||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Arduino CLI
|
||||
uses: arduino/setup-arduino-cli@v1
|
||||
with:
|
||||
version: ${{ env.ARDUINO_CLI_VERSION }}
|
||||
|
||||
- name: Cache Arduino data
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.arduino15
|
||||
key: ${{ runner.os }}-arduino-${{ env.ESP32_CORE_VERSION }}-${{ hashFiles('**/libraries/**') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-arduino-${{ env.ESP32_CORE_VERSION }}-
|
||||
|
||||
- name: Install ESP32 core
|
||||
run: |
|
||||
arduino-cli core update-index
|
||||
arduino-cli core install esp32:esp32@${{ env.ESP32_CORE_VERSION }}
|
||||
|
||||
- name: Install Cppcheck
|
||||
run: sudo apt-get update && sudo apt-get install -y cppcheck
|
||||
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ examples/dshot300/esp32.svd
|
|||
examples/dshot300/debug_custom.json
|
||||
examples/dshot300/debug.svd
|
||||
/build
|
||||
/.github/chatmodes
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ DShotRMT::DShotRMT(uint16_t pin_nr, dshot_mode_t mode, bool is_bidirectional) :
|
|||
}
|
||||
|
||||
// Setup and configure DShotRMT
|
||||
bool DShotRMT::begin()
|
||||
uint16_t DShotRMT::begin()
|
||||
{
|
||||
// Inits TX Channel
|
||||
if (!_initTXChannel())
|
||||
|
|
@ -320,7 +320,7 @@ uint16_t DShotRMT::_decodeDShotFrame(const rmt_symbol_word_t *symbols)
|
|||
// Decodes each symbol to reconstruct the frame
|
||||
for (size_t i = 0; i < DSHOT_BITS_PER_FRAME; ++i)
|
||||
{
|
||||
bool bit = symbols[i].duration0 < symbols[i].duration1;
|
||||
bool bit = symbols[i].duration0 > symbols[i].duration1;
|
||||
received_frame = (received_frame << 1) | bit;
|
||||
}
|
||||
|
||||
|
|
|
|||
24
DShotRMT.h
24
DShotRMT.h
|
|
@ -15,20 +15,20 @@
|
|||
#include <driver/rmt_rx.h>
|
||||
|
||||
// --- DShot Protocol Constants ---
|
||||
static constexpr auto DSHOT_THROTTLE_FAILSAFE = 0;
|
||||
static constexpr auto DSHOT_THROTTLE_MIN = 48;
|
||||
static constexpr auto DSHOT_THROTTLE_MAX = 2047;
|
||||
constexpr auto DSHOT_THROTTLE_FAILSAFE = 0;
|
||||
constexpr auto DSHOT_THROTTLE_MIN = 48;
|
||||
constexpr auto DSHOT_THROTTLE_MAX = 2047;
|
||||
|
||||
static constexpr auto DSHOT_BITS_PER_FRAME = 16;
|
||||
static constexpr auto DSHOT_SWITCH_TIME = 30; // 30us
|
||||
static constexpr auto DSHOT_NULL_PACKET = 0b0000000000000000;
|
||||
constexpr auto DSHOT_BITS_PER_FRAME = 16;
|
||||
constexpr auto DSHOT_SWITCH_TIME = 30; // 30us
|
||||
constexpr auto DSHOT_NULL_PACKET = 0b0000000000000000;
|
||||
|
||||
// --- RMT Config Constants ---
|
||||
static constexpr auto DSHOT_CLOCK_SRC_DEFAULT = RMT_CLK_SRC_DEFAULT;
|
||||
static constexpr auto DSHOT_RMT_RESOLUTION = 10 * 1000 * 1000; // 10 MHz
|
||||
static constexpr auto TX_BUFFER_SIZE = DSHOT_BITS_PER_FRAME;
|
||||
static constexpr auto RX_BUFFER_SIZE = 128;
|
||||
static constexpr auto DSHOT_SYMBOLS_SIZE = 64;
|
||||
constexpr auto DSHOT_CLOCK_SRC_DEFAULT = RMT_CLK_SRC_DEFAULT;
|
||||
constexpr auto DSHOT_RMT_RESOLUTION = 10 * 1000 * 1000; // 10 MHz
|
||||
constexpr auto TX_BUFFER_SIZE = DSHOT_BITS_PER_FRAME;
|
||||
constexpr auto RX_BUFFER_SIZE = 128;
|
||||
constexpr auto DSHOT_SYMBOLS_SIZE = 64;
|
||||
|
||||
// --- DShot Mode Select ---
|
||||
typedef enum dshot_mode_e
|
||||
|
|
@ -71,7 +71,7 @@ public:
|
|||
DShotRMT(uint16_t pin_nr, dshot_mode_t mode, bool is_bidirectional);
|
||||
|
||||
// --- Init RMT Module ---
|
||||
bool begin();
|
||||
uint16_t begin();
|
||||
|
||||
// Sets the throttle value and transmits
|
||||
[[deprecated("Use sendThrottle() instead")]]
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void print_RMT_packet()
|
|||
USB_SERIAL.print("Current Frame: ");
|
||||
|
||||
// Print bit by bit
|
||||
for (auto i = 15; i >= 0; --i)
|
||||
for (int i = 15; i >= 0; --i)
|
||||
{
|
||||
if ((packet >> i) & 1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue