Rename global variables
This commit is contained in:
parent
9d01b42e32
commit
5292c43489
|
@ -7,7 +7,7 @@
|
||||||
#define PIN D1
|
#define PIN D1
|
||||||
#define NUMPIXELS 144
|
#define NUMPIXELS 144
|
||||||
|
|
||||||
uint16_t i=0,j=0,wait = 50;
|
uint16_t effectI=0,effectJ=0,wait = 50;
|
||||||
unsigned long lastCall = 0;
|
unsigned long lastCall = 0;
|
||||||
byte wPos = 0;
|
byte wPos = 0;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ bool onSetBrightness(const HomieRange& range, const String& value){
|
||||||
bool onSetEffect(const HomieRange& range, const String& value){
|
bool onSetEffect(const HomieRange& range, const String& value){
|
||||||
effect = value;
|
effect = value;
|
||||||
effect.toLowerCase();
|
effect.toLowerCase();
|
||||||
i=0,j=0,wait=50;
|
effectI=0,effectJ=0,wait=50;
|
||||||
stripNode.setProperty("effect").send(value);
|
stripNode.setProperty("effect").send(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,37 +137,37 @@ void loopHandler() {
|
||||||
if(wait + lastCall >= millis()){
|
if(wait + lastCall >= millis()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(j<256) {
|
if(effectJ<256) {
|
||||||
if(i<pixels.numPixels()) {
|
if(effectI<pixels.numPixels()) {
|
||||||
pixels.setPixelColor(i, wheel((i+j) & 255));
|
pixels.setPixelColor(effectI, wheel((effectI+effectJ) & 255));
|
||||||
i++;
|
effectI++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i=0;
|
effectI=0;
|
||||||
j++;
|
effectJ++;
|
||||||
}
|
}
|
||||||
pixels.show();
|
pixels.show();
|
||||||
lastCall = millis();
|
lastCall = millis();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
j=0;
|
effectJ=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (effect == "rainbowcycle") {
|
else if (effect == "rainbowcycle") {
|
||||||
if(j<256*5) {
|
if(effectJ<256*5) {
|
||||||
if(i<pixels.numPixels()) {
|
if(effectI<pixels.numPixels()) {
|
||||||
pixels.setPixelColor(i, wheel(((i * 256 / pixels.numPixels()) + j) & 255));
|
pixels.setPixelColor(effectI, wheel(((effectI * 256 / pixels.numPixels()) + effectJ) & 255));
|
||||||
i++;
|
effectI++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i=0;
|
effectI=0;
|
||||||
j++;
|
effectJ++;
|
||||||
}
|
}
|
||||||
pixels.show();
|
pixels.show();
|
||||||
lastCall = millis();
|
lastCall = millis();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
j=0;
|
effectJ=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue