Skip to content

Commit

Permalink
Post merge
Browse files Browse the repository at this point in the history
AppEffects: 
- add 1D/2D to name (temporary)
- GEQ 2D rename check1/check2
- rename parameters to controls

UserModWLEDAudio
- default not ebabled
- use onOffChanged
  • Loading branch information
ewowi committed Aug 15, 2023
1 parent d0e848a commit 511cb23
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
22 changes: 11 additions & 11 deletions src/App/AppEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class RingEffect:public Effect {
class RingRandomFlow:public RingEffect {
public:
const char * name() {
return "RingRandomFlow";
return "RingRandomFlow 1D";
}
void setup() {}
void loop() {
Expand All @@ -490,7 +490,7 @@ class GEQEffect:public Effect {
byte previousBarHeight[1024];

const char * name() {
return "GEQ";
return "GEQ 2D";
}

void setup() {
Expand All @@ -512,8 +512,8 @@ class GEQEffect:public Effect {

uint8_t speed = mdl->getValue("speed");
uint8_t intensity = mdl->getValue("intensity");
bool check1 = mdl->getValue("check1");
bool check2 = mdl->getValue("check2");
bool colorBars = mdl->getValue("colorBars");
bool smoothBars = mdl->getValue("smoothBars");

bool rippleTime = false;
if (millis() - step >= (256U - intensity)) {
Expand Down Expand Up @@ -542,7 +542,7 @@ class GEQEffect:public Effect {
uint16_t bandHeight = fftResult[frBand]; // WLEDMM we use the original ffResult, to preserve accuracy

// WLEDMM begin - smooth out bars
if ((x > 0) && (x < (cols-1)) && (check2)) {
if ((x > 0) && (x < (cols-1)) && (smoothBars)) {
// get height of next (right side) bar
uint8_t nextband = (remaining < 1)? band +1: band;
nextband = constrain(nextband, 0, 15); // just to be sure
Expand All @@ -562,7 +562,7 @@ class GEQEffect:public Effect {

CRGB ledColor = CRGB::Black;
for (int y=0; y < barHeight; y++) {
if (check1) //color_vertical / color bars toggle
if (colorBars) //color_vertical / color bars toggle
colorIndex = map(y, 0, rows-1, 0, 255);

CRGBPalette16 palette = PartyColors_p;
Expand All @@ -579,11 +579,11 @@ class GEQEffect:public Effect {
}
}

bool parameters(JsonObject parentVar) {
bool controls(JsonObject parentVar) {
ui->initNumber(parentVar, "speed", 255, false);
ui->initNumber(parentVar, "intensity", 255, false);
ui->initCheckBox(parentVar, "check1", false, false);
ui->initCheckBox(parentVar, "check2", false, false);
ui->initCheckBox(parentVar, "colorBars", false, false); //
ui->initCheckBox(parentVar, "smoothBars", false, false);

// Nice an effect can register it's own DMX channel, but not a fan of repeating the range and type of the param

Expand All @@ -600,7 +600,7 @@ class AudioRings:public RingEffect {

public:
const char * name() {
return "AudioRings";
return "AudioRings 1D";
}
void setup() {}

Expand All @@ -614,7 +614,7 @@ class AudioRings:public RingEffect {


void loop() {
for (int i = 0; i < 7; i++) {
for (int i = 0; i < 7; i++) { // 7 rings

uint8_t val;
if(INWARD) {
Expand Down
8 changes: 4 additions & 4 deletions src/App/AppModLeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ class AppModLeds:public Module {
#endif

#ifdef USERMOD_E131
e131mod->addWatch(1, "bri", 256);
e131mod->addWatch(2, "fx", effects.size());
e131mod->patchChannel(1, "bri", 255); //should be 256??
e131mod->patchChannel(2, "fx", effects.size());
// //add these temporary to test remote changing of this values do not crash the system
// e131mod->addWatch(3, "projection", Projections::count);
// e131mod->addWatch(4, "ledFix", 5); //assuming 5!!!
// e131mod->patchChannel(3, "projection", Projections::count);
// e131mod->patchChannel(4, "ledFix", 5); //assuming 5!!!
#endif

print->print("%s %s %s\n", __PRETTY_FUNCTION__, name, success?"success":"failed");
Expand Down
19 changes: 13 additions & 6 deletions src/User/UserModWLEDAudio.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
@title StarMod
@file UserModExample.h
@date 20230730
@repo https://github.com/ewoudwijma/StarMod
@Authors https://github.com/ewoudwijma/StarMod/commits/main
@file UserModWLEDAudio.h
@date 20230810
@repo https://github.com/ewowi/StarMod
@Authors https://github.com/ewowi/StarMod/commits/main
@Copyright (c) 2023 Github StarMod Commit Authors
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
*/
Expand All @@ -21,6 +21,8 @@ class UserModWLEDAudio:public Module {
UserModWLEDAudio() :Module("WLED Audio Sync Receiver") {
print->print("%s %s\n", __PRETTY_FUNCTION__, name);

isEnabled = false; //default off

print->print("%s %s %s\n", __PRETTY_FUNCTION__, name, success?"success":"failed");
};

Expand All @@ -32,8 +34,13 @@ class UserModWLEDAudio:public Module {
print->print("%s %s %s\n", __PRETTY_FUNCTION__, name, success?"success":"failed");
}

void connected() {
sync.begin();
void onOffChanged() {
if (SysModModules::isConnected && isEnabled) {
print->print("%s %s\n", __PRETTY_FUNCTION__, name);
sync.begin();
} else {
// sync.end();???
}
}

void loop(){
Expand Down

0 comments on commit 511cb23

Please sign in to comment.