// // Created by lukas on 06.03.21. // #ifndef LEDSTRIPINTERFACE_CLOCK_H #define LEDSTRIPINTERFACE_CLOCK_H #include "Arduino.h" #include #include "Adafruit_NeoPixel.h" #include "Arduino.h" #include "LoadAnimator.h" // define the strip length of the wordclock #define NUMPIXELS 108 // define the esp pin the stip is attached to #define STRIPPIN D5 #define DAYBRIGHTNESS 150 #define NIGHTBRIGHTNESS 0 class Clock { private: Adafruit_NeoPixel strip{}; LoadAnimator animator; Ticker refreshTicker; bool twentyAfterSyntax; bool clockAlwaysOn; /** * display the words which are always on (Es ist...) */ void paintAlwaysOnLeds(); /** * paint a specific word * @param word word pointer to print * @param color the color in which to print it */ void printWord(const std::vector& word, uint32_t color); /** * logic to print the correct minute word and its corresponding wods * @param minuteSelector a number between 0 - 11 representing the minute in 5min distances * @param twentyAfterSyntax whether to use a twenty after syntax or a 10min before half syntax */ void printMinutes(uint8_t minuteSelector, bool twentyAfterSyntax); /** * set the whole time of the clock * @param hour hour to set (0-24) * @param minute minute to set(0-59) * @param twentyAfterSyntax whether to use a twenty after syntax or a 10min before half syntax * @param alwaysClockWord print the UHR word always and not only on full hours */ void setTime(uint8_t hour, uint8_t minute, bool twentyAfterSyntax = false, bool alwaysClockWord = false); /** * load the current time and set it onto the clock */ void refreshTime(); public: Clock(); /** * initialize the strip and wordclock functions */ void init(); /** * turn off the wordclock */ void turnOff(); /** * turn on the wordclock */ void turnOn(); void useTwentyAfterSyntax(bool twentyAFterSyntax); void useAlwaysOnUhrSyntax(bool alwaysOnUhr); void update(); }; #endif // LEDSTRIPINTERFACE_CLOCK_H