Added color Yellow.

This commit is contained in:
Dirk Jahnke 2019-06-04 21:43:09 +02:00
parent 07984234ab
commit 22df009807
3 changed files with 11 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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 = "<input class='r' id='cb' name='c' type=
const char _FORM_COLOR_RED[] PROGMEM = "<input class='r' id='cr' name='c' type='radio' value='red' {check}><label for='cr'>Red</label><br/>";
const char _FORM_COLOR_GREEN[] PROGMEM = "<input class='r' id='cg' name='c' type='radio' value='green' {check}><label for='cg'>Green</label><br/>";
const char _FORM_COLOR_WHITE[] PROGMEM = "<input class='r' id='cw' name='c' type='radio' value='white' {check}><label for='cw'>White</label><br/>";
const char _FORM_COLOR_YELLOW[] PROGMEM = "<input class='r' id='cy' name='c' type='radio' value='yellow' {check}><label for='cy'>Yellow</label><br/>";
const char _FORM_BRIGHTNESS[] PROGMEM = "<br/><label for='b'>Brightness:</label><input id='b' name='b' type='range' min='10' max='255' value='{bright}'><br/>";
const char _FORM_END[] PROGMEM = "<br/><button type='submit'>save</button></form>";
const char _SCAN_LINK[] PROGMEM = "<br/><div class=\"c\"><a href=\"/wifi\">Scan</a></div>";
@ -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;