Skip to content

Commit

Permalink
Live fixture colorOrder (WIP), Virtual driver refactor
Browse files Browse the repository at this point in the history
Live Fixtures
- add colorOrder

pio.ini
- go back to earlier virtual driver

LedModFixture
- add colorOrder
- driver.iniLed: check driverInit
  • Loading branch information
ewowi committed Dec 12, 2024
1 parent 1511996 commit 27af99c
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions misc/LiveScripts/F_Cube202020.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ int pins[6] = {32,33,25,26,27,14}; //STARLIGHT_CLOCKLESS_LED_DRIVER on esp32-wro
void main()
{
ledSize = 2; //smaller leds (default 5)
colorOrder = 1; //RGB (not for FastLED yet: see pio.ini)

for (int z=0; z<depth;z++) {

Expand Down
2 changes: 2 additions & 0 deletions misc/LiveScripts/F_panel080-048.sc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void mapLed(uint16_t pos) {

void main() {

colorOrder = 3; //GRB (not for FastLED yet: see pio.ini)

//virtual driver settings
clockPin = 3; //3 for S3, 26 for ESP32 (wrover)
latchPin = 46; //46 for S3, 27 for ESP32 (wrover)
Expand Down
2 changes: 2 additions & 0 deletions misc/LiveScripts/F_panel128-096.sc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void mapLed(uint16_t pos) {

void main() {

colorOrder = 3; //GRB (not for FastLED yet: see pio.ini)

//virtual driver settings
clockPin = 3; //3 for S3, 26 for ESP32 (wrover)
latchPin = 46; //46 for S3, 27 for ESP32 (wrover)
Expand Down
4 changes: 3 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ build_flags =
-D NBIS2SERIALPINS=6 ;nr of shift registers (6 * 8 * 256 = 12288) I2SClocklessVirtualLedDriver variable!

lib_deps =
https://github.com/ewowi/I2SClocklessVirtualLedDriver#5dc060a ; int2 ;ewowi repo adds some proposed PR's and makes sure we don't have unexpected updates
https://github.com/ewowi/I2SClocklessVirtualLedDriver#c305662 ; integration 24-11-24 8:30PM;ewowi repo adds some proposed PR's and makes sure we don't have unexpected updates
; https://github.com/ewowi/I2SClocklessVirtualLedDriver#0048bcf ; experimental ... integration 25-11-24 8:54PM;ewowi repo adds some proposed PR's and makes sure we don't have unexpected updates
; https://github.com/ewowi/I2SClocklessVirtualLedDriver#5dc060a ; int2 ;ewowi repo adds some proposed PR's and makes sure we don't have unexpected updates

[STARLIGHT_HUB75_DRIVER]
build_flags =
Expand Down
3 changes: 3 additions & 0 deletions src/App/LedLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ class LedsLayer {
}
}

void drawLine3D(Coord3D a, Coord3D b, CRGB color, bool soft = false, uint8_t depth = UINT8_MAX) {
drawLine3D(a.x, a.y, a.z, b.x, b.y, b.z, color, soft, depth);
}
//to do: merge with drawLine to support 2D and 3D
void drawLine3D(int x1, int y1, int z1, int x2, int y2, int z2, CRGB color, bool soft = false, uint8_t depth = UINT8_MAX)
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/LedModEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ inline uint16_t getRGBWsize(uint16_t nleds){
effects.push_back(new DNAEffect);
effects.push_back(new DripEffect);
effects.push_back(new FireEffect);
effects.push_back(new FireworksEffect);
effects.push_back(new FlowEffect);
effects.push_back(new FrizzlesEffect);
effects.push_back(new GameOfLifeEffect); //2D & 3D
Expand Down Expand Up @@ -84,7 +85,6 @@ inline uint16_t getRGBWsize(uint16_t nleds){
effects.push_back(new LaserGEQEffect);
effects.push_back(new NoiseMeterEffect);
effects.push_back(new PaintbrushEffect);
effects.push_back(new FireworksEffect);
effects.push_back(new VUMeterEffect);
effects.push_back(new WaverlyEffect);
#endif
Expand Down
17 changes: 14 additions & 3 deletions src/App/LedModFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@
liveM->addExternalFun("void", "addPixelsPost", "()", (void *)_addPixelsPost);

liveM->addExternalVal("uint16_t", "mapResult", &mapResult); //for STARLIGHT_LIVE_MAPPING but script with this can also run when live mapping is disabled
liveM->addExternalVal("uint8_t", "colorOrder", &fix->colorOrder);
liveM->addExternalVal("uint8_t", "ledFactor", &fix->ledFactor);
liveM->addExternalVal("uint8_t", "ledSize", &fix->ledSize);
liveM->addExternalVal("uint8_t", "ledShape", &fix->ledShape);
Expand Down Expand Up @@ -808,7 +809,7 @@ void LedModFixture::addPixelsPost() {
driver.initled((uint8_t*) ledsP, pins, nb_pins, lengths[0]); //s3 doesn't support lengths so we pick the first
//void initled( uint8_t * leds, int * pins, int numstrip, int NUM_LED_PER_STRIP)
#else
driver.initled((uint8_t*) ledsP, pins, lengths, nb_pins, ORDER_GRB);
driver.initled((uint8_t*) ledsP, pins, lengths, nb_pins, (colorarrangment)colorOrder);
#if STARLIGHT_LIVE_MAPPING
driver.setMapLed(&mapLed);
#endif
Expand Down Expand Up @@ -862,10 +863,20 @@ void LedModFixture::addPixelsPost() {
pinsM->allocatePin(latchPin, "Leds", "Latch");

#if CONFIG_IDF_TARGET_ESP32S3
driver.initled(ledsP, pins, clockPin, latchPin, clockFreq==10?clock_1000KHZ:clockFreq==11?clock_1111KHZ:clockFreq==12?clock_1123KHZ:clock_800KHZ);
if (driver.driverInit) {
driver._clockspeed = clockFreq==10?clock_1000KHZ:clockFreq==11?clock_1111KHZ:clockFreq==12?clock_1123KHZ:clock_800KHZ;
driver.setPins(pins, clockPin, latchPin);
} else
driver.initled(ledsP, pins, clockPin, latchPin, clockFreq==10?clock_1000KHZ:clockFreq==11?clock_1111KHZ:clockFreq==12?clock_1123KHZ:clock_800KHZ);
#else
driver.initled(ledsP, pins, clockPin, latchPin);
if (driver.driverInit) {
driver.setPins(pins, clockPin, latchPin);
} else
driver.initled(ledsP, pins, clockPin, latchPin);
#endif

// driver.setColorOrderPerStrip(0, (colorarrangment)colorOrder); //to be implemented...

// driver.enableShowPixelsOnCore(1);
#if STARLIGHT_LIVE_MAPPING
driver.setMapLed(&mapLed);
Expand Down
7 changes: 7 additions & 0 deletions src/App/LedModFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,24 @@ class LedModFixture: public SysModule {

Coord3D fixSize = {8,8,1};
uint16_t nrOfLeds = 64; //amount of physical leds

//Fixture definition
uint8_t ledFactor = 1;
uint8_t ledSize = 4; //mm
uint8_t ledShape = 0; //0 = sphere, 1 = TetrahedronGeometry

//clockless driver (check FastLED support...)
uint8_t colorOrder = 3; //GRB is default for WS2812 (not for FastLED yet: see pio.ini)

//for virtual driver (but keep enabled to avoid compile errors when used in non virtual context
uint8_t clockPin = 3; //3 for S3, 26 for ESP32 (wrover)
uint8_t latchPin = 46; //46 for S3, 27 for ESP32 (wrover)
uint8_t clockFreq = 10; //clockFreq==10?clock_1000KHZ:clockFreq==11?clock_1111KHZ:clockFreq==12?clock_1123KHZ:clock_800KHZ
// 1.0MHz is default and runs well (0.8MHz is normal non overclocking). higher then 1.0 is causing flickering at least at ewowi big screen
uint8_t dmaBuffer = 30; //not used yet

//End Fixture definition

unsigned long lastMappingMillis = 0;
uint8_t viewRotation = 0;
uint8_t bri = 10;
Expand Down

0 comments on commit 27af99c

Please sign in to comment.