From 22df0098079630fac69f790872adb04bfa64ac04 Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Tue, 4 Jun 2019 21:43:09 +0200 Subject: [PATCH] Added color Yellow. --- src/SevenSegmentClock.cpp | 4 +++- src/SevenSegmentClock.h | 4 ++-- src/main.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/SevenSegmentClock.cpp b/src/SevenSegmentClock.cpp index b3e2fec..e8f6594 100644 --- a/src/SevenSegmentClock.cpp +++ b/src/SevenSegmentClock.cpp @@ -283,7 +283,7 @@ void SevenSegmentClock::displayUpdate(void) { } } -uint32_t SevenSegmentClock::red, SevenSegmentClock::green, SevenSegmentClock::blue, SevenSegmentClock::white, SevenSegmentClock::black; +uint32_t SevenSegmentClock::red, SevenSegmentClock::green, SevenSegmentClock::blue, SevenSegmentClock::white, SevenSegmentClock::black, SevenSegmentClock::yellow; uint8_t SevenSegmentClock::LedDataPin; Adafruit_NeoPixel *SevenSegmentClock::strip; @@ -293,6 +293,7 @@ void SevenSegmentClock::initColors(uint8_t _brightness) { SevenSegmentClock::blue = strip->Color(0, 0, _brightness); SevenSegmentClock::white = strip->Color(_brightness, _brightness, _brightness); SevenSegmentClock::black = strip->Color(0, 0, 0); + SevenSegmentClock::yellow = strip->Color(_brightness, _brightness, 0); SevenSegmentClock::setColor(SevenSegmentClock::getColor()); // reset color to enforce reclaculation } @@ -304,6 +305,7 @@ void SevenSegmentClock::setColor(Color color) { case Red: currentColor = SevenSegmentClock::red; break; case Green: currentColor = SevenSegmentClock::green; break; case White: currentColor = SevenSegmentClock::white; break; + case Yellow: currentColor = SevenSegmentClock::yellow; break; } } diff --git a/src/SevenSegmentClock.h b/src/SevenSegmentClock.h index fc8bf3c..2a505c0 100644 --- a/src/SevenSegmentClock.h +++ b/src/SevenSegmentClock.h @@ -19,10 +19,9 @@ public: enum BlinkMode { NoBlinking, ClockBlinking, SeperatorBlinking, DecimalPointBlinking }; void setBlinkMode(BlinkMode _blinkMode) { blinkMode = _blinkMode; }; void setClockHalted(bool halted) { clockHalted = halted; }; - enum Color { Black, Red, Green, Blue, White }; + enum Color { Black, Red, Green, Blue, White, Yellow }; void setColor(Color color); Color getColor(void) { return currentColorHandle; }; - static uint32_t red, green, blue, white, black; enum ClockDisplayStatus { Off, Booting, Halted, StandardClock, FastClock }; void displayDigit(unsigned int digitNum, char c); void displaySeperator(char seperatorCharacter); @@ -34,6 +33,7 @@ private: static Adafruit_NeoPixel *strip; static BlinkMode blinkMode; static uint8_t brightness; + static uint32_t red, green, blue, white, black, yellow; ClockDisplayStatus displayStatus; int clockHour; int clockMinute; diff --git a/src/main.cpp b/src/main.cpp index c230536..f3cc4e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,7 +53,8 @@ static struct ColorSelection { { 2, SevenSegmentClock::Blue, "blue" }, { 3, SevenSegmentClock::Red, "red" }, { 4, SevenSegmentClock::Green, "green" }, - { 5, SevenSegmentClock::White, "white" } + { 5, SevenSegmentClock::White, "white" }, + { 6, SevenSegmentClock::Yellow, "yellow" } }; static const String getColorName(uint8_t color) { @@ -201,6 +202,7 @@ const char _FORM_COLOR_BLUE[] PROGMEM = "Scan"; @@ -244,6 +246,9 @@ void appConfig() { input = FPSTR(_FORM_COLOR_GREEN); input.replace("{check}", (clockColor == SevenSegmentClock::Green) ? "checked" : ""); page += input; + input = FPSTR(_FORM_COLOR_YELLOW); + input.replace("{check}", (clockColor == SevenSegmentClock::Yellow) ? "checked" : ""); + page += input; input = FPSTR(_FORM_COLOR_WHITE); input.replace("{check}", (clockColor == SevenSegmentClock::White) ? "checked" : ""); page += input;