|
@@ -73,8 +73,17 @@ bool readSDFile() {
|
|
|
if (selector == "sound") {
|
|
|
String track = getSubstring(buf, ' ', 2) ;
|
|
|
String out = getSubstring(buf, ' ', 1) ;
|
|
|
- Serial.println("Playing track " + track + " to output " + out);
|
|
|
- tsunami.trackPlayPoly(track.toInt(), out.toInt()-1, true);
|
|
|
+ if (out == "stop") { tsunami.stopAllTracks(); Serial.println("Stopping all sounds");}
|
|
|
+ if (out == "fadeout") {
|
|
|
+ Serial.println("Fading all sounds") ;
|
|
|
+ for (int track ; track < 60 ; track++) {
|
|
|
+ tsunami.trackFade(track, 0, 500, 1) ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Serial.println("Playing track " + track + " to output " + out);
|
|
|
+ tsunami.trackPlayPoly(track.toInt(), out.toInt()-1, true);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
else if (selector == "led") {
|
|
@@ -85,6 +94,8 @@ bool readSDFile() {
|
|
|
String fadeTime = getSubstring(buf, ' ', 4);
|
|
|
Serial.println(getSubstring(buf, ' ', 2));
|
|
|
if (zone == "lustre"){
|
|
|
+ if (palette == "BEAT"){palette_BEAT = true; paletteBeatStart = millis();}
|
|
|
+ else { palette_BEAT = false ;}
|
|
|
if (palette == "MER"){lustre_targetPalette = palette_MER ;}
|
|
|
else if (palette == "SOLEIL"){lustre_targetPalette = palette_SOLEIL ;}
|
|
|
else if (palette == "CREPUSCULE"){lustre_targetPalette = palette_CREPUSCULE ;}
|
|
@@ -92,6 +103,17 @@ bool readSDFile() {
|
|
|
lustre_targetBrightness = bright.toInt();
|
|
|
lustre_stepBrightness = constrain( abs((lustre_targetBrightness - lustre_currentBrightness)) / (float)(fadeTime.toInt()/refreshRate), 1, 255) ;
|
|
|
if(lustre_currentBrightness > lustre_targetBrightness) { lustre_stepBrightness *= -1 ;}
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (zone == "table"){
|
|
|
+ if (palette == "MER"){table_targetPalette = palette_MER ;}
|
|
|
+ else if (palette == "SOLEIL"){table_targetPalette = palette_SOLEIL ;}
|
|
|
+ else if (palette == "CREPUSCULE"){table_targetPalette = palette_CREPUSCULE ;}
|
|
|
+ else if (palette == "FLAMINGO"){table_targetPalette = palette_FLAMINGO ;}
|
|
|
+ table_targetBrightness = bright.toInt();
|
|
|
+ table_stepBrightness = constrain( abs((table_targetBrightness - table_currentBrightness)) / (float)(fadeTime.toInt()/refreshRate), 1, 255) ;
|
|
|
+ if(table_currentBrightness > table_targetBrightness) { table_stepBrightness *= -1 ;}
|
|
|
+ }
|
|
|
Serial.print ("LEDS : zone ");
|
|
|
Serial.print (zone);
|
|
|
Serial.print (" - palette ");
|
|
@@ -102,29 +124,16 @@ bool readSDFile() {
|
|
|
Serial.print (fadeTime);
|
|
|
Serial.print (" - steps : ");
|
|
|
Serial.println (lustre_stepBrightness);
|
|
|
- }
|
|
|
-
|
|
|
-// if(
|
|
|
-// int R = getSubstring(buf, ' ', 2).toInt();
|
|
|
-// int G = getSubstring(buf, ' ', 3).toInt();
|
|
|
-// int B = getSubstring(buf, ' ', 4).toInt();
|
|
|
-// for (int i ; i<NUM_LEDS_LUSTRE ; i++) {
|
|
|
-// lustreLeds[i].setRGB(R, G, B) ;
|
|
|
-// }
|
|
|
+
|
|
|
|
|
|
- if (zone == "table"){
|
|
|
-// int R = getSubstring(buf, ' ', 2).toInt();
|
|
|
-// int G = getSubstring(buf, ' ', 3).toInt();
|
|
|
-// int B = getSubstring(buf, ' ', 4).toInt();
|
|
|
-// for (int i ; i<NUM_LEDS_TABLE ; i++) {
|
|
|
-// tableLeds[i].setRGB(R, G, B) ;
|
|
|
-// }
|
|
|
- }
|
|
|
//Serial.println("Led mode " + getSubstring(buf, ' ', 1));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
else if (selector == "dimmer") {
|
|
|
String dim_val = getSubstring(buf, ' ', 1);
|
|
|
+
|
|
|
int dimmer_value;
|
|
|
int dimmer_fade = getSubstring(buf, ' ', 2).toInt();
|
|
|
Serial.println("Dimmer fade à " + dim_val + " en " + dimmer_fade + "ms");
|