Skip to content

Commit

Permalink
Neopixel RMT (IDF 5.1) now supports more pixels (#19351)
Browse files Browse the repository at this point in the history
* Initial C6 support

* add C6 in tasmota_globals.h

* fix copy&paste errors

* Use updated platform (build 1481)

* use common safeboot flags (#19282) (#352)

Co-authored-by: Christian Baars <[email protected]>

* use env var lib_ignore

* safeboot lib_ignore env

* revert wrong change

* rm eink lib from standard used libs

* add c2-board 4M, maximum_size probably a bit off

* diffuse idea for 2MB with OTA and FS

* C2 and C6 additions

* C2 and C6 additions for commands.ino

* C2 and C6 additions for crash recorder

* C2 to support_esp

* some preps for C2

* add c2 to tasmota.h

* fix some typos and compile bugs

* fix 2 compiler warnings for Arduino 3.0

* fix another warning

* add correct pins to template

* pins for C2, maximum_size updated

* unclutter env:tasmota32c2-safeboot

* fix c6 env

* more pins for the C2, but not all

* pin 9 and 10 for c2/c6

* add ||

* prep pins for c6

* make c6 compile, needs testing

* fix copy-paste-error

* more correct pin support C6

* pin14 C6

* wrong warning for C6

* 10 and 11 are flash pins on the C6

* boolean voodoo

* fix EVERYTHING

* fix Onewire for Arduino 3.0

* enable OneWire

* finale fix for all platforms: OneWire.h

* better compatibility

* final fix onewire

* refactor Platformio Arduino 3.0 setup

* overlooked needed `;`

* refactor as requested

* fix NeoPixelBus compilation for C2 and C6

* fix Arduino30 for old working NeoPixel boards

* Try to switch of RMT LED when not SOC supported

* use latest IDF 5.1

* framework includes now "libsodium"

* prep NeoPixel RMT rewrite

* NeoPixel for C6

* fix Arduino 2.x

* really fix compile ??

* fix compiler warning TSL2591

* fix compiler warning TSL2591 _2

* fix compile warning TSL2561

* fix warning sensirion part 1

* fix ESP32 Arduino 3.0 compile (needs work check)

* Disable NeoPixel for C2 (no RMT support)

* forgotten to remove

* fix compiler warning

* prep 5.1, TasUpdater

* prep 5.1 SensirionRXFrame

* prep 5.1, SensiriomI2CCommunication.cpp

* prep5.1, last batch Sensirion

* prep5.1, silence compiler warning

* Silence C++ deprecated warning

* Align with branch C6-support (#359)

* prep5.1, fix berry_wire

* revert deprecated compiler flag

---------

Co-authored-by: Staars <[email protected]>
Co-authored-by: Christian Baars <[email protected]>

* add i2c #defines

* enable more libs for ESP32

* refactor for esp-nimble-cpp

* add esp-nimble-cpp, needed for C2,C6

* fix dual use of IRAM_ATTR for i2sDmaISR

* silence compiler warning with cast

* prep5.1, new DAC API in Berry

* more libs enabled

* NimBLE changes

* fix wrong build flag for MI

* add NimBLE ignores

* add MI to env

* use latest framework with changed NimBLE

* add libesp32_div to C2/C6

* fix env konfig for NimBLE

* new esp-cpp-nimble for all

* prep5.1, silence compiler warning around IRAM_ATR

* prep5.1, i2s pre-work

* add c2 to lib esp-nimble-cpp

* prep5.1, intermediate refactoring

* prep5.1, intermediate refactoring

* fix chirp for IDF>5

* prep5.1, fix compilation error

* Update platformio_tasmota_core3_env.ini

* prep5.1, SPI fixes for C2/C6

* prep5.1, fix universal display

* enable uDisplay

* c3cdc display

* add odroid env

* rm obsolote option

* rm BLE from c3cdc

* fix SD Card (changed sdkconfig)

* cdc env, lvgl to all builds

* add cdc safeboot

* use framework build 1504

* prep5.1., intermediate restart

* forgot to save

* prep5.1, we love static cast

* latest framework build 1510

* fix xsns_74_lmt01

* ditch NeoPixel-I2S for 5.1

* prep5.1, begin RMT C6

* Ethernet Test

* forgot to upload

* invert timing in led-encoder

* build 1511 / IDF 5.1.0.230818

* compile NeopixelBus for C6

* re - uncomment

* re - uncomment the next

* enable Neopixel

* One more Neopixel try

* what a stupid typo

* refac Pio Arduino 3.0 setup

* updates ini's

* disable by default core 32 Arduino 3.0

* disable uDisplay for S3

* Update tasmota_configurations_ESP32.h

* fix s3 compile

* we need a new RMT LED driver for 5.1 for all SOC's

* Todo: port udl for S3

* turn on NeoPixel again, as it does not crash anymore

* first partly working version

* Arduino 3.0 pio config to ignore

* gitignore for override Arduino 3.0

* Delete platformio_tasmota_core3_env.ini

* Create platformio_tasmota_core3_env.ini

* Delete platformio_tasmota_core3_env.ini

* use more than pixel

* deactivate Addlog storm

* add platformio_tasmota_core3_env.ini to gitignore

---------

Co-authored-by: Christian Baars <[email protected]>
Co-authored-by: Christian Baars <[email protected]>
  • Loading branch information
3 people authored Aug 19, 2023
1 parent 996a1c2 commit 395d4d6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Esp32-hal-rmt.c

#include <Arduino.h>

extern void AddLog(uint32_t loglevel, PGM_P formatP, ...);
// extern void AddLog(uint32_t loglevel, PGM_P formatP, ...);

extern "C"
{
Expand All @@ -55,6 +55,8 @@ extern "C"
#include "esp_check.h"
}

#define RMT_LED_STRIP_RESOLUTION_HZ 10000000 // 10MHz resolution, 1 tick = 0.1us (led strip needs a high resolution)

typedef struct {
uint32_t resolution; /*!< Encoder resolution, in Hz */
} led_strip_encoder_config_t;
Expand Down Expand Up @@ -122,7 +124,7 @@ static esp_err_t rmt_led_strip_encoder_reset(rmt_encoder_t *encoder)
return ESP_OK;
}

esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder)
esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder/*, uint32_t bit0, uint32_t bit1*/)
{
const char* TAG = "TEST_RMT";
esp_err_t ret = ESP_OK;
Expand Down Expand Up @@ -161,7 +163,7 @@ esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rm
*ret_encoder = &led_encoder->base;
return ret;
err:
AddLog(2,"RMT:could not init led decoder");
// AddLog(2,"RMT:could not init led decoder");
if (led_encoder) {
if (led_encoder->bytes_encoder) {
rmt_del_encoder(led_encoder->bytes_encoder);
Expand Down Expand Up @@ -232,8 +234,8 @@ class NeoEsp32RmtSpeedWs2811 : public NeoEsp32RmtSpeedBase
class NeoEsp32RmtSpeedWs2812x : public NeoEsp32RmtSpeedBase
{
public:
const static DRAM_ATTR uint32_t RmtBit0 = Item32Val(400, 850);
const static DRAM_ATTR uint32_t RmtBit1 = Item32Val(800, 450);
const uint32_t RmtBit0 = Item32Val(400, 850);
const uint32_t RmtBit1 = Item32Val(800, 450);
const static DRAM_ATTR uint16_t RmtDurationReset = FromNs(300000); // 300us
};

Expand Down Expand Up @@ -512,9 +514,7 @@ template<typename T_SPEED, typename T_CHANNEL> class NeoEsp32RmtMethodBase

void Initialize()
{
#define RMT_LED_STRIP_RESOLUTION_HZ 10000000 // 10MHz resolution, 1 tick = 0.1us (led strip needs a high resolution)
esp_err_t ret = ESP_OK;
// rmt_channel_handle_t tx_chan = NULL;
rmt_tx_channel_config_t config = {};
config.clk_src = RMT_CLK_SRC_DEFAULT;
config.gpio_num = static_cast<gpio_num_t>(_pin);
Expand All @@ -534,24 +534,24 @@ template<typename T_SPEED, typename T_CHANNEL> class NeoEsp32RmtMethodBase

// ESP_LOGI(TAG, "Enable RMT TX channel");
ret += rmt_enable(_channel.RmtChannelNumber);
AddLog(2,"RMT:initialized with error code: %u on pin: %u",ret, _pin);
// AddLog(2,"RMT:initialized with error code: %u on pin: %u",ret, _pin);
}

void Update(bool maintainBufferConsistency)
{
AddLog(2,"..");
// AddLog(2,"..");
// wait for not actively sending data
// this will time out at 10 seconds, an arbitrarily long period of time
// and do nothing if this happens

if (ESP_OK == ESP_ERROR_CHECK_WITHOUT_ABORT(rmt_tx_wait_all_done(_channel.RmtChannelNumber, 10000 / portTICK_PERIOD_MS)))
{
AddLog(2,"__ %u", _sizeData);
// AddLog(2,"__ %u", _sizeData);
// now start the RMT transmit with the editing buffer before we swap
// const uint8_t pixels[3] = {100,100,100};
esp_err_t ret = rmt_transmit(_channel.RmtChannelNumber, _led_encoder, _dataEditing, 3, &_tx_config); // 3 for _sizeData
esp_err_t ret = rmt_transmit(_channel.RmtChannelNumber, _led_encoder, _dataEditing, _sizeData, &_tx_config); // 3 for _sizeData
// esp_err_t ret = rmt_transmit(_channel.RmtChannelNumber, _led_encoder, pixels, 3, &_tx_config);
AddLog(2,"rmt_transmit: %u", ret);
// AddLog(2,"rmt_transmit: %u", ret);
if (maintainBufferConsistency)
{
// copy editing to sending,
Expand Down Expand Up @@ -596,7 +596,7 @@ template<typename T_SPEED, typename T_CHANNEL> class NeoEsp32RmtMethodBase

void construct()
{
AddLog(2,"RMT:construct");
// AddLog(2,"RMT:construct");
_dataEditing = static_cast<uint8_t*>(malloc(_sizeData));
// data cleared later in Begin()

Expand Down

0 comments on commit 395d4d6

Please sign in to comment.