diff --git a/include/Animation.hpp b/include/Animation.hpp index 0bb48c5a..6904303d 100644 --- a/include/Animation.hpp +++ b/include/Animation.hpp @@ -291,12 +291,15 @@ void Animation::analyzeColors(RgbfColor **dest, RgbfColor **source, uint8_t Animation::determineWhichMinuteVariant() { switch (G.minuteVariant) { - case MinuteVariant::Row: + case MinuteVariant::LED4x: return 0; break; - case MinuteVariant::Corners: + case MinuteVariant::LED7x: return 1; break; + case MinuteVariant::Corners: + return 2; + break; default: Serial.println("[ERROR] G.minuteVariant undefined"); return 0; @@ -310,7 +313,7 @@ void Animation::set_minutes() { if (G.minuteVariant != MinuteVariant::Off) { uint8_t m = lastMinute % 5; uint16_t minArray[4]; - usedUhrType->getMinArr(minArray, determineWhichMinuteVariant()); + usedUhrType->getMinuteArray(minArray, determineWhichMinuteVariant()); if (G.layoutVariant[ReverseMinDirection]) { std::reverse(std::begin(minArray), std::end(minArray)); } diff --git a/include/Uhr.h b/include/Uhr.h index 159a8681..63fd6725 100644 --- a/include/Uhr.h +++ b/include/Uhr.h @@ -4,6 +4,7 @@ #define PAYLOAD_LENGTH 30 #define MAX_ARRAY_SIZE 291 +#define MAX_FRAME_ARRAY_SIZE 60 enum ClockWords { ESIST = 0, @@ -50,9 +51,17 @@ struct OpenWeatherMapData { enum class MinuteVariant { Off = 0, - Corners = 1, - Row = 2, - InWords = 3, + LED4x = 1, + LED7x = 2, + Corners = 3, + InWords = 4, +}; + +enum class SecondVariant { + Off = 0, + FrameDot = 1, + FrameSector = 2, + FrameSectorToggle = 3, }; struct GLOBAL { @@ -69,7 +78,7 @@ struct GLOBAL { uint8_t effectBri; uint8_t effectSpeed; uint8_t client_nr; - uint8_t secondVariant; + SecondVariant secondVariant; MinuteVariant minuteVariant; bool languageVariant[6]; bool layoutVariant[1]; @@ -115,7 +124,7 @@ GLOBAL G = {}; uint8_t ldrVal = 100; uint8_t _second = 0; -uint8_t _second48 = 0; +uint8_t _secondFrame = 0; uint8_t _minute = 0; uint8_t _hour = 0; uint8_t lastSecond = 0; @@ -123,6 +132,7 @@ uint8_t lastMinute = 0; bool frontMatrix[MAX_ARRAY_SIZE] = {false}; bool lastFrontMatrix[MAX_ARRAY_SIZE] = {false}; +bool frameArray[MAX_FRAME_ARRAY_SIZE] = {false}; bool parametersChanged = false; uint8_t statusAccessPoint = 0; @@ -205,16 +215,18 @@ enum CommandWords { }; enum ClockType { + Eng10x11 = 10, Ger10x11 = 1, Ger10x11Alternative = 2, + Ger10x11AlternativeFrame = 12, Ger10x11Clock = 6, - Nl10x11 = 9, + Ger10x11Nero = 11, Ger11x11 = 3, Ger11x11V2 = 8, Ger11x11Frame = 4, Ger21x11Weather = 5, Ger17x17 = 7, - Eng10x11 = 10, + Nl10x11 = 9, }; enum Icons { diff --git a/include/Uhrtypes/DE10x11.2clock.hpp b/include/Uhrtypes/DE10x11.2clock.hpp index cef3b796..086904f1 100644 --- a/include/Uhrtypes/DE10x11.2clock.hpp +++ b/include/Uhrtypes/DE10x11.2clock.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* diff --git a/include/Uhrtypes/DE10x11.alternative.frame.hpp b/include/Uhrtypes/DE10x11.alternative.frame.hpp new file mode 100644 index 00000000..84d00893 --- /dev/null +++ b/include/Uhrtypes/DE10x11.alternative.frame.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include "DE10x11.alternative.hpp" + +/* + * Layout Front + * + * E S K I S T L F Ü N F + * Z E H N Z W A N Z I G + * D R E I V I E R T E L + * N A C H A P P Y V O R + * H A L B I R T H D A Y + * D R Z W Ö L F Ü N F X + * Z E H N E U N D R E I + * Z W E I N S I E B E N + * E L F V I E R A C H T + * S E C H S I U H R Y E + * + */ + +class De10x11AlternativeFrame_t : public De10x11Alternative_t { +public: + virtual const uint16_t numPixels() override { return 169; }; + + //------------------------------------------------------------------------------ + + virtual inline const uint16_t numPixelsFrameMatrix() { return 48; } + + //------------------------------------------------------------------------------ + + virtual const bool hasSecondsFrame() override { return true; } + + //------------------------------------------------------------------------------ + + virtual const uint16_t getFrameMatrixIndex(uint16_t index) override { + return 114 + index; + }; + + //------------------------------------------------------------------------------ + + virtual const void getMinuteArray(uint16_t *returnArr, + uint8_t col) override { + for (uint8_t i = 0; i < 4; i++) { + returnArr[i] = 110 + i; + } + }; +}; + +De10x11AlternativeFrame_t _de10x11AlternativeFrame; \ No newline at end of file diff --git a/include/Uhrtypes/DE10x11.alternative.hpp b/include/Uhrtypes/DE10x11.alternative.hpp index 37e25b0c..e3ecbccf 100644 --- a/include/Uhrtypes/DE10x11.alternative.hpp +++ b/include/Uhrtypes/DE10x11.alternative.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -16,8 +18,6 @@ * */ -#define USE_DREIVIERTEL - class De10x11Alternative_t : public iUhrType { public: virtual LanguageAbbreviation usedLang() override { diff --git a/include/Uhrtypes/DE10x11.hpp b/include/Uhrtypes/DE10x11.hpp index a63d6ba5..5db652ef 100644 --- a/include/Uhrtypes/DE10x11.hpp +++ b/include/Uhrtypes/DE10x11.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -49,14 +51,15 @@ class De10x11_t : public iUhrType { //------------------------------------------------------------------------------ virtual const uint16_t getFrontMatrix(uint8_t row, uint8_t col) override { - if (row == ROWS_MATRIX() - 1) { + if (row == rowsWordMatrix() - 1) { return col; } if (row % 2 == 0) { - col = COLS_MATRIX() - col - 1; + col = colsWordMatrix() - col - 1; } - uint16_t returnValue = NUM_PIXELS() - 1 - (col + (row * COLS_MATRIX())); - if (returnValue > NUM_PIXELS()) { + uint16_t returnValue = + numPixels() - 1 - (col + (row * colsWordMatrix())); + if (returnValue > numPixels()) { Serial.println("[ERROR] getMatrix() ReturnValue out of Bounds"); } return returnValue; @@ -71,7 +74,7 @@ class De10x11_t : public iUhrType { //------------------------------------------------------------------------------ - virtual const void getMinArr(uint16_t *returnArr, uint8_t col) { + virtual const void getMinuteArray(uint16_t *returnArr, uint8_t col) { for (uint8_t i = 0; i < 4; i++) { returnArr[i] = minArr[i]; } diff --git a/include/Uhrtypes/DE10x11.nero.hpp b/include/Uhrtypes/DE10x11.nero.hpp new file mode 100644 index 00000000..229229ee --- /dev/null +++ b/include/Uhrtypes/DE10x11.nero.hpp @@ -0,0 +1,222 @@ +#pragma once + +#include "Uhrtype.hpp" + +/* + * Layout Front + * + * E S J I S T L F Ü N F + * Z E H N Z W A N Z I G + * D R E I V I E R T E L + * T F N A C H V O R J M + * H A L B X Z W Ö L F T + * Z W E I N S I E B E N + * L D R E I C I F Ü N F + * E L F N E U N V I E R + * U A C H T Z E H N S I + * C S E C H S T L U H R + */ + +class De10x11Nero_t : public iUhrType { +public: + virtual LanguageAbbreviation usedLang() override { + return LanguageAbbreviation::DE; + }; + + //------------------------------------------------------------------------------ + + virtual const bool hasDreiviertel() override { return true; } + + //------------------------------------------------------------------------------ + + void show(FrontWord word) override { + switch (word) { + + case FrontWord::es_ist: + // Es + setLetter(0); + setLetter(1); + + // Ist + setLetter(3); + setLetter(4); + setLetter(5); + break; + + case FrontWord::nach: + case FrontWord::v_nach: + setLetter(38); + setLetter(39); + setLetter(40); + setLetter(41); + break; + + case FrontWord::vor: + case FrontWord::v_vor: + setLetter(35); + setLetter(36); + setLetter(37); + break; + + case FrontWord::viertel: + setLetter(26); + setLetter(27); + setLetter(28); + setLetter(29); + setLetter(30); + setLetter(31); + setLetter(32); + break; + + case FrontWord::dreiviertel: + setLetter(22); + setLetter(23); + setLetter(24); + setLetter(25); + setLetter(26); + setLetter(27); + setLetter(28); + setLetter(29); + setLetter(30); + setLetter(31); + setLetter(32); + break; + + case FrontWord::fuenf: + setLetter(7); + setLetter(8); + setLetter(9); + setLetter(10); + break; + + case FrontWord::zehn: + setLetter(18); + setLetter(19); + setLetter(20); + setLetter(21); + break; + + case FrontWord::zwanzig: + setLetter(11); + setLetter(12); + setLetter(13); + setLetter(14); + setLetter(15); + setLetter(16); + setLetter(17); + break; + + case FrontWord::halb: + setLetter(44); + setLetter(45); + setLetter(46); + setLetter(47); + break; + + case FrontWord::eins: + setLetter(60); + setLetter(61); + setLetter(62); + setLetter(63); + break; + + case FrontWord::uhr: + setLetter(99); + setLetter(100); + setLetter(101); + break; + + case FrontWord::h_ein: + setLetter(61); + setLetter(62); + setLetter(63); + break; + + case FrontWord::h_zwei: + setLetter(62); + setLetter(63); + setLetter(64); + setLetter(65); + break; + + case FrontWord::h_drei: + setLetter(67); + setLetter(68); + setLetter(69); + setLetter(70); + break; + + case FrontWord::h_vier: + setLetter(77); + setLetter(78); + setLetter(79); + setLetter(80); + break; + + case FrontWord::h_fuenf: + setLetter(73); + setLetter(74); + setLetter(75); + setLetter(76); + break; + + case FrontWord::h_sechs: + setLetter(104); + setLetter(105); + setLetter(106); + setLetter(107); + setLetter(108); + break; + + case FrontWord::h_sieben: + setLetter(55); + setLetter(56); + setLetter(57); + setLetter(58); + setLetter(59); + setLetter(60); + break; + + case FrontWord::h_acht: + setLetter(89); + setLetter(90); + setLetter(91); + setLetter(92); + break; + + case FrontWord::h_neun: + setLetter(81); + setLetter(82); + setLetter(83); + setLetter(84); + break; + + case FrontWord::h_zehn: + setLetter(93); + setLetter(94); + setLetter(95); + setLetter(96); + break; + + case FrontWord::h_elf: + setLetter(85); + setLetter(86); + setLetter(87); + break; + + case FrontWord::h_zwoelf: + + setLetter(49); + setLetter(50); + setLetter(51); + setLetter(52); + setLetter(53); + break; + + default: + break; + }; + }; +}; + +De10x11Nero_t _de10x11Nero; \ No newline at end of file diff --git a/include/Uhrtypes/DE11x11.frame.hpp b/include/Uhrtypes/DE11x11.frame.hpp index 137ab3bb..de712ead 100644 --- a/include/Uhrtypes/DE11x11.frame.hpp +++ b/include/Uhrtypes/DE11x11.frame.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -51,16 +53,30 @@ class De11x11frame_t : public iUhrType { //------------------------------------------------------------------------------ - const uint16_t minArr[2][4] = { - {0, 12, 168, 156}, // LEDs for "Normal" minute display - {152, 150, 148, 146} // LEDs für "Row" type minute display - }; - - //------------------------------------------------------------------------------ + virtual const void getMinuteArray(uint16_t *returnArr, uint8_t col) { + const uint8_t corner[4] = {152, 150, 148, 146}; - virtual const void getMinArr(uint16_t *returnArr, uint8_t col) { for (uint8_t i = 0; i < 4; i++) { - returnArr[i] = minArr[col][i]; + switch (col) { + case 0: + // LEDs for "LED4x" minute display + // {150, 149, 148, 147} + returnArr[i] = 150 - i; + break; + case 1: + // LEDs for "LED7x" minute display + // {152, 150, 148, 146} + returnArr[i] = 152 - (i * 2); + break; + case 2: + // LEDs for "Corners" minute display + // {0, 12, 168, 156} + returnArr[i] = corner[i]; + break; + + default: + break; + } } }; @@ -69,42 +85,46 @@ class De11x11frame_t : public iUhrType { virtual const uint16_t getFrontMatrix(uint8_t row, uint8_t col) override { row++; if (row % 2 != 0) { - col = COLS_MATRIX() - col - 1; + col = colsWordMatrix() - col - 1; } - uint16_t returnValue = col + 1 + (row * COLS_MATRIX() + 2); - if (returnValue > NUM_PIXELS()) { + uint16_t returnValue = col + 1 + (row * colsWordMatrix() + 2); + if (returnValue > numPixels()) { Serial.println("[ERROR] getMatrix() ReturnValue out of Bounds"); } return returnValue; }; //------------------------------------------------------------------------------ - virtual const uint16_t getRMatrix(uint16_t index) override { + virtual const uint16_t getFrameMatrixIndex(uint16_t index) override { return rmatrix[index]; }; //------------------------------------------------------------------------------ - virtual const uint16_t getSMatrix(uint16_t index) override { - uint8_t row = index / COLS_MATRIX(); - uint8_t col = index % COLS_MATRIX(); + virtual const uint16_t getWordMatrixIndex(uint16_t index) override { + uint8_t row = index / colsWordMatrix(); + uint8_t col = index % colsWordMatrix(); if (row % 2 == 0) { - col = COLS_MATRIX() - 1 - col; + col = colsWordMatrix() - 1 - col; } return getFrontMatrix(row, col); }; //------------------------------------------------------------------------------ - virtual const uint16_t NUM_PIXELS() override { return 169; }; + virtual const uint16_t numPixels() override { return 169; }; + + //------------------------------------------------------------------------------ + + virtual const uint16_t rowsWordMatrix() override { return 11; }; //------------------------------------------------------------------------------ - virtual const uint16_t NUM_SMATRIX() override { return 121; }; + virtual const uint16_t numPixelsWordMatrix() override { return 121; }; //------------------------------------------------------------------------------ - virtual const uint16_t NUM_RMATRIX() override { return 48; }; + virtual const uint16_t numPixelsFrameMatrix() override { return 48; }; //------------------------------------------------------------------------------ diff --git a/include/Uhrtypes/DE11x11.hpp b/include/Uhrtypes/DE11x11.hpp index 0a715889..4c613d52 100644 --- a/include/Uhrtypes/DE11x11.hpp +++ b/include/Uhrtypes/DE11x11.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -25,30 +27,33 @@ class De11x11_t : public iUhrType { //------------------------------------------------------------------------------ - const uint16_t minArr[2][4] = { - {121, 122, 123, 124}, // LEDs for "Normal" minute display - {110, 111, 112, 113} // LEDs für "Row" type minute display - }; - - //------------------------------------------------------------------------------ - - virtual const void getMinArr(uint16_t *returnArr, uint8_t col) { + virtual const void getMinuteArray(uint16_t *returnArr, + uint8_t col) override { for (uint8_t i = 0; i < 4; i++) { - returnArr[i] = minArr[col][i]; + switch (col) { + case 0: // LEDs for "LED4x" minute display + returnArr[i] = numPixels() - (7 - i); + break; + case 1: // LEDs for "LED7x" minute display + returnArr[i] = numPixels() - (7 - (i * 2)); + break; + case 2: // LEDs für "Corners" type minute display + returnArr[i] = 110 + i; + break; + + default: + break; + } } }; //------------------------------------------------------------------------------ - virtual const uint16_t NUM_PIXELS() override { return 125; }; - - //------------------------------------------------------------------------------ - - virtual const uint16_t NUM_SMATRIX() override { return 125; }; + virtual const uint16_t numPixels() override { return 128; }; //------------------------------------------------------------------------------ - virtual const uint16_t ROWS_MATRIX() override { return 12; }; + virtual const uint16_t rowsWordMatrix() override { return 11; }; //------------------------------------------------------------------------------ diff --git a/include/Uhrtypes/DE11x11.v2.hpp b/include/Uhrtypes/DE11x11.v2.hpp index f962f736..95fdaa34 100644 --- a/include/Uhrtypes/DE11x11.v2.hpp +++ b/include/Uhrtypes/DE11x11.v2.hpp @@ -1,4 +1,6 @@ -#include "Uhrtype.hpp" +#pragma once + +#include "DE11x11.hpp" /* * Layout Front @@ -17,30 +19,8 @@ * + + + + */ -class De11x11V2_t : public iUhrType { +class De11x11V2_t : public De11x11_t { public: - virtual LanguageAbbreviation usedLang() override { - return LanguageAbbreviation::DE; - }; - - //------------------------------------------------------------------------------ - - virtual const uint16_t NUM_PIXELS() override { return 125; }; - - //------------------------------------------------------------------------------ - - virtual const uint16_t NUM_SMATRIX() override { return 125; }; - - //------------------------------------------------------------------------------ - - virtual const uint16_t ROWS_MATRIX() override { return 12; }; - - //------------------------------------------------------------------------------ - - virtual const bool hasZwanzig() override { return false; } - - //------------------------------------------------------------------------------ - void show(FrontWord word) override { switch (word) { diff --git a/include/Uhrtypes/DE17x17.hpp b/include/Uhrtypes/DE17x17.hpp index 45316116..7a16c3ff 100644 --- a/include/Uhrtypes/DE17x17.hpp +++ b/include/Uhrtypes/DE17x17.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -30,19 +32,15 @@ class De17x17_t : public iUhrType { //------------------------------------------------------------------------------ - virtual const uint16_t NUM_PIXELS() override { return 291; }; - - //------------------------------------------------------------------------------ - - virtual const uint16_t NUM_SMATRIX() override { return 291; }; + virtual const uint16_t numPixels() override { return 291; }; //------------------------------------------------------------------------------ - virtual const uint16_t ROWS_MATRIX() override { return 17; }; + virtual const uint16_t rowsWordMatrix() override { return 16; }; //------------------------------------------------------------------------------ - virtual const uint16_t COLS_MATRIX() override { return 18; }; + virtual const uint16_t colsWordMatrix() override { return 18; }; //------------------------------------------------------------------------------ diff --git a/include/Uhrtypes/DE21x11.weather.hpp b/include/Uhrtypes/DE21x11.weather.hpp index 40de8d26..2da50fab 100644 --- a/include/Uhrtypes/DE21x11.weather.hpp +++ b/include/Uhrtypes/DE21x11.weather.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -40,23 +42,36 @@ class De21x11Weather_t : public iUhrType { //------------------------------------------------------------------------------ - virtual const void getMinArr(uint16_t *returnArr, uint8_t col) { + virtual const void getMinuteArray(uint16_t *returnArr, uint8_t col) { for (uint8_t i = 0; i < 4; i++) { returnArr[i] = minArr[i]; } + for (uint8_t i = 0; i < 4; i++) { + switch (col) { + case 0: + // LEDs for "LED4x" minute display + // {112, 114, 116, 118} + returnArr[i] = 113 + i; + break; + case 1: + // LEDs for "LED7x" minute display + // {112, 114, 116, 118} + returnArr[i] = 112 + (i * 2); + break; + + default: + break; + } + } }; //------------------------------------------------------------------------------ - virtual const uint16_t NUM_PIXELS() override { return 242; }; - - //------------------------------------------------------------------------------ - - virtual const uint16_t NUM_SMATRIX() override { return 242; }; + virtual const uint16_t numPixels() override { return 242; }; //------------------------------------------------------------------------------ - virtual const uint16_t ROWS_MATRIX() override { return 22; }; + virtual const uint16_t rowsWordMatrix() override { return 22; }; //------------------------------------------------------------------------------ diff --git a/include/Uhrtypes/EN10x11.hpp b/include/Uhrtypes/EN10x11.hpp index a5aaa1a5..d0f0f30b 100644 --- a/include/Uhrtypes/EN10x11.hpp +++ b/include/Uhrtypes/EN10x11.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* @@ -16,8 +18,6 @@ * */ -#define USE_DREIVIERTEL - class En10x11_t : public iUhrType { public: virtual LanguageAbbreviation usedLang() override { diff --git a/include/Uhrtypes/NL10x11.hpp b/include/Uhrtypes/NL10x11.hpp index 3c8c9825..94102d2a 100644 --- a/include/Uhrtypes/NL10x11.hpp +++ b/include/Uhrtypes/NL10x11.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "Uhrtype.hpp" /* diff --git a/include/Uhrtypes/Uhrtype.hpp b/include/Uhrtypes/Uhrtype.hpp index 5ea4bc60..43433961 100644 --- a/include/Uhrtypes/Uhrtype.hpp +++ b/include/Uhrtypes/Uhrtype.hpp @@ -100,19 +100,21 @@ class iUhrType { virtual LanguageAbbreviation usedLang() = 0; - virtual inline const uint16_t NUM_PIXELS() { return 114; } + virtual inline const uint16_t numPixels() { return 117; } - virtual inline const uint16_t NUM_SMATRIX() { return 114; } + virtual inline const uint16_t numPixelsWordMatrix() { + return rowsWordMatrix() * colsWordMatrix(); + } - virtual inline const uint16_t ROWS_MATRIX() { return 11; } + virtual inline const uint16_t numPixelsFrameMatrix() { return 0; } - virtual inline const uint16_t COLS_MATRIX() { return 11; } + virtual inline const uint16_t rowsWordMatrix() { return 10; } - virtual inline const uint16_t NUM_RMATRIX() { return 0; } + virtual inline const uint16_t colsWordMatrix() { return 11; } - virtual const uint16_t getSMatrix(uint16_t index) { return index; } + virtual const uint16_t getWordMatrixIndex(uint16_t index) { return index; } - virtual const uint16_t getRMatrix(uint16_t index) { return 0; } + virtual const uint16_t getFrameMatrixIndex(uint16_t index) { return 0; } virtual const bool hasDreiviertel() { return false; } @@ -128,18 +130,28 @@ class iUhrType { virtual const uint16_t getFrontMatrix(uint8_t row, uint8_t col) { if (row % 2 != 0) { - col = COLS_MATRIX() - col - 1; + col = colsWordMatrix() - col - 1; } - uint16_t returnValue = col + (row * COLS_MATRIX()); - if (returnValue > NUM_PIXELS()) { + uint16_t returnValue = col + (row * colsWordMatrix()); + if (returnValue > numPixels()) { Serial.println("[ERROR] getMatrix() ReturnValue out of Bounds"); } return returnValue; }; - virtual const void getMinArr(uint16_t *returnArr, uint8_t col) { + virtual const void getMinuteArray(uint16_t *returnArr, uint8_t col) { for (uint8_t i = 0; i < 4; i++) { - returnArr[i] = NUM_PIXELS() - (4 - i); + switch (col) { + case 0: // LEDs for "LED4x" minute display + returnArr[i] = numPixels() - (7 - i); + break; + case 1: // LEDs for "LED7x" minute display + returnArr[i] = numPixels() - (7 - (i * 2)); + break; + + default: + break; + } } }; }; diff --git a/include/clockWork.h b/include/clockWork.h index eebbfa13..bc123267 100644 --- a/include/clockWork.h +++ b/include/clockWork.h @@ -4,16 +4,10 @@ class ClockWork { private: - uint8_t countMillis48 = 0; - uint32_t previous48 = 0; - const uint16_t interval48 = 1250; // 60000/48 - uint8_t lastSecond48 = 48; - uint16_t countMillisSpeed = 0; uint32_t previousMillis = 0; private: - void loopSecondsFrame(); void loopLdrLogic(); void rainbow(); diff --git a/include/clockWork.hpp b/include/clockWork.hpp index 2882e406..0bc2bcf4 100644 --- a/include/clockWork.hpp +++ b/include/clockWork.hpp @@ -11,7 +11,7 @@ OpenWMap weather; //------------------------------------------------------------------------------ void ClockWork::copyClockface(const bool source[], bool destination[]) { - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < MAX_ARRAY_SIZE; i++) { destination[i] = source[i]; } } @@ -19,7 +19,7 @@ void ClockWork::copyClockface(const bool source[], bool destination[]) { //------------------------------------------------------------------------------ bool ClockWork::changesInClockface() { - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < MAX_ARRAY_SIZE; i++) { if (frontMatrix[i] != lastFrontMatrix[i]) { return true; } @@ -69,7 +69,7 @@ void ClockWork::loopLdrLogic() { void ClockWork::rainbow() { static float hue = 0; - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < usedUhrType->numPixelsWordMatrix(); i++) { led.setPixelHsb(i, hue, 100, G.effectBri); } led.show(); @@ -84,10 +84,11 @@ void ClockWork::rainbowCycle() { float displayedHue; displayedHue = hue; - for (uint16_t i = 0; i < usedUhrType->NUM_SMATRIX(); i++) { - led.setPixelHsb(usedUhrType->getSMatrix(i), displayedHue, 100, + for (uint16_t i = 0; i < usedUhrType->numPixelsWordMatrix(); i++) { + led.setPixelHsb(usedUhrType->getWordMatrixIndex(i), displayedHue, 100, G.effectBri); - displayedHue = displayedHue + 360.0 / usedUhrType->NUM_SMATRIX(); + displayedHue = + displayedHue + 360.0 / usedUhrType->numPixelsWordMatrix(); led.checkIfHueIsOutOfBound(displayedHue); } led.show(); @@ -99,7 +100,7 @@ void ClockWork::rainbowCycle() { void ClockWork::scrollingText(const char *buf) { static uint8_t i = 0, ii = 0; - uint8_t offsetRow = (usedUhrType->ROWS_MATRIX() - fontHeight - 1) / 2; + uint8_t offsetRow = (usedUhrType->rowsWordMatrix() - fontHeight) / 2; uint8_t fontIndex = buf[ii]; led.shiftColumnToRight(); @@ -112,16 +113,16 @@ void ClockWork::scrollingText(const char *buf) { G.rgbw[Effect][0], G.rgbw[Effect][1], G.rgbw[Effect][2], G.rgbw[Effect][3], usedUhrType->getFrontMatrix( - row + offsetRow, usedUhrType->COLS_MATRIX() - 1)); + row + offsetRow, usedUhrType->colsWordMatrix() - 1)); } else { led.clearPixel(usedUhrType->getFrontMatrix( - row + offsetRow, usedUhrType->COLS_MATRIX() - 1)); + row + offsetRow, usedUhrType->colsWordMatrix() - 1)); } } } else { for (uint8_t row = 0; row < fontHeight; row++) { led.clearPixel(usedUhrType->getFrontMatrix( - row + offsetRow, usedUhrType->COLS_MATRIX() - 1)); + row + offsetRow, usedUhrType->colsWordMatrix() - 1)); } } led.show(); @@ -216,12 +217,15 @@ void ClockWork::setHour(const uint8_t hour, const bool fullHour) { uint8_t ClockWork::determineWhichMinuteVariant() { switch (G.minuteVariant) { - case MinuteVariant::Row: + case MinuteVariant::LED4x: return 0; break; - case MinuteVariant::Corners: + case MinuteVariant::LED7x: return 1; break; + case MinuteVariant::Corners: + return 2; + break; default: Serial.println("[ERROR] G.minuteVariant undefined"); return 0; @@ -344,7 +348,7 @@ void ClockWork::showMinute(uint8_t min) { showMinuteInWords(min); } else if (G.minuteVariant != MinuteVariant::Off) { uint16_t minArray[4]; - usedUhrType->getMinArr(minArray, determineWhichMinuteVariant()); + usedUhrType->getMinuteArray(minArray, determineWhichMinuteVariant()); if (G.layoutVariant[ReverseMinDirection]) { std::reverse(std::begin(minArray), std::end(minArray)); } @@ -641,7 +645,7 @@ void ClockWork::calcClockface() { led.setBrightnessLdr(rr, gg, bb, ww, Background); // set Background color - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < usedUhrType->numPixels(); i++) { led.setPixel(rr, gg, bb, ww, i); } @@ -658,8 +662,12 @@ iUhrType *ClockWork::getPointer(uint8_t type) { return &_de10x11; case Ger10x11Alternative: return &_de10x11Alternative; + case Ger10x11AlternativeFrame: + return &_de10x11AlternativeFrame; case Ger10x11Clock: return &_de10x11Clock; + case Ger10x11Nero: + return &_de10x11Nero; case Nl10x11: return &_nl10x11; case Ger11x11: @@ -691,7 +699,7 @@ void ClockWork::initLedStrip(uint8_t num) { } if (strip_RGBW == NULL) { strip_RGBW = new NeoPixelBus( - usedUhrType->NUM_PIXELS()); + usedUhrType->numPixels()); strip_RGBW->Begin(); } } else { @@ -702,7 +710,7 @@ void ClockWork::initLedStrip(uint8_t num) { } if (strip_RGB == NULL) { strip_RGB = new NeoPixelBus( - usedUhrType->NUM_PIXELS()); + usedUhrType->numPixels()); strip_RGB->Begin(); } } @@ -713,9 +721,9 @@ void ClockWork::initLedStrip(uint8_t num) { void resetMinVariantIfNotAvailable() { if (G.UhrtypeDef != Nl10x11 && G.minuteVariant == MinuteVariant::InWords) { G.minuteVariant = MinuteVariant::Off; - } else if (G.UhrtypeDef != Ger11x11Frame && - G.minuteVariant == MinuteVariant::Row) { - G.minuteVariant = MinuteVariant::Off; + } else if (usedUhrType->rowsWordMatrix() != 11 && + G.minuteVariant == MinuteVariant::Corners) { + G.minuteVariant = MinuteVariant::LED4x; } } @@ -724,21 +732,11 @@ void resetMinVariantIfNotAvailable() { void ClockWork::loop(struct tm &tm) { unsigned long currentMillis = millis(); countMillisSpeed += currentMillis - previousMillis; - if (usedUhrType->hasSecondsFrame()) { - countMillis48 += currentMillis - previousMillis; - } previousMillis = currentMillis; // Faster runtime for demo animation->demoMode(_minute, _second); - //------------------------------------------------ - // SecondsFrame - //------------------------------------------------ - if (usedUhrType->hasSecondsFrame()) { - loopSecondsFrame(); - } - //------------------------------------------------ // Secounds and LDR Routine //------------------------------------------------ @@ -776,7 +774,6 @@ void ClockWork::loop(struct tm &tm) { // Minute //------------------------------------------------ if (lastMinute != _minute) { - _second48 = 0; lastMinute = _minute; } @@ -838,7 +835,7 @@ void ClockWork::loop(struct tm &tm) { config[stringToSend] = static_cast(G.layoutVariant[i]); } config["effectBri"] = G.effectBri; - config["secondVariant"] = G.secondVariant; + config["secondVariant"] = static_cast(G.secondVariant); config["minuteVariant"] = static_cast(G.minuteVariant); config["ldr"] = G.ldr; config["ldrCal"] = G.ldrCal; @@ -855,6 +852,7 @@ void ClockWork::loop(struct tm &tm) { config["hasZwanzig"] = usedUhrType->hasZwanzig(); config["hasWeatherLayout"] = usedUhrType->hasWeatherLayout(); config["hasSecondsFrame"] = usedUhrType->hasSecondsFrame(); + config["numOfRows"] = usedUhrType->rowsWordMatrix(); serializeJson(config, str); Serial.print("Sending Payload:"); Serial.println(str); @@ -984,9 +982,18 @@ void ClockWork::loop(struct tm &tm) { case COMMAND_SET_UHRTYPE: { eeprom::write(); + led.clear(); + led.show(); + delay(10); Serial.printf("Uhrtype: %u\n", G.UhrtypeDef); usedUhrType = getPointer(G.UhrtypeDef); resetMinVariantIfNotAvailable(); + if (usedUhrType->numPixelsFrameMatrix() != 0) { + delete secondsFrame; + secondsFrame = + new SecondsFrame(usedUhrType->numPixelsFrameMatrix()); + G.progInit = 1; + } G.conf = COMMAND_IDLE; break; } @@ -1094,11 +1101,6 @@ void ClockWork::loop(struct tm &tm) { led.set(); } parametersChanged = false; - - if (usedUhrType->hasSecondsFrame() && G.secondVariant < 1 && - G.minuteVariant != MinuteVariant::Corners) { - led.setFrameColor(); - } G.prog = COMMAND_IDLE; } default: @@ -1112,31 +1114,6 @@ void ClockWork::loop(struct tm &tm) { //------------------------------------------------------------------------------ -void ClockWork::loopSecondsFrame() { - if (countMillis48 >= interval48) { - countMillis48 = 0; - _second48++; - if (_second48 > 47) { - _second48 = 0; - } - } - if (lastSecond48 != _second48) { - if (G.prog == 0 && G.conf == 0) { - if (G.secondVariant == 1 || - G.minuteVariant == MinuteVariant::Corners) { - led.clearFrame(); - } - if (G.secondVariant > 0) { - led.showSeconds(); - } - led.show(); - } - lastSecond48 = _second48; - } -} - -//------------------------------------------------------------------------------ - void ClockWork::initBootLedBlink() { led.setAllPixels(50, 50, 50, 50); led.show(); diff --git a/include/config.h b/include/config.h index f46b0571..2581d63d 100644 --- a/include/config.h +++ b/include/config.h @@ -15,12 +15,21 @@ // // #define DEFAULT_LAYOUT Ger10x11Alternative // 10 rows, each 11 LED's per row + 4 LED's for minutes, with modified -// layout for extra words in the matrix +// layout for extra words in the matrix from the Github user @dbambus +// +// #define DEFAULT_LAYOUT Ger10x11AlternativeFrame +// 10 rows, each 11 LED's per row + 4 LED's (minutes)+ 48 LED's (seconds) in a +// Frame around with modified layout for extra words in the matrix from the +// Github user @dbambus // // #define DEFAULT_LAYOUT Ger10x11Clock // 10 rows, each 11 LED's per row + 4 LED's for minutes, with the layout // from the original manufacturer // +// #define DEFAULT_LAYOUT Ger10x11Nero +// 10 rows, each 11 LED's per row + 4 LED's for minutes, with the layout +// from the Github user @n3roGit +// // #define DEFAULT_LAYOUT Ger11x11 // 11 rows, each 11 LED's per row + 4 LED's for minutes // @@ -85,7 +94,7 @@ * * Valid values [0 ... 255] */ -#define SERNR 70 +#define SERNR 80 //-------------------------------------------------------------------------- // Toggle Serial DEBUG Output @@ -126,4 +135,15 @@ * Valid values BOOT_LEDSWEEP [true, false] */ #define BOOT_SHOWIP true -#define BOOT_LEDSWEEP false \ No newline at end of file +#define BOOT_LEDSWEEP false + +//-------------------------------------------------------------------------- +// Displaying Option for Minutes +//-------------------------------------------------------------------------- +/* + * + * Valid values [only one #define option] + */ +//#define MINUTE_Off +#define MINUTE_LED4x +//#define MINUTE_LED7x \ No newline at end of file diff --git a/include/frame.h b/include/frame.h new file mode 100644 index 00000000..1ee987b1 --- /dev/null +++ b/include/frame.h @@ -0,0 +1,130 @@ +#pragma once + +#include "Uhr.h" +#include "led.h" + +extern Led led; + +class SecondsFrame { +private: + uint8_t numFramePixels; + uint16_t frameIntervall; + uint8_t lastSecondFrame; + uint16_t countMillisFrameIntervall; + uint16_t countMillisSpeed; + uint16_t previousMillis; + +private: + void setInitFrameSector(); + void frameLogic(); + +public: + SecondsFrame(const uint8_t num); + ~SecondsFrame(); + + void setup(); + void loop(); +}; + +//------------------------------------------------------------------------------ + +SecondsFrame::~SecondsFrame() {} + +//------------------------------------------------------------------------------ + +SecondsFrame::SecondsFrame(const uint8_t num) { + numFramePixels = num; + frameIntervall = 60000 / numFramePixels; + lastSecondFrame = numFramePixels; + countMillisFrameIntervall = 0; + countMillisSpeed = 0; + previousMillis = 0; +} + +//------------------------------------------------------------------------------ + +void SecondsFrame::setInitFrameSector() { + switch (G.secondVariant) { + + case SecondVariant::FrameSectorToggle: + if (_minute % 2 == 1) { + for (uint8_t i = 0; i <= numFramePixels; i++) { + frameArray[i] = true; + } + } + /* intentianally no break */ + case SecondVariant::FrameSector: + for (uint8_t i = 0; i <= _secondFrame; i++) { + frameArray[i] = !frameArray[i]; + } + break; + default: + break; + } +} + +//------------------------------------------------------------------------------ + +void SecondsFrame::setup() { + led.clearFrame(); + _secondFrame = _second / (60.f / numFramePixels); + setInitFrameSector(); + parametersChanged = true; +} + +//------------------------------------------------------------------------------ + +void SecondsFrame::frameLogic() { + countMillisFrameIntervall = 0; + _secondFrame++; + + /*Every full minute */ + if (_secondFrame == numFramePixels) { + led.clearFrame(); + _secondFrame = 0; + } + + /*Every (Frame-)Second*/ + if (lastSecondFrame != _secondFrame) { + + switch (G.secondVariant) { + case SecondVariant::FrameDot: + frameArray[_secondFrame] = true; + if (_secondFrame != 0) { + frameArray[_secondFrame - 1] = false; + } + break; + case SecondVariant::FrameSector: + case SecondVariant::FrameSectorToggle: + frameArray[_secondFrame] = !frameArray[_secondFrame]; + break; + default: + break; + } + + lastSecondFrame = _secondFrame; + } + + /*Update LEDs corrosponding with mode Clockwork*/ + if (G.prog == 0 && G.conf == 0) { + led.clear(); + parametersChanged = true; + G.prog = COMMAND_MODE_WORD_CLOCK; + } +} + +//------------------------------------------------------------------------------ + +void SecondsFrame::loop() { + unsigned long currentMillis = millis(); + countMillisFrameIntervall += currentMillis - previousMillis; + previousMillis = currentMillis; + + if (G.progInit == 1 && G.prog == 0) { + setup(); + G.progInit = 0; + } + if (countMillisFrameIntervall >= frameIntervall) { + frameLogic(); + } +} \ No newline at end of file diff --git a/include/led.hpp b/include/led.hpp index 08545520..1d8e3b92 100644 --- a/include/led.hpp +++ b/include/led.hpp @@ -144,7 +144,7 @@ inline void Led::clearPixel(uint16_t i) { //------------------------------------------------------------------------------ inline void Led::clear() { - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < usedUhrType->numPixels(); i++) { frontMatrix[i] = false; clearPixel(i); } @@ -153,15 +153,15 @@ inline void Led::clear() { //------------------------------------------------------------------------------ inline void Led::clearClock() { - for (uint16_t i = 0; i < usedUhrType->NUM_SMATRIX(); i++) { - clearPixel(usedUhrType->getSMatrix(i)); + for (uint16_t i = 0; i < usedUhrType->numPixelsWordMatrix(); i++) { + clearPixel(usedUhrType->getWordMatrixIndex(i)); } } //------------------------------------------------------------------------------ inline void Led::clearRow(uint8_t row) { - for (uint8_t i = 0; i < usedUhrType->COLS_MATRIX(); i++) { + for (uint8_t i = 0; i < usedUhrType->colsWordMatrix(); i++) { clearPixel(usedUhrType->getFrontMatrix(row, i)); } } @@ -173,7 +173,7 @@ inline void Led::clearFrontExeptofFontspace(uint8_t offsetRow) { clearRow(i); } - for (uint8_t i = usedUhrType->ROWS_MATRIX() - 1; i > offsetRow + fontHeight; + for (uint8_t i = usedUhrType->rowsWordMatrix(); i > offsetRow + fontHeight; i--) { clearRow(i - 1); } @@ -182,8 +182,9 @@ inline void Led::clearFrontExeptofFontspace(uint8_t offsetRow) { //------------------------------------------------------------------------------ inline void Led::clearFrame() { - for (uint16_t i = 0; i < usedUhrType->NUM_RMATRIX(); i++) { - clearPixel(usedUhrType->getRMatrix(i)); + for (uint16_t i = 0; i < usedUhrType->numPixelsFrameMatrix(); i++) { + frameArray[i] = false; + clearPixel(usedUhrType->getFrameMatrixIndex(i)); } } @@ -194,7 +195,7 @@ void Led::set(bool changed) { uint8_t r2, g2, b2, w2; setBrightnessLdr(rr, gg, bb, ww, Foreground); setBrightnessLdr(r2, g2, b2, w2, Background); - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < usedUhrType->numPixels(); i++) { if (lastFrontMatrix[i]) { // foreground setPixel(rr, gg, bb, ww, i); @@ -203,6 +204,9 @@ void Led::set(bool changed) { setPixel(r2, g2, b2, w2, i); } } + if (G.secondVariant != SecondVariant::Off) { + showSeconds(); + } if (animation->led_show_notify(changed, _minute)) { show(); } @@ -237,9 +241,9 @@ void Led::setIcon(uint8_t num_icon, uint8_t brightness = 100, bool rgb_icon) { void Led::setSingle(uint8_t wait) { float hue; - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { - hue = 360.0 * i / (usedUhrType->NUM_PIXELS() - 1); - hue = hue + 360.0 / usedUhrType->NUM_PIXELS(); + for (uint16_t i = 0; i < usedUhrType->numPixels(); i++) { + hue = 360.0 * i / (usedUhrType->numPixels() - 1); + hue = hue + 360.0 / usedUhrType->numPixels(); checkIfHueIsOutOfBound(hue); clear(); @@ -252,7 +256,7 @@ void Led::setSingle(uint8_t wait) { //------------------------------------------------------------------------------ void Led::setAllPixels(uint8_t rr, uint8_t gg, uint8_t bb, uint8_t ww) { - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { + for (uint16_t i = 0; i < usedUhrType->numPixelsWordMatrix(); i++) { setPixel(rr, gg, bb, ww, i); } } @@ -271,17 +275,16 @@ void Led::setFrameColor() { uint8_t rr, gg, bb, ww; setBrightness(rr, gg, bb, ww, Frame); - for (uint16_t i = 0; i < usedUhrType->NUM_RMATRIX(); i++) { - setPixel(rr, gg, bb, ww, usedUhrType->getRMatrix(i)); + for (uint16_t i = 0; i < usedUhrType->numPixelsFrameMatrix(); i++) { + setPixel(rr, gg, bb, ww, usedUhrType->getFrameMatrixIndex(i)); } } //------------------------------------------------------------------------------ void Led::shiftColumnToRight() { - for (uint8_t col = 0; col < usedUhrType->COLS_MATRIX() - 1; col++) { - for (uint8_t row = 0; - row < usedUhrType->ROWS_MATRIX() - 1 /* Only Front*/; row++) { + for (uint8_t col = 0; col < usedUhrType->colsWordMatrix() - 1; col++) { + for (uint8_t row = 0; row < usedUhrType->rowsWordMatrix(); row++) { if (G.Colortype == Grbw) { setPixelColorObject( usedUhrType->getFrontMatrix(row, col), @@ -312,7 +315,7 @@ void Led::showNumbers(const char d1, const char d2) { clearClock(); static uint8_t offsetLetter0 = 0; static uint8_t offsetLetter1 = fontWidth + 1; - uint8_t offsetRow = (usedUhrType->ROWS_MATRIX() - fontHeight - 1) / 2; + uint8_t offsetRow = (usedUhrType->rowsWordMatrix() - fontHeight) / 2; if (usedUhrType->has24HourLayout()) { offsetLetter0 = 3; @@ -335,10 +338,23 @@ void Led::showNumbers(const char d1, const char d2) { //------------------------------------------------------------------------------ void Led::showSeconds() { + const uint8_t offesetSecondsFrame = 5; uint8_t rr, gg, bb, ww; - setBrightness(rr, gg, bb, ww, Effect); - - setPixel(rr, gg, bb, ww, usedUhrType->getRMatrix(_second48)); + setBrightness(rr, gg, bb, ww, Foreground); + for (uint8_t i = 0; i < usedUhrType->numPixelsFrameMatrix(); i++) { + if (frameArray[i]) { + if (i < usedUhrType->numPixelsFrameMatrix() - offesetSecondsFrame) { + setPixel(rr, gg, bb, ww, + usedUhrType->getFrameMatrixIndex(i) + + offesetSecondsFrame); + } else { + setPixel(rr, gg, bb, ww, + usedUhrType->getFrameMatrixIndex(i) - + usedUhrType->numPixelsFrameMatrix() + + offesetSecondsFrame); + } + } + } } //------------------------------------------------------------------------------ diff --git a/include/webPageAdapter.h b/include/webPageAdapter.h index 80b7df78..e5ca6633 100644 --- a/include/webPageAdapter.h +++ b/include/webPageAdapter.h @@ -331,7 +331,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t *payload, case COMMAND_SET_SETTING_SECOND: { G.conf = COMMAND_SET_SETTING_SECOND; - G.secondVariant = split(payload, 3); + G.progInit = 1; + + G.secondVariant = static_cast(split(payload, 3)); break; } diff --git a/package.json b/package.json index 83b33a60..6e3ee609 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Wortuhr", - "version": "2.7.0", + "version": "2.8.0", "description": "For building a german layouted wordclock with an esp8266 module and WS2812/SK2812.", "license": "BSD-3-Clause", "contributors": [ diff --git a/pics/wortuhr-webpage.png b/pics/wortuhr-webpage.png index 55861993..f05b599d 100644 Binary files a/pics/wortuhr-webpage.png and b/pics/wortuhr-webpage.png differ diff --git a/src/Wortuhr.cpp b/src/Wortuhr.cpp index 26f08aad..38217c3f 100644 --- a/src/Wortuhr.cpp +++ b/src/Wortuhr.cpp @@ -41,11 +41,13 @@ RTC_Type RTC; #include "Animation.h" #include "clockWork.h" +#include "frame.h" #include "led.h" #include "mqtt.h" #include "network.h" Animation *animation; +SecondsFrame *secondsFrame; Led led; ClockWork clockWork; Mqtt mqtt; @@ -90,8 +92,8 @@ void time_is_set() { _second = tm.tm_sec; _minute = tm.tm_min; _hour = tm.tm_hour; - if (usedUhrType->hasSecondsFrame()) { - _second48 = _second * 48 / 60; + if (usedUhrType->numPixelsFrameMatrix() != 0) { + _secondFrame = _second / (usedUhrType->numPixelsFrameMatrix() / 60.f); } String origin; @@ -154,8 +156,17 @@ void setup() { G.effectBri = 2; G.effectSpeed = 10; G.client_nr = 0; - G.secondVariant = 0; - G.minuteVariant = MinuteVariant::Corners; + G.secondVariant = SecondVariant::Off; +// C++23 #elifdef doesn't work yet +#ifdef MINUTE_Off + G.minuteVariant = MinuteVariant::Off; +#endif +#ifdef MINUTE_4xLED + G.minuteVariant = MinuteVariant::LED7x; +#endif +#ifdef MINUTE_7xLED + G.minuteVariant = MinuteVariant::LED7x; +#endif G.ldr = 0; G.ldrCal = 0; strcpy(G.openWeatherMap.cityid, ""); @@ -225,8 +236,14 @@ void setup() { // Number of rows (including frames) // Number of columns (including frames) // Get TODO frame width from usedUhrTyp - animation = new Animation(0, 0, usedUhrType->ROWS_MATRIX() - 1, - usedUhrType->COLS_MATRIX()); + animation = new Animation(0, 0, usedUhrType->rowsWordMatrix(), + usedUhrType->colsWordMatrix()); + + if (usedUhrType->numPixelsFrameMatrix() != 0) { + secondsFrame = new SecondsFrame(usedUhrType->numPixelsFrameMatrix()); + } else { + secondsFrame = nullptr; + } //------------------------------------- // Initialize LEDs @@ -262,14 +279,6 @@ void setup() { } settimeofday_cb(time_is_set); - //------------------------------------- - // Init frontMatrix - //------------------------------------- - - for (uint16_t i = 0; i < usedUhrType->NUM_PIXELS(); i++) { - lastFrontMatrix[i] = 500; - } - //------------------------------------- // Start WiFi //------------------------------------- @@ -327,13 +336,6 @@ void setup() { MDNS.addService("http", "tcp", 80); MDNS.addService("http", "tcp", 81); - /* - // setup frame - if (usedUhrType->hasSecondsFrame() && G.secondVariant < 1 && G.minuteVariant - < 2) { led.setFrameColor(); - } - */ - //------------------------------------- Serial.println("--------------------------------------"); Serial.println("ESP Uhr"); @@ -400,5 +402,9 @@ void loop() { // make the time run faster in the demo mode of the animation animation->demoMode(_minute, _second); + if (usedUhrType->numPixelsFrameMatrix() != 0) { + secondsFrame->loop(); + } + clockWork.loop(tm); } diff --git a/webpage/index.html b/webpage/index.html index cec5bf58..45f8232f 100644 --- a/webpage/index.html +++ b/webpage/index.html @@ -170,11 +170,16 @@

Anzeigeoptionen

Front

+ + Änderungen der Matrixgröße werden erst mit einem Neustart der Uhr übernommen. +
- - - + + + +
@@ -266,11 +272,12 @@

Sekunden

- - +
diff --git a/webpage/script.js b/webpage/script.js index b2a8df4c..5f450b6c 100644 --- a/webpage/script.js +++ b/webpage/script.js @@ -344,7 +344,7 @@ function initWebsocket() { $("ldr-cal").set("value", data.ldrCal); $("#slider-brightness").set("value", data.effectBri); $("#slider-speed").set("value", data.effectSpeed); // TODO: there is no property effectSpeed! - document.getElementById("show-seconds").checked = data.secondVariant; + $("#show-seconds").set("value", data.secondVariant); $("#show-minutes").set("value", data.minuteVariant); $("#owm-api-key").set("value", data.apiKey); @@ -364,8 +364,8 @@ function initWebsocket() { enableSpecific("specific-layout-5", data.hasWeatherLayout); enableSpecific("specific-layout-6", data.UhrtypeDef === 10); // EN10x11 enableSpecific("specific-colortype-4", data.colortype === 4); - removeSpecificOption("show-minutes", "2", data.UhrtypeDef !== 4); // MinuteVariant "Row" - removeSpecificOption("show-minutes", "3", data.UhrtypeDef !== 9); // MinuteVariant "In Words" + removeSpecificOption("show-minutes", "3", data.numOfRows !== 11); // MinuteVariant "Corners" only for DE11x11 Variants + removeSpecificOption("show-minutes", "4", data.UhrtypeDef !== 9); // MinuteVariant "In Words" autoLdrEnabled = data.autoLdrEnabled; $("#auto-ldr-enabled").set("value", autoLdrEnabled); @@ -875,7 +875,7 @@ $.ready(function() { debugMessage("MinuteVariant" + debugMessageReconfigured); }); $("#show-seconds").on("change", function() { - var showSecondsValue = $("#show-seconds").get("checked") | 0; + var showSecondsValue = $("#show-seconds").get("value"); sendCmd(COMMAND_SET_SETTING_SECOND, nstr(showSecondsValue)); debugMessage("SecondVariant" + debugMessageReconfigured);