Removed backups. Warning: setPixel has changed, now default from Adafruit. TODO!

This commit is contained in:
starcalc 2017-03-01 21:45:15 +01:00
parent 498a689e1e
commit b84d21ff83
1 changed files with 1 additions and 145 deletions

View File

@ -194,152 +194,10 @@ void loop() {
ArduinoOTA.handle();
}
// Diese Effekte müssen nach dem Umbau wieder vorhanden sein:
/*
case EFFECT_SPIRAL:
led_spiral();
break;
case EFFECT_RANDOMFADE:
led_randomfade();
break;
case EFFECT_CHASE:
led_chase();
break;
*/
/************ Old stuff ************/
/*
int fadespeedmax = 5; //1 to 255
void led_random()
{
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, wheel(random(0, 255)));
}
strip.show();
}
void led_radar()
{
// "Sweep" in cirles...
// line(0,0,950*cos(radians(iAngle)),-950*sin(radians(iAngle)));
}
void led_spiral()
{
int every = 4;
wheelPos++;
int qp = Index % every;
Index++;
if (Index >= strip.numPixels() - 1) {
Index = 0;
}
int q = Index % every;
for (uint16_t i = 0; i < strip.numPixels(); i = i + every) {
strip.setPixelColor(numToSpiralPos(i + q), wheel( (i + Index * 4) % 255)); //turn every "every" pixel on
}
for (uint16_t i = 0; i < strip.numPixels(); i = i + every) {
strip.setPixelColor(numToSpiralPos(i + qp), 0); //turn every "every" pixel off
}
strip.show();
}
bool effectHandler(const HomieRange& range, const String& value) {
Homie.getLogger() << "-> " << value << endl;
int sep = value.indexOf("|");
String command = value.substring(0, sep);
String parameters = value.substring(sep + 1);
Homie.getLogger() << "command=" << command << " parameters=" << parameters << endl;
if (command.equals("fill")) {
effect = EFFECT_NONE;
led_fill(parseColor(parameters));
} else if (command.equals("off")) {
effect = EFFECT_NONE;
led_fill(strip.Color(0, 0, 0));
} else if (command.equals("random")) {
effect = EFFECT_NONE;
led_random();
} else if (command.equals("set")) { //example: set|37#ff003a
effect = EFFECT_NONE;
int x = parameters.substring(0, 1).toInt();
int y = parameters.substring(1, 2).toInt();
String cstr = parameters.substring(2, 9);
strip.setPixelColor(xyToPos(x, y), parseColor(cstr));
strip.show();
} else if (command.equals("smooth")) { //example: smooth|[wheelspeed]|[smoothing]|[strength] wheelspeed=1-255, smoothing=0-100, strength=1-255
int sepparam = parameters.indexOf("|");
int p1 = parameters.substring(0, sepparam).toInt();
String parameters_part2 = parameters.substring(sepparam + 1);
sepparam = parameters_part2.indexOf("|");
int p2 = parameters_part2.substring(0, sepparam).toInt();
int p3 = parameters_part2.substring(sepparam + 1).toInt();
wheelSpeed = 16; //default, speed=+1 /frame
if (p1 > 0) {
wheelSpeed = p1;
}
smoothing = 80;
if (p2 > 0) {
smoothing = p2;
}
strength = 50;
if (p3 > 0) {
strength = p3;
}
Homie.getLogger() << "-- p1=" << p1 << " p2=" << p2 << " p3=" << p3 << endl;
effect = EFFECT_SMOOTH;
bufferClear();
showBuffer();
strip.show();
} else if (command.equals("spiral")) {
effect = EFFECT_SPIRAL;
Index = 0;
bufferClear();
showBuffer();
strip.show();
} else if (command.equals("clearbuffer")) {
bufferClear();
showBuffer();
strip.show();
} else if (command.equals("randomfade")) { //example: randomfade|5
int sepparam = parameters.indexOf("|");
int p1 = parameters.substring(0, sepparam).toInt();
fadespeedmax = 5;
if (p1 > 0) {
fadespeedmax = p1;
}
effect = EFFECT_RANDOMFADE;
set_randomBuffer(); //initialize random
} else if (command.equals("randombuffer")) {
set_randomBuffer(); //set random
showBuffer();
} else if (command.equals("chase")) {
effect = EFFECT_CHASE;
bufferClear();
showBuffer();
strip.show();
} else if (command.equals("radar")) {
effect = EFFECT_RADAR;
Index = 0;
bufferClear();
showBuffer();
strip.show();
} else if (command.equals("larson")) {
effect = EFFECT_LARSON;
Index = 0;
bufferClear();
showBuffer();
strip.show();
}
return true;
}
bool pixelsHandler(const HomieRange& range, const String& value) {
bool pixelsHandler(const HomieRange& range, const String& value) {
String remaining = value;
int i = 0;
@ -365,6 +223,4 @@ void loop() {
return true;
}
*/