diff --git a/include/animation_functions.h b/include/animation_functions.h index 52fc491..d5aa402 100644 --- a/include/animation_functions.h +++ b/include/animation_functions.h @@ -2,6 +2,7 @@ #define ANIMATIONFUNCTIONS_H #include +#include "wordclock_constants.h" enum Direction { @@ -14,7 +15,737 @@ enum Direction Direction next_direction(Direction dir, int d); int random_snake(bool init, const uint8_t len, const uint32_t color, int numSteps); int random_tetris(bool init); +int draw_heart_animation(void); int draw_spiral(bool init, bool empty, uint8_t size); void show_digital_clock(uint8_t hours, uint8_t minutes, uint32_t color); -#endif /* ANIMATIONFUNCTIONS_H */ +#define HEART_ANIMATION_FRAMES 5 +const uint32_t heart_frames_colormap_11x11[HEART_ANIMATION_FRAMES][MATRIX_WIDTH][MATRIX_HEIGHT] = + { + { + { + 0x005b000a, + 0x002d0304, + 0x000f0002, + 0x00090001, + 0x00350306, + 0x00530103, + 0x00310407, + 0x000a0104, + 0x00090001, + 0x00300306, + 0x00570006, + }, + { + 0x00330206, + 0x00090000, + 0x00ce0404, + 0x00d70300, + 0x000f0008, + 0x00350306, + 0x000b0100, + 0x00c70600, + 0x00d40201, + 0x00080202, + 0x00390006, + }, + { + 0x000a0000, + 0x00db0503, + 0x00940906, + 0x00950a03, + 0x00e20100, + 0x000e0008, + 0x00d00000, + 0x00960806, + 0x00940605, + 0x00d50600, + 0x000d0103, + }, + { + 0x00da010c, + 0x00940700, + 0x00580000, + 0x00570104, + 0x00940a0a, + 0x00d40100, + 0x00940a08, + 0x005a0006, + 0x005b0005, + 0x009d0305, + 0x00da0300, + }, + { + 0x00d70707, + 0x00910a06, + 0x00560202, + 0x00570207, + 0x00580007, + 0x00900a09, + 0x00540109, + 0x005a0004, + 0x005b0007, + 0x00910a04, + 0x00d40201, + }, + { + 0x00da0207, + 0x0092070c, + 0x005b0002, + 0x00330005, + 0x00300405, + 0x00580308, + 0x002e0503, + 0x002c0404, + 0x005a0004, + 0x00970609, + 0x00d80202, + }, + { + 0x00040402, + 0x00dc0600, + 0x008f0a0b, + 0x00590006, + 0x00310504, + 0x00320406, + 0x00330507, + 0x00620008, + 0x00960709, + 0x00dd0301, + 0x000d0304, + }, + { + 0x00330205, + 0x00090100, + 0x00d8020a, + 0x00930906, + 0x00570209, + 0x00330205, + 0x00580007, + 0x00980808, + 0x00d60200, + 0x000d0003, + 0x00340205, + }, + { + 0x00560008, + 0x00340306, + 0x00100001, + 0x00d40a00, + 0x009e0507, + 0x005c0007, + 0x009e0508, + 0x00e50000, + 0x000e0001, + 0x00310305, + 0x00590004, + }, + { + 0x00a00606, + 0x00580007, + 0x00350304, + 0x00100001, + 0x00d40404, + 0x00940902, + 0x00d50407, + 0x00000205, + 0x00350304, + 0x00560108, + 0x00900906, + }, + { + 0x00d90104, + 0x008d080b, + 0x0060000b, + 0x00340106, + 0x00050100, + 0x00e00106, + 0x000f0000, + 0x00370003, + 0x00570104, + 0x00950a07, + 0x00e10007, + }, + }, + { + { + 0x00310304, + 0x000b0001, + 0x00da0308, + 0x00d90101, + 0x000b0001, + 0x00310304, + 0x000b0001, + 0x00d60101, + 0x00d60101, + 0x000b0001, + 0x00310304, + }, + { + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00d60101, + 0x00940808, + 0x00940808, + 0x00d60101, + 0x000b0001, + }, + { + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00590005, + 0x00940808, + 0x00d90101, + 0x00940808, + 0x00560004, + 0x00590005, + 0x00940808, + 0x00d60101, + }, + { + 0x00940808, + 0x00590005, + 0x00370803, + 0x00310304, + 0x00590005, + 0x00940808, + 0x00590005, + 0x00310304, + 0x00310304, + 0x00590005, + 0x00940808, + }, + { + 0x00940808, + 0x00590005, + 0x002c0303, + 0x00310304, + 0x00310304, + 0x00560004, + 0x00310304, + 0x00310304, + 0x00310304, + 0x00590005, + 0x00940808, + }, + { + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x000b0001, + 0x00130102, + 0x00310304, + 0x00590005, + 0x00940808, + }, + { + 0x00d60101, + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x00590005, + 0x00940808, + 0x00d90101, + }, + { + 0x000b0001, + 0x00d90802, + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00310304, + 0x00560004, + 0x00940808, + 0x00d90101, + 0x000b0001, + }, + { + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00310304, + 0x00590005, + 0x00940808, + 0x00d90802, + 0x000b0001, + 0x00310304, + }, + { + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00560004, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00310304, + 0x00560004, + }, + { + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00d60101, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00310304, + 0x00590005, + 0x00940808, + }, + }, + { + { + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00d90101, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00d90101, + 0x000b0001, + }, + { + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00590005, + 0x00940808, + 0x00d90101, + 0x00940808, + 0x00560004, + 0x00560004, + 0x00940808, + 0x00d90101, + }, + { + 0x00940808, + 0x00590005, + 0x002d0303, + 0x00320508, + 0x00590005, + 0x00940808, + 0x00590005, + 0x002d0303, + 0x00310304, + 0x00560004, + 0x00940808, + }, + { + 0x00560004, + 0x00320508, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x00590005, + 0x002f0308, + 0x000b0001, + 0x000b0001, + 0x002d0303, + 0x00590005, + }, + { + 0x00560004, + 0x002d0303, + 0x000b0001, + 0x000b0001, + 0x000b0001, + 0x00320508, + 0x000b0001, + 0x000b0001, + 0x000b0001, + 0x002d0303, + 0x00590005, + }, + { + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00d40809, + 0x00d90101, + 0x000b0001, + 0x00d90101, + 0x00d90101, + 0x000b0001, + 0x003b0203, + 0x00590005, + }, + { + 0x00940808, + 0x00590005, + 0x002d0303, + 0x000b0001, + 0x00d90101, + 0x00d40809, + 0x00d90101, + 0x000b0001, + 0x002d0303, + 0x00590005, + 0x00940808, + }, + { + 0x00d40809, + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x000b0001, + 0x00320508, + 0x00590005, + 0x00940808, + 0x00d90101, + }, + { + 0x000b0001, + 0x00d60101, + 0x00940808, + 0x005a0209, + 0x002d0303, + 0x000b0001, + 0x00310304, + 0x00560004, + 0x00940808, + 0x00d90101, + 0x000b0001, + }, + { + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00310304, + 0x00590005, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00310304, + }, + { + 0x00560004, + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00310304, + 0x00590005, + }, + }, + { + { + 0x00d80802, + 0x00940808, + 0x00590004, + 0x00590004, + 0x00940808, + 0x00d90101, + 0x00940808, + 0x00590004, + 0x00590004, + 0x00940808, + 0x00d90101, + }, + { + 0x00940808, + 0x00560004, + 0x00310304, + 0x00310304, + 0x00560004, + 0x00940808, + 0x00590004, + 0x002a0309, + 0x00310304, + 0x00590004, + 0x00940808, + }, + { + 0x00590004, + 0x00310304, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x00590004, + 0x00310304, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x00560004, + }, + { + 0x00350408, + 0x000b0001, + 0x00d80802, + 0x00d60101, + 0x000b0001, + 0x00310304, + 0x000b0001, + 0x00d60101, + 0x00d60101, + 0x000b0001, + 0x00310304, + }, + { + 0x002c0303, + 0x00130102, + 0x00d60101, + 0x00d60101, + 0x00d80802, + 0x000b0001, + 0x00d90101, + 0x00d60101, + 0x00d80802, + 0x000b0001, + 0x00310304, + }, + { + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00db0209, + 0x00940808, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00310304, + }, + { + 0x00590004, + 0x00310304, + 0x000b0001, + 0x00d80802, + 0x00940808, + 0x00940808, + 0x00940808, + 0x00d90101, + 0x000b0001, + 0x003b0303, + 0x00560004, + }, + { + 0x00940808, + 0x00590004, + 0x00350408, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00d90101, + 0x000b0001, + 0x00310304, + 0x00590004, + 0x00940808, + }, + { + 0x00d90101, + 0x00940808, + 0x00590004, + 0x002e0804, + 0x00130102, + 0x00d60101, + 0x000b0001, + 0x00310304, + 0x00590004, + 0x00940808, + 0x00d90101, + }, + { + 0x000b0001, + 0x00e10102, + 0x00940808, + 0x00590004, + 0x002c0303, + 0x000b0001, + 0x003b0303, + 0x00590004, + 0x00940808, + 0x00d90101, + 0x000b0001, + }, + { + 0x00310304, + 0x000b0001, + 0x00d80802, + 0x00940808, + 0x00560004, + 0x00310304, + 0x00590004, + 0x00940808, + 0x00d90101, + 0x000b0001, + 0x00310304, + }, + }, + { + { + 0x00940808, + 0x00590005, + 0x00310304, + 0x00310304, + 0x00560004, + 0x00940808, + 0x00590005, + 0x002c0303, + 0x00310304, + 0x00560004, + 0x00940808, + }, + { + 0x00560004, + 0x00310304, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x000b0001, + 0x00310304, + 0x00590005, + }, + { + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00d90101, + 0x000b0001, + 0x002c0303, + 0x000b0001, + 0x00d90101, + 0x00cf0804, + 0x000b0001, + 0x00310304, + }, + { + 0x000b0001, + 0x00d60101, + 0x00940808, + 0x00940808, + 0x00e10102, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00d90101, + 0x000b0001, + }, + { + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00940808, + 0x00d90101, + 0x00940808, + 0x00940808, + 0x00940808, + 0x00cf0804, + 0x000b0001, + }, + { + 0x000b0001, + 0x00da0308, + 0x00940808, + 0x00590005, + 0x00590005, + 0x00940808, + 0x00590005, + 0x00590005, + 0x00940808, + 0x00d90101, + 0x000b0001, + }, + { + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00590005, + 0x00560004, + 0x00940808, + 0x00d90101, + 0x000b0001, + 0x00310304, + }, + { + 0x005a0109, + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00560004, + 0x00940808, + 0x00cf0804, + 0x000b0001, + 0x00310304, + 0x00590005, + }, + { + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00e10102, + 0x00940808, + 0x00d60101, + 0x000b0001, + 0x00310304, + 0x00590005, + 0x00940808, + }, + { + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x00d90101, + 0x00130102, + 0x00310304, + 0x00590005, + 0x00940808, + 0x00e10102, + }, + { + 0x000b0001, + 0x00d90101, + 0x00940808, + 0x00590005, + 0x00310304, + 0x000b0001, + 0x002c0303, + 0x00560004, + 0x00940808, + 0x00d90101, + 0x00130102, + }, + }}; + +#endif /* ANIMATIONFUNCTIONS_H */ diff --git a/include/led_matrix.h b/include/led_matrix.h index 43ab1b0..7084e8c 100644 --- a/include/led_matrix.h +++ b/include/led_matrix.h @@ -44,10 +44,10 @@ private: uint32_t _current_grid[MATRIX_HEIGHT][MATRIX_WIDTH] = {0}; // target representation of minutes indicator leds - uint32_t _target_indicators[4] = {0, 0, 0, 0}; + uint32_t _target_minute_indicators[4] = {0, 0, 0, 0}; // current representation of minutes indicator leds - uint32_t _current_indicators[4] = {0, 0, 0, 0}; + uint32_t _current_minute_indicators[4] = {0, 0, 0, 0}; void _draw_on_matrix(float factor); uint16_t _calc_estimated_led_current(uint32_t color); diff --git a/include/wordclock_constants.h b/include/wordclock_constants.h index 2c95014..f1d4cc9 100644 --- a/include/wordclock_constants.h +++ b/include/wordclock_constants.h @@ -65,7 +65,5 @@ typedef enum #define MATRIX_WIDTH 11 #define MATRIX_HEIGHT 11 -// State machine states count -#define NUM_STATES 6 #endif /* WORDCLOCK_CONSTANTS_H */ diff --git a/include/wordclock_esp8266.h b/include/wordclock_esp8266.h index 83228ac..3fdbf93 100644 --- a/include/wordclock_esp8266.h +++ b/include/wordclock_esp8266.h @@ -18,15 +18,19 @@ typedef struct int nightmode_end_min; } NightModeTimes_st; -typedef enum +typedef enum { ST_CLOCK, ST_DICLOCK, ST_SPIRAL, ST_TETRIS, ST_SNAKE, - ST_PINGPONG -} clock_state_en; + ST_PINGPONG, + ST_HEARTS, + NUM_STATES +} ClockState_en; + +#define CURRENT_TIME_MS (system_get_time() / 1000) // use ESP time interface int EEPROM_read_address(int address); String leading_zero2digit(int value); @@ -38,7 +42,7 @@ void handle_current_state(void); void handle_data_request(void); void handle_led_direct(void); void load_main_color(void); -void ntp_time_update(void); +void ntp_time_update(unsigned long *last_ntp_update); void on_state_entry(uint8_t state); void send_heartbeat(void); void set_main_color(uint8_t red, uint8_t green, uint8_t blue); diff --git a/res/webserver/fs.html b/res/webserver/fs.html index 97f1ee9..5b49150 100644 --- a/res/webserver/fs.html +++ b/res/webserver/fs.html @@ -1,80 +1,83 @@ - - + + Filesystem Manager - - + + +

ESP8266 Filesystem Manager

- - + +
- - + +
- +
- - + + + \ No newline at end of file diff --git a/res/webserver/icons/hearts.svg b/res/webserver/icons/hearts.svg new file mode 100644 index 0000000..87e1fb3 --- /dev/null +++ b/res/webserver/icons/hearts.svg @@ -0,0 +1,71 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/res/webserver/index.html b/res/webserver/index.html index 059fefa..ca338b0 100644 --- a/res/webserver/index.html +++ b/res/webserver/index.html @@ -1,565 +1,627 @@ - + + - - WORDCLOCK 2.0 - + - -
- -

WORDCLOCK 2.0

- -
-
- - -
-
- - -
-
- - -
-
SAVE
+ +
+ +

WORDCLOCK 2.0

+ +
+
+ + +
+
+ + +
+
+ + +
+
SAVE
+
+ +
+
+
+ MODE +
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+ +