Rename global variables

This commit is contained in:
Juergen Jung 2017-01-29 14:59:12 +01:00
parent 9d01b42e32
commit 5292c43489
1 changed files with 16 additions and 16 deletions

View File

@ -7,7 +7,7 @@
#define PIN D1
#define NUMPIXELS 144
uint16_t i=0,j=0,wait = 50;
uint16_t effectI=0,effectJ=0,wait = 50;
unsigned long lastCall = 0;
byte wPos = 0;
@ -63,7 +63,7 @@ bool onSetBrightness(const HomieRange& range, const String& value){
bool onSetEffect(const HomieRange& range, const String& value){
effect = value;
effect.toLowerCase();
i=0,j=0,wait=50;
effectI=0,effectJ=0,wait=50;
stripNode.setProperty("effect").send(value);
}
@ -137,37 +137,37 @@ void loopHandler() {
if(wait + lastCall >= millis()){
return;
}
if(j<256) {
if(i<pixels.numPixels()) {
pixels.setPixelColor(i, wheel((i+j) & 255));
i++;
if(effectJ<256) {
if(effectI<pixels.numPixels()) {
pixels.setPixelColor(effectI, wheel((effectI+effectJ) & 255));
effectI++;
}
else {
i=0;
j++;
effectI=0;
effectJ++;
}
pixels.show();
lastCall = millis();
}
else {
j=0;
effectJ=0;
}
}
else if (effect == "rainbowcycle") {
if(j<256*5) {
if(i<pixels.numPixels()) {
pixels.setPixelColor(i, wheel(((i * 256 / pixels.numPixels()) + j) & 255));
i++;
if(effectJ<256*5) {
if(effectI<pixels.numPixels()) {
pixels.setPixelColor(effectI, wheel(((effectI * 256 / pixels.numPixels()) + effectJ) & 255));
effectI++;
}
else {
i=0;
j++;
effectI=0;
effectJ++;
}
pixels.show();
lastCall = millis();
}
else {
j=0;
effectJ=0;
}
}
}