diff --git a/src/SmartStrip.cpp b/src/SmartStrip.cpp index ddce152..0716878 100644 --- a/src/SmartStrip.cpp +++ b/src/SmartStrip.cpp @@ -18,6 +18,20 @@ void SmartStrip::setGreen(int led) { leds[led].setRGB(0, 2, 0); FastLED.show(); + FastLED.show(); +} + +void SmartStrip::animateBottomToTop(int r, int g, int b) +{ + for (int i = 0; i <= 14; i++) + { + leds[i].setRGB(r, g, b); + FastLED.show(); + FastLED.show(); + delay(100); + } + FastLED.clear(true); + FastLED.show(); } void SmartStrip::progressBar(int min, int max, int val) @@ -25,5 +39,15 @@ void SmartStrip::progressBar(int min, int max, int val) // starts at 14 and goes down to 0 as steeping continues int level = map(val, min, max, 0, 14); - // TODO: only update strip when necessarry + if (level != lastLevel) + { + lastLevel = level; + // update strip + for (int i = 14; i >= level; i--) + { + leds[i].setRGB(0, 0, 1); + FastLED.show(); + FastLED.show(); + } + } } \ No newline at end of file diff --git a/src/SmartStrip.hpp b/src/SmartStrip.hpp index 4fd68e2..c8165e7 100644 --- a/src/SmartStrip.hpp +++ b/src/SmartStrip.hpp @@ -14,8 +14,11 @@ public: void setGreen(int led); + void animateBottomToTop(int r, int g, int b); + void progressBar(int min, int max, int val); private: CRGB leds[PIXELCOUNT]; // Define the array of leds + int lastLevel = -1; }; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 42f3cb4..331126a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -130,6 +130,10 @@ void loop() { smartDisplay.printWaitForRFIDScreen(); + smartStrip.setGreen(0); + smartStrip.setGreen(7); + smartStrip.setGreen(14); + // this blocks execution until a tag has been detected (5s timeout) String uid = smartRFID.readTag(5000); if (uid != "no_tag_detected" && uid != "") @@ -244,6 +248,7 @@ void loop() { teaTimer.endSteeping(); smartDisplay.printMsg("DONE"); + smartStrip.animateBottomToTop(0, 1, 0); delay(1000); state = State::REQUEST_FEEDBACK; break; @@ -258,6 +263,7 @@ void loop() else { smartDisplay.printMsg("DONE"); + smartStrip.animateBottomToTop(0, 1, 0); delay(1000); state = State::REQUEST_FEEDBACK; }