diff --git a/.gitignore b/.gitignore index 722d5e7..96109b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -.vscode +debug.cfg +debug_custom.json +esp32.svd +.vscode/ diff --git a/README.md b/README.md index 8e2abc2..ae8d0a0 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,21 @@ A happy setup will cycle through each color once, and then display orange for a while. +Clock +----- + +At night, +and sometimes during the day, +it displays something like a clock. +You will need to tell it your time zone. +It doesn't do daylight saving time, sorry. +I suggest you set it to standard time and pretend it's in sync with the sun. + +* Each pixel in the top row is 1 hour (3600 seconds) +* Each pixel in the middle row is 5 minutes (300 seconds) +* Each pixel in the bottom row is 25 seconds +* There are four pixels around the bottom that move every 5 seconds + Philosophy ---------- diff --git a/wallart.ino b/wallart.ino index c56c4b5..171d024 100644 --- a/wallart.ino +++ b/wallart.ino @@ -250,15 +250,28 @@ void displayTime(unsigned long duration = 20 * SECOND) { while (millis() < end) { timeClient.update(); int hh = timeClient.getHours(); - int mm = timeClient.getMinutes(); - int ss = timeClient.getSeconds(); + int mmss = timeClient.getMinutes()*60 + timeClient.getSeconds(); uint8_t hue = HUE_YELLOW; + // Top: Hours if (hh >= 12) { hue = HUE_ORANGE; hh -= 12; } + // Middle: 5m (300s) + uint8_t mm = (mmss/300) % 12; + + // Bottom: 25s + uint8_t ss = (mmss/25) % 12; + + // Outer: 5s + uint8_t s = (mmss/5) % 5; + grid[64 - 7 - 1] = CHSV(HUE_PURPLE, 64, (s==1)?64:0); + grid[64 - 15 - 1] = CHSV(HUE_PURPLE, 64, (s==2)?64:0); + grid[64 - 8 - 1] = CHSV(HUE_PURPLE, 64, (s==3)?64:0); + grid[64 - 0 - 1] = CHSV(HUE_PURPLE, 64, (s==4)?64:0); + for (int i = 0; i < 12; i++) { // Omit first and last position on a row int pos = i + 1; @@ -267,8 +280,8 @@ void displayTime(unsigned long duration = 20 * SECOND) { } grid[pos + 0] = CHSV(hue, 255, (i