From e72595e73999e6c1fd78cc145747990ec3123369 Mon Sep 17 00:00:00 2001 From: hhau Date: Sat, 25 Nov 2023 15:35:58 +0100 Subject: [PATCH 1/8] chg: dev: added method Declarations for MultiColorLight --- example/example.ino | 2 +- src/Dezibot.cpp | 2 +- src/multiColorLight/MultiColorLight.cpp | 31 ++++++++ src/multiColorLight/MultiColorLight.h | 96 ++++++++++++++++++++++++- 4 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 src/multiColorLight/MultiColorLight.cpp diff --git a/example/example.ino b/example/example.ino index 8999e5a..de6830f 100644 --- a/example/example.ino +++ b/example/example.ino @@ -1,4 +1,4 @@ -#include + #include #define GPIO_LED 48 diff --git a/src/Dezibot.cpp b/src/Dezibot.cpp index 3285444..5440a38 100644 --- a/src/Dezibot.cpp +++ b/src/Dezibot.cpp @@ -54,7 +54,7 @@ void Dezibot::begin(void) { while (1) { /* Blink off (output low) */ - ledStrip.setPixelColor(1, ledStrip.Color(100, 100, 100)); + ledStrip.setPixelColor(1, ledStrip.Color(100, 0, 0)); ledStrip.show(); // Aktualisiere die Farbe des Pixels vTaskDelay(1000); /* Blink on (output high) */ diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp new file mode 100644 index 0000000..f7ee1f4 --- /dev/null +++ b/src/multiColorLight/MultiColorLight.cpp @@ -0,0 +1,31 @@ +#include "MultiColorLight.h" + +void MultiColorLight::begin(void){ + +}; + +void MultiColorLight::setLed(uint8_t index , uint32_t color){ + +}; + + +void MultiColorLight::setLed(leds leds, uint32_t color){ + +}; + + +void MultiColorLight::setTopLeds(uint32_t color){ + +}; + +void MultiColorLight::blink(uint16_t amount,uint32_t color, leds leds, uint32_t interval){ + +}; + +void MultiColorLight::turnOff(leds leds){ + +}; + +uint32_t MultiColorLight::color(uint8_t r, uint8_t g, uint8_t b){ + return 0; +}; \ No newline at end of file diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index 70ea391..9231d7b 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -1,6 +1,100 @@ +/** + * @file MultiColorLight.h + * @author Saskia Duebener, Hans Haupt + * @brief This component controls the ability to show multicolored light, using the RGB-LEDs + * @version 0.1 + * @date 2023-11-25 + * + * @copyright Copyright (c) 2023 + * + */ #ifndef MultiColorLight_h #define MultiColorLight_h -class MultiColorLight{ +#include +/** + * @brief Describes combinations of leds on the Dezibot. + * With the Robot in Front of you, if you can read the Dezibotlogo, the LED left from the Logo is TOP_LEFT + * + */ +enum leds{ + TOP_LEFT, + TOP_RIGHT, + BOTTOM, + TOP, + ALL }; + +class MultiColorLight{ +public: + + /** + * @brief initialize the multicolor component + * + */ + void begin(void); + + /** + * @brief Set the specified led to the passed color + * @param index ranging from 0-2, 0: Left, 1: Right, 2: Bottom + * @param color A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. Each color can range between 0 to 100 + */ + void setLed(uint8_t index , uint32_t color); + + /** + * @brief Set the specified leds to the passed color value + * + * @param leds which leds should be updated + * @param color A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. Each color can range between 0 to 100 + */ + void setLed(leds leds, uint32_t color); + + /** + * @brief sets the two leds on the top of the robot to the specified color + * + * @param color A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. Each color can range between 0 to 100 + */ + void setTopLeds(uint32_t color); + + /** + * @brief Let LEDs blink, returns after all blinks were executed + * + * @param amount how often should the leds blink + * @param color A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. + * Each color can range between 0 to 100 + * Defaults to blue + * @param leds which LEDs should blink, default is TOP + * @param interval how many miliseconds the led is on, defaults to 1s + */ + void blink(uint16_t amount,uint32_t color = 0x00006400,leds leds=TOP, uint32_t interval=1000); + + /** + * @brief turn off the given leds + * + * @param leds which leds should be turned off, defaults to ALL + */ + void turnOff(leds leds=ALL); + + /** + * @brief wrapper to calulate the used colorformat from a rgb-value + * + * @param r red (0-100) + * @param g green (0-100) + * @param b blue (0-100) + * @return A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. + */ + uint32_t color(uint8_t r, uint8_t g, uint8_t b); + +}; + #endif //MultiColorLight_h \ No newline at end of file From 1b330e15206287ab7872e83608673643245c9497 Mon Sep 17 00:00:00 2001 From: hhau Date: Sun, 26 Nov 2023 11:28:17 +0100 Subject: [PATCH 2/8] chg: dev: first version of multiColorLight implemeted --- example/example.ino | 11 +-- src/Dezibot.cpp | 90 ++++--------------------- src/Dezibot.h | 1 + src/multiColorLight/MultiColorLight.cpp | 78 +++++++++++++++++++-- src/multiColorLight/MultiColorLight.h | 22 +++++- 5 files changed, 115 insertions(+), 87 deletions(-) diff --git a/example/example.ino b/example/example.ino index de6830f..7076d96 100644 --- a/example/example.ino +++ b/example/example.ino @@ -1,13 +1,16 @@ - #include -#define GPIO_LED 48 - Dezibot dezibot = Dezibot(); - +const uint8_t MYFOO = 10; void setup() { dezibot.begin(); + } void loop() { +dezibot.multiColorLight.setLed(TOP_LEFT,0x000000FF); +dezibot.multiColorLight.setLed(TOP_RIGHT,dezibot.multiColorLight.color(0,100,0)); +dezibot.multiColorLight.blink(10,0x00FF0000,BOTTOM,500); + +delay(1000); } diff --git a/src/Dezibot.cpp b/src/Dezibot.cpp index 5440a38..dc1dcb7 100644 --- a/src/Dezibot.cpp +++ b/src/Dezibot.cpp @@ -1,82 +1,20 @@ -// -// Created by Anton Jacker on 24.11.23. -// +/** + * @file Dezibot.cpp + * @author Anton Jacker, Hans Haupt, Saskia Duebener + * @brief + * @version 0.1 + * @date 2023-11-26 + * + * @copyright Copyright (c) 2023 + * + */ #include "Dezibot.h" -#include -#include -#include -#include +Dezibot::Dezibot():multiColorLight(){ -#define SCREEN_WIDTH 128 // OLED display width, in pixels -#define SCREEN_HEIGHT 64 // OLED display height, in pixels - -// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) -// The pins for I2C are defined by the Wire-library. -// On an arduino UNO: A4(SDA), A5(SCL) -// On an arduino MEGA 2560: 20(SDA), 21(SCL) -// On an arduino LEONARDO: 2(SDA), 3(SCL), ... -#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) -#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 - -Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); - -#define GPIO_LED 48 - +}; void Dezibot::begin(void) { - Adafruit_NeoPixel ledStrip = Adafruit_NeoPixel(3, GPIO_LED, NEO_GRB + NEO_KHZ800); - Wire.begin(1, 2); - if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { - Serial.println("SSD1306 allocation failed"); - for (;;); // Don't proceed, loop forever - } - - display.display(); - vTaskDelay(2000); - display.clearDisplay(); - vTaskDelay(2000); - - // Draw a single pixel in white - display.drawPixel(10, 10, SSD1306_WHITE); - - // Show the display buffer on the screen. You MUST call display() after - // drawing commands to make them visible on screen! - display.display(); - vTaskDelay(2000); - - Serial.begin(9600); - Serial.println("start"); - - - vTaskDelay(1000); - - while (1) { - /* Blink off (output low) */ - ledStrip.setPixelColor(1, ledStrip.Color(100, 0, 0)); - ledStrip.show(); // Aktualisiere die Farbe des Pixels - vTaskDelay(1000); - /* Blink on (output high) */ - ledStrip.setPixelColor(1, ledStrip.Color(0, 0, 0)); - ledStrip.show(); // Aktualisiere die Farbe des Pixels - vTaskDelay(1000); - - struct timeval tv_now; - gettimeofday(&tv_now, NULL); - int64_t time_us = (int64_t) tv_now.tv_sec * 1000000L + (int64_t) tv_now.tv_usec; - - - Serial.println(time_us); - - display.clearDisplay(); - - display.setTextSize(2); // Draw 2X-scale text - display.setTextColor(SSD1306_WHITE); - display.setCursor(10, 0); - display.println(F("scroll")); - display.display(); // Show initial text - vTaskDelay(1000); - - } -} \ No newline at end of file + multiColorLight.begin(); +}; diff --git a/src/Dezibot.h b/src/Dezibot.h index 07fe014..50fcca6 100644 --- a/src/Dezibot.h +++ b/src/Dezibot.h @@ -21,6 +21,7 @@ class Dezibot { protected: public: + Dezibot(); Motion motion; LightDetection lightDetection; ColorDetection colorDetection; diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index f7ee1f4..1b215cd 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -1,31 +1,97 @@ #include "MultiColorLight.h" -void MultiColorLight::begin(void){ +MultiColorLight::MultiColorLight():rgbLeds(ledAmount,ledPin){ }; -void MultiColorLight::setLed(uint8_t index , uint32_t color){ +void MultiColorLight::begin(void){ + rgbLeds.begin(); +}; +void MultiColorLight::setLed(uint8_t index , uint32_t color){ + if (index > ledAmount-1){ + //TODO: logging + } + rgbLeds.setPixelColor(index, normalizeColor(color)); + rgbLeds.show(); }; void MultiColorLight::setLed(leds leds, uint32_t color){ + switch (leds){ + case TOP_LEFT: + MultiColorLight::setLed(0,color);break; + case TOP_RIGHT: + MultiColorLight::setLed(1,color);break; + case BOTTOM: + MultiColorLight::setLed(2,color);break; + case TOP: + for (int index = 0; index<2; index++){ + MultiColorLight::setLed(index,color); + }break; + case ALL: + for (int index = 0; index<3; index++){ + MultiColorLight::setLed(index,color); + }break; + default: + //TODO logging + break; + } }; void MultiColorLight::setTopLeds(uint32_t color){ - + MultiColorLight::setLed(TOP,color); }; void MultiColorLight::blink(uint16_t amount,uint32_t color, leds leds, uint32_t interval){ + for(uint16_t index = 0; index < amount;index++){ + MultiColorLight::setLed(leds, color); + vTaskDelay(interval); + MultiColorLight::turnOff(leds); + vTaskDelay(interval); + } }; void MultiColorLight::turnOff(leds leds){ - + switch (leds){ + case TOP_LEFT: + MultiColorLight::setLed(0,0);break; + case TOP_RIGHT: + MultiColorLight::setLed(1,0);break; + case BOTTOM: + MultiColorLight::setLed(2,0);break; + case TOP: + for (int index = 0; index<2; index++){ + MultiColorLight::setLed(index,0); + }break; + case ALL: + rgbLeds.clear();break; + default: + //TODO logging + break; + } }; uint32_t MultiColorLight::color(uint8_t r, uint8_t g, uint8_t b){ - return 0; -}; \ No newline at end of file + return rgbLeds.Color(r,g,b); +}; + +//PRIVATE +uint32_t MultiColorLight::normalizeColor(uint32_t color,uint8_t maxBrightness){ + uint8_t red = (color&0x00FF0000)>>16; + uint8_t green = (color&0x0000FF00)>>8; + uint8_t blue = (color&0x000000FF); + if (red > maxBrightness){ + red = maxBrightness; + } + if(green > maxBrightness){ + green = maxBrightness; + } + if(blue > maxBrightness){ + blue = maxBrightness; + } + return MultiColorLight::color(red,green,blue); +} \ No newline at end of file diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index 9231d7b..abe3622 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -26,8 +26,14 @@ enum leds{ }; class MultiColorLight{ +protected: + static const uint16_t ledAmount = 3; + static const int16_t ledPin = 48; + static const uint8_t maxBrightness = 100; + Adafruit_NeoPixel rgbLeds; public: + MultiColorLight(); /** * @brief initialize the multicolor component * @@ -94,7 +100,21 @@ public: * component, and BB is the blue component. */ uint32_t color(uint8_t r, uint8_t g, uint8_t b); - + +private: + /** + * @brief normalizes every component of color to not exeed the maxBrightness + * + * @param color A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. + * @param maxBrigthness maximal level of brightness that is allowed for each color + * @return uint32_t A 32-bit unsigned integer representing the color in the format + * 0x00RRGGBB, where RR is the red component, GG is the green + * component, and BB is the blue component. Where each component can be + * between 0 - maxBrightness + */ + uint32_t normalizeColor(uint32_t color, uint8_t maxBrigthness=maxBrightness); }; #endif //MultiColorLight_h \ No newline at end of file From 4546330c15cc61440876ababdd7ded100db40e40 Mon Sep 17 00:00:00 2001 From: hhau Date: Sun, 26 Nov 2023 11:34:24 +0100 Subject: [PATCH 3/8] fix: dev: bug int turnOff(ALL) fixed --- example/example.ino | 2 ++ src/multiColorLight/MultiColorLight.cpp | 4 +++- src/multiColorLight/MultiColorLight.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/example.ino b/example/example.ino index 7076d96..f055251 100644 --- a/example/example.ino +++ b/example/example.ino @@ -12,5 +12,7 @@ dezibot.multiColorLight.setLed(TOP_LEFT,0x000000FF); dezibot.multiColorLight.setLed(TOP_RIGHT,dezibot.multiColorLight.color(0,100,0)); dezibot.multiColorLight.blink(10,0x00FF0000,BOTTOM,500); +delay(1000); +dezibot.multiColorLight.turnOff(ALL); delay(1000); } diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index 1b215cd..8439256 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -68,7 +68,9 @@ void MultiColorLight::turnOff(leds leds){ MultiColorLight::setLed(index,0); }break; case ALL: - rgbLeds.clear();break; + for (int index = 0; index<3; index++){ + MultiColorLight::setLed(index,0); + }break; default: //TODO logging break; diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index abe3622..6a8580d 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -2,7 +2,7 @@ * @file MultiColorLight.h * @author Saskia Duebener, Hans Haupt * @brief This component controls the ability to show multicolored light, using the RGB-LEDs - * @version 0.1 + * @version 0.2 * @date 2023-11-25 * * @copyright Copyright (c) 2023 From 11ac0494d537c7fe1f436a6a5cba502a20578ba0 Mon Sep 17 00:00:00 2001 From: hhau Date: Tue, 5 Dec 2023 23:59:39 +0100 Subject: [PATCH 4/8] chg: dev: added colorconstants --- src/multiColorLight/ColorConstants.h | 9 +++++++++ src/multiColorLight/MultiColorLight.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/multiColorLight/ColorConstants.h diff --git a/src/multiColorLight/ColorConstants.h b/src/multiColorLight/ColorConstants.h new file mode 100644 index 0000000..f180f5e --- /dev/null +++ b/src/multiColorLight/ColorConstants.h @@ -0,0 +1,9 @@ +static const uint32_t RED = 0xFF0000; +static const uint32_t GREEN = 0x00FF00; +static const uint32_t BLUE = 0x0000FF; +static const uint32_t WHITE = 0xFFFFFF; +static const uint32_t ORANGE = 0x961E00; +static const uint32_t YELLOW = 0x965000; +static const uint32_t TURQUOISE = 0x005064; +static const uint32_t PURPEL = 0x320064; +static const uint32_t PINK = 0x960064; diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index 6a8580d..ecfcadb 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -11,7 +11,7 @@ #ifndef MultiColorLight_h #define MultiColorLight_h #include - +#include "ColorConstants.h" /** * @brief Describes combinations of leds on the Dezibot. * With the Robot in Front of you, if you can read the Dezibotlogo, the LED left from the Logo is TOP_LEFT From 4be496759f7b3c7fdd1eddb4981672ca6e54fb57 Mon Sep 17 00:00:00 2001 From: hhau Date: Wed, 6 Dec 2023 00:02:09 +0100 Subject: [PATCH 5/8] fix: dev: switched left and right leds --- src/multiColorLight/MultiColorLight.cpp | 6 +++++- src/multiColorLight/MultiColorLight.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index 8439256..02adaa2 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -20,6 +20,8 @@ void MultiColorLight::setLed(uint8_t index , uint32_t color){ void MultiColorLight::setLed(leds leds, uint32_t color){ switch (leds){ case TOP_LEFT: + MultiColorLight::setLed(1,color);break; + case TOP_RIGHT: MultiColorLight::setLed(0,color);break; case TOP_RIGHT: MultiColorLight::setLed(1,color);break; @@ -30,7 +32,7 @@ void MultiColorLight::setLed(leds leds, uint32_t color){ MultiColorLight::setLed(index,color); }break; case ALL: - for (int index = 0; index<3; index++){ + for (int index = 0; index Date: Wed, 6 Dec 2023 00:04:16 +0100 Subject: [PATCH 6/8] fix: dev: implemented different maxBrightness for the different colors --- src/multiColorLight/MultiColorLight.cpp | 8 ++++---- src/multiColorLight/MultiColorLight.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index 02adaa2..985b35a 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -93,11 +93,11 @@ uint32_t MultiColorLight::normalizeColor(uint32_t color,uint8_t maxBrightness){ if (red > maxBrightness){ red = maxBrightness; } - if(green > maxBrightness){ - green = maxBrightness; + if(green > maxBrightness-70){ + green = maxBrightness-70; } - if(blue > maxBrightness){ - blue = maxBrightness; + if(blue > maxBrightness-50){ + blue = maxBrightness-50; } return MultiColorLight::color(red,green,blue); } \ No newline at end of file diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index f611d7a..52ee75d 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -29,7 +29,7 @@ class MultiColorLight{ protected: static const uint16_t ledAmount = 3; static const int16_t ledPin = 48; - static const uint8_t maxBrightness = 100; + static const uint8_t maxBrightness = 150; Adafruit_NeoPixel rgbLeds; public: From b12e07539b801649f206a7a35b33e8988b0f4b75 Mon Sep 17 00:00:00 2001 From: hhau Date: Wed, 6 Dec 2023 00:06:10 +0100 Subject: [PATCH 7/8] chg: dev: add wrapper for setLED that takes three color arguments --- src/multiColorLight/MultiColorLight.cpp | 8 ++++++++ src/multiColorLight/MultiColorLight.h | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index 985b35a..f8d3a4d 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -42,11 +42,19 @@ void MultiColorLight::setLed(leds leds, uint32_t color){ }; +void MultiColorLight::setLed(leds leds, uint8_t red, uint8_t green, uint8_t blue){ + MultiColorLight::setLed(leds, MultiColorLight::color(red,green,blue)); +}; + void MultiColorLight::setTopLeds(uint32_t color){ MultiColorLight::setLed(TOP,color); }; +void MultiColorLight::setTopLeds(uint8_t red, uint8_t green, uint8_t blue){ + MultiColorLight::setTopLeds(MultiColorLight::color(red,green,blue)); +}; + void MultiColorLight::blink(uint16_t amount,uint32_t color, leds leds, uint32_t interval){ for(uint16_t index = 0; index < amount;index++){ MultiColorLight::setLed(leds, color); diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index 52ee75d..ce9ba5c 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -59,6 +59,16 @@ public: */ void setLed(leds leds, uint32_t color); + /** + * @brief Set the specified leds to the passed color value + * + * @param leds which leds should be updated + * @param red brightness of red, is normalized in the function + * @param green brightness of green, is normalized in the function + * @param blue brightness of blue, is normalized in the function + */ + void setLed(leds leds, uint8_t red, uint8_t green, uint8_t blue); + /** * @brief sets the two leds on the top of the robot to the specified color * @@ -68,6 +78,15 @@ public: */ void setTopLeds(uint32_t color); + /** + * @brief sets the two leds on the top of the robot to the specified color + * + * @param red brightness of red, is normalized in the function + * @param green brightness of green, is normalized in the function + * @param blue brightness of blue, is normalized in the function + */ + void setTopLeds(uint8_t red, uint8_t green, uint8_t blue); + /** * @brief Let LEDs blink, returns after all blinks were executed * From 31f4a2b2816087ab3cb0c9c21c671e3d3c7e6dde Mon Sep 17 00:00:00 2001 From: hhau Date: Wed, 6 Dec 2023 00:08:55 +0100 Subject: [PATCH 8/8] fix: dev: equalized naming of functions in MultiColorLight --- src/multiColorLight/MultiColorLight.cpp | 8 ++------ src/multiColorLight/MultiColorLight.h | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/multiColorLight/MultiColorLight.cpp b/src/multiColorLight/MultiColorLight.cpp index f8d3a4d..f0235a4 100644 --- a/src/multiColorLight/MultiColorLight.cpp +++ b/src/multiColorLight/MultiColorLight.cpp @@ -23,8 +23,6 @@ void MultiColorLight::setLed(leds leds, uint32_t color){ MultiColorLight::setLed(1,color);break; case TOP_RIGHT: MultiColorLight::setLed(0,color);break; - case TOP_RIGHT: - MultiColorLight::setLed(1,color);break; case BOTTOM: MultiColorLight::setLed(2,color);break; case TOP: @@ -59,20 +57,18 @@ void MultiColorLight::blink(uint16_t amount,uint32_t color, leds leds, uint32_t for(uint16_t index = 0; index < amount;index++){ MultiColorLight::setLed(leds, color); vTaskDelay(interval); - MultiColorLight::turnOff(leds); + MultiColorLight::turnOffLed(leds); vTaskDelay(interval); } }; -void MultiColorLight::turnOff(leds leds){ +void MultiColorLight::turnOffLed(leds leds){ switch (leds){ case TOP_LEFT: MultiColorLight::setLed(1,0);break; case TOP_RIGHT: MultiColorLight::setLed(0,0);break; - case TOP_RIGHT: - MultiColorLight::setLed(1,0);break; case BOTTOM: MultiColorLight::setLed(2,0);break; case TOP: diff --git a/src/multiColorLight/MultiColorLight.h b/src/multiColorLight/MultiColorLight.h index ce9ba5c..44498cf 100644 --- a/src/multiColorLight/MultiColorLight.h +++ b/src/multiColorLight/MultiColorLight.h @@ -58,7 +58,7 @@ public: * component, and BB is the blue component. Each color can range between 0 to 100 */ void setLed(leds leds, uint32_t color); - + /** * @brief Set the specified leds to the passed color value * @@ -77,7 +77,7 @@ public: * component, and BB is the blue component. Each color can range between 0 to 100 */ void setTopLeds(uint32_t color); - + /** * @brief sets the two leds on the top of the robot to the specified color * @@ -106,7 +106,7 @@ public: * * @param leds which leds should be turned off, defaults to ALL */ - void turnOff(leds leds=ALL); + void turnOffLed(leds leds=ALL); /** * @brief wrapper to calulate the used colorformat from a rgb-value