#include "U8glib.h"
#include <RTClib.h>
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); // Fast I2C / TWI
RTC_DS1307 rtc;
// ' icon_agregar', 16x16px
const unsigned char epd_bitmap__icon_agregar [] PROGMEM = {
0x00, 0x00, 0x00, 0x04, 0x0e, 0x0e, 0x11, 0x04, 0x20, 0x80, 0x20, 0x40, 0x20, 0x20, 0x10, 0x70,
0x08, 0xf8, 0x05, 0xfc, 0x03, 0x7c, 0x01, 0x9c, 0x00, 0xf8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00
};
// ' icon_eliminar', 16x16px
const unsigned char epd_bitmap__icon_eliminar [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x11, 0x00, 0x20, 0x80, 0x20, 0x40, 0x20, 0x20, 0x10, 0x70,
0x08, 0xf8, 0x05, 0xfc, 0x03, 0x7c, 0x01, 0x9c, 0x00, 0xf8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00
};
// ' icon_horario', 16x16px
const unsigned char epd_bitmap__icon_horario [] PROGMEM = {
0x00, 0x00, 0x01, 0x80, 0x0f, 0xf0, 0x31, 0x8c, 0x28, 0x14, 0x41, 0x02, 0x51, 0x0a, 0x41, 0x02,
0x61, 0x06, 0x41, 0xe2, 0x50, 0x0a, 0x40, 0x02, 0x28, 0x14, 0x31, 0x8c, 0x0f, 0xf0, 0x08, 0x10
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 144)
const unsigned char* bitmap_iconos[3] = {
epd_bitmap__icon_agregar,
epd_bitmap__icon_eliminar,
epd_bitmap__icon_horario
};
// ' parte_seleccionada', 128x21px
const unsigned char epd_bitmap__parte_seleccionada [] PROGMEM = {
0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8
};
// ' scroll_background', 8x64px
const unsigned char epd_bitmap__scroll_background [] PROGMEM = {
0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00
};
/* -----------------------------Final de imágenes MENÚ PRINCIPAL ------------------------------*/
// ' ICON_DOMINGO', 16x16px
const unsigned char epd_bitmap__ICON_DOMINGO [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x5c, 0x62, 0x52, 0x92, 0x52, 0x92,
0x52, 0x92, 0x52, 0x92, 0x52, 0x92, 0x5c, 0x6e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// ' ICON_JUEVES', 16x16px
const unsigned char epd_bitmap__ICON_JUEVES [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x42, 0xa2, 0x42, 0xa2, 0x42, 0xa2,
0x42, 0xa2, 0x52, 0xa2, 0x4c, 0x42, 0x40, 0x0e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// ' ICON_LUNES', 16x16px
const unsigned char epd_bitmap__ICON_LUNES [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x48, 0xa2, 0x48, 0xa2, 0x48, 0xa2,
0x48, 0xa2, 0x48, 0xa2, 0x4e, 0x42, 0x40, 0x0e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// ' ICON_MARTES', 16x16px
const unsigned char epd_bitmap__ICON_MARTES [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x51, 0x32, 0x5b, 0x4a, 0x55, 0x4a,
0x51, 0x7a, 0x51, 0x4a, 0x51, 0x4a, 0x40, 0x0e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// ' ICON_MIERCOLES', 16x16px
const unsigned char epd_bitmap__ICON_MIERCOLES [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x51, 0x72, 0x5b, 0x22, 0x55, 0x22,
0x51, 0x22, 0x51, 0x22, 0x51, 0x72, 0x40, 0x0e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// ' ICON_SABADO', 16x16px
const unsigned char epd_bitmap__ICON_SABADO [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x4c, 0x62, 0x4a, 0x92, 0x48, 0x92,
0x44, 0xf2, 0x42, 0x92, 0x4a, 0x92, 0x44, 0x0e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// ' ICON_VIERNES', 16x16px
const unsigned char epd_bitmap__ICON_VIERNES [] PROGMEM = {
0x00, 0x00, 0x1c, 0x38, 0x37, 0xec, 0x7f, 0xfe, 0x40, 0x02, 0x51, 0x72, 0x51, 0x22, 0x51, 0x22,
0x51, 0x22, 0x4a, 0x22, 0x44, 0x72, 0x40, 0x0e, 0x40, 0x12, 0x40, 0x14, 0x3f, 0xf8, 0x00, 0x00
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 336)
const unsigned char* bitmap_iconos_dias[7] = {
epd_bitmap__ICON_DOMINGO,
epd_bitmap__ICON_JUEVES,
epd_bitmap__ICON_LUNES,
epd_bitmap__ICON_MARTES,
epd_bitmap__ICON_MIERCOLES,
epd_bitmap__ICON_SABADO,
epd_bitmap__ICON_VIERNES
};
// ' ICON_DOS_PUNTOS', 16x16px
const unsigned char epd_bitmap__ICON_DOS_PUNTOS [] PROGMEM = {
0x00, 0x00, 0x03, 0x80, 0x07, 0xc0, 0x0f, 0xe0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x00, 0x00,
0x00, 0x00, 0x03, 0x80, 0x07, 0xc0, 0x0f, 0xe0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x00, 0x00
};
// ' ICON_MARCO', 128x64px
const unsigned char epd_bitmap__ICON_MARCO [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// ' ICON_SELECCION_DIAS', 24x18px
const unsigned char epd_bitmap__ICON_SELECCION_DIAS [] PROGMEM = {
0x1f, 0xff, 0xc0, 0x20, 0x00, 0x60, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40,
0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00,
0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30, 0x40, 0x00, 0x30,
0x20, 0x00, 0x60, 0x1f, 0xff, 0xc0
};
/* -----------------------------Final de imágenes SUBMENÚ AGREGAR PASTILLAS ------------------------------*/
#define BOTON_SELECCION 2 //Definiendo el pin donde esta el boton 1, el que selecciona
#define BOTON_ABAJO 3 //Definiendo el pin donde esta el boton 2, el que va hacía abajo
#define BOTON_ARRIBA 4 //Definiendo el pin donde esta el boton 3, el que va hacía arriba
//Para el menu principal
const int numero_de_items = 3;
char items_de_menu[numero_de_items][20]{
{"Agregar"},
{"Eliminar"},
{"Ver horario"}
};
//Para el submenu 1 de agregar pastilla
const int numero_items_submenu1 = 4;
char items_de_submenu1[numero_items_submenu1][20]{
{"Cuando?"},
{"1"},
{"30"},
{"PM"}
};
String Nombres_Dias[7] = {"Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"};
int posibles_tiempos[7][7] = {
{0,0,0,0,0,0,0}, //Cuando el día es domingo.
{0,1,2,3,4,5,6}, //Cuando el día es lunes
{0,0,1,2,3,4,5}, //Cuando el día es martes
{0,0,0,1,2,3,4}, //Cuando el día es miercoles
{0,0,0,0,1,2,3}, //Cuando el día es jueves
{0,0,0,0,0,1,2}, //Cuando el día es viernes
{0,0,0,0,0,0,1} //Cuando el día es sábado
};
const int numero_de_horas = 24;
char items_horas[numero_de_horas][20]= {
{"0"},{"1"},{"2"},{"3"},{"4"},{"5"},{"6"},{"7"},{"8"},{"9"},{"10"},
{"11"},{"12"},{"13"},{"14"},{"15"},{"16"},{"17"},{"18"},{"19"},{"20"},
{"21"},{"22"},{"23"}
};
int mover_horas[24] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
int cambiar_horas = 0;
const int numero_de_minutos = 59;
char posibles_minutos[numero_de_minutos][20] = {
{"1"},{"2"},{"3"},{"4"},{"5"},{"6"},{"7"},{"8"},{"9"},{"10"},
{"11"},{"12"},{"13"},{"14"},{"15"},{"16"},{"17"},{"18"},{"19"},{"20"},
{"21"},{"22"},{"23"},{"24"},{"25"},{"26"},{"27"},{"28"},{"29"},{"30"},
{"31"},{"32"},{"33"},{"34"},{"35"},{"36"},{"37"},{"38"},{"39"},{"40"},
{"41"},{"42"},{"43"},{"44"},{"45"},{"46"},{"47"},{"48"},{"49"},{"50"},
{"51"},{"52"},{"53"},{"54"},{"55"},{"56"},{"57"},{"58"},{"59"}
};
int items_minutos_numero[59] = {
1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,
51,52,53,54,55,56,57,58,59
};
int opcion_seleccionada = 0; //Una variable que sirve para tener control de que opción esta seleccionada.
int opcion_anterior; //Una variable para tener control de la opción anterior a la seleccionada.
int opcion_siguiente; //Una variable para tener control de la opción siguiente a la seleccionada.
int ABAJO_APRETADO = 0; //Una bandera para seleccionar y deseleccionar el boton correspondiente
int ARRIBA_APRETADO = 0; //Lo mismo de arriba
int SELECCIONADOR_APRETADO = 0; //Lo mismo de arriba
int pantalla_actual = 0; //Una variable que determinará que dibujos (opciones) mostrar en la pantalla OLED.
int dias = 0; //Una variable que moverá el frame de selección en el primer submenú
int que_dia_tengo = 0; //Una variable que sirve para ubicar
int hora_seleccionada;
int funcion_hora = 0;
//int Hora = TiempoActual.hour();
char formato1[] = "hh:mm ap";
char formato2[] = "DD/hh:mm ap";
void setup() {
Serial.begin(9600);
rtc.begin();
pinMode(BOTON_SELECCION, INPUT_PULLUP);
pinMode(BOTON_ABAJO, INPUT_PULLUP);
pinMode(BOTON_ARRIBA, INPUT_PULLUP);
u8g.setFont(u8g_font_tpssb);
u8g.setColorIndex(1);
}
void loop() {
switch(pantalla_actual) {
case 0: //Pantalla actual es igual a 0
dibujos();
if ((digitalRead(BOTON_ARRIBA) == LOW) && (ARRIBA_APRETADO == 0)) {
opcion_seleccionada--;
ARRIBA_APRETADO = 1;
if(opcion_seleccionada < 0) {
opcion_seleccionada = numero_de_items - 1;
}
}
else if ((digitalRead(BOTON_ABAJO) == LOW) && (ABAJO_APRETADO == 0)) {
opcion_seleccionada++;
ABAJO_APRETADO = 1;
if(opcion_seleccionada >= numero_de_items) {
opcion_seleccionada = 0;
}
}
if ((digitalRead(BOTON_ARRIBA) == HIGH) && (ARRIBA_APRETADO == 1)) { // unclick
ARRIBA_APRETADO = 0;
}
if ((digitalRead(BOTON_ABAJO) == HIGH) && (ABAJO_APRETADO == 1)) { // unclick
ABAJO_APRETADO = 0;
}
devolverpantalla(BOTON_SELECCION);
break;
case 1: //Pantalla actual es igual a 1
dibujosubmenu1();
botonessub1(BOTON_ARRIBA, BOTON_ABAJO);
//devolverpantalla(BOTON_SELECCION);
boton_press(BOTON_SELECCION);
break;
case 2: //Pantalla actual es igual a 2, lo que significa que estoy eliminando una pastilla
break;
case 3: //Pantalla actual es igual a 3, lo que significa que estoy viendo el horario
break;
case 4: //Pantalla actual es igual a 4, lo que significa que estoy seleccionando una hora en el submenú 1
seleccion_horas_dibujo();
temp(funcion_hora);
//confirmar_hora_minuto(BOTON_SELECCION);
seleccionador_horas(BOTON_ARRIBA, BOTON_ABAJO);
//Serial.println(alarma.toString(formato1));
//Serial.println(cambiar_horas);
//Serial.println(pantalla_actual);
break;
}
//Valores para opciones anteriores y opciones siguientes del menu principal
opcion_anterior = opcion_seleccionada - 1;
if(opcion_anterior < 0) {opcion_anterior = numero_de_items - 1;}
opcion_siguiente = opcion_seleccionada + 1;
if(opcion_siguiente >= numero_de_items) {opcion_siguiente = 0;}
}
//-------------------------------------------- FIN DE VOID LOOP -----------------------------------------
//--------------FUNCIÓN TIPO ENTERO, me devuelve el valor de cambiar horas para controlar las horas en la selección de horas-------------
int seleccionador_horas(int upbotton, int downbotton) {
if ((digitalRead(upbotton) == LOW) && (ARRIBA_APRETADO == 0)) {
ARRIBA_APRETADO = 1;
cambiar_horas--;
Serial.println(cambiar_horas);
}
else if ((digitalRead(downbotton) == LOW) && (ABAJO_APRETADO == 0)) {
ABAJO_APRETADO = 1;
cambiar_horas++;
Serial.println(cambiar_horas);
}
if (cambiar_horas < 0) {
cambiar_horas = 23;
} else if (cambiar_horas > 23) {cambiar_horas = 0;}
if ((digitalRead(upbotton) == HIGH) && (ARRIBA_APRETADO == 1)) { // unclick
ARRIBA_APRETADO = 0;
}
if ((digitalRead(downbotton) == HIGH) && (ABAJO_APRETADO == 1)) { // unclick
ABAJO_APRETADO = 0;
}
return cambiar_horas;
}
//------------------FIN DE FUNCIÓN TIPO ENTERO-----------------------
void temp(int devolver_switch) {
DateTime TiempoActual = rtc.now();
int DiaDeLaSemana = TiempoActual.dayOfTheWeek();
int dia = TiempoActual.day();
switch(devolver_switch) {
case 0: //Está en domingo
break;
case 1: //Esta en lunes
break;
case 2: //Esta en Martes
break;
case 3: //Esta en Miércoles
break;
case 4: //Está en Jueves
DateTime alarma4 = TiempoActual + TimeSpan(posibles_tiempos[DiaDeLaSemana][que_dia_tengo],0,0,0);
Serial.println(alarma4.toString(formato2));
break;
case 5: //Está en Viernes
break;
case 6: //Está en sábado
break;
}
}
void confirmar_hora_minuto(DateTime horas_alarma) {
DateTime TiempoActual = rtc.now();
int DiaDeLaSemana = TiempoActual.dayOfTheWeek();
if ((digitalRead(BOTON_SELECCION) == LOW) && (SELECCIONADOR_APRETADO == 0)) {
SELECCIONADOR_APRETADO = 1;
switch (DiaDeLaSemana) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
//Serial.println(horas_alarma.toString(formato2));
//DateTime alarma4horas = horas_alarma + TimeSpan(0,mover_horas[cambiar_horas],0,0);
//Serial.println(alarma4horas.toString(formato2));
//return alarma4horas;
break;
case 5:
break;
case 6:
break;
}
}
if ((digitalRead(BOTON_SELECCION) == HIGH) && (SELECCIONADOR_APRETADO == 1)) {
SELECCIONADOR_APRETADO = 0;
}
}
//------INICIO FUNCIÓN TIPO ENTERO, me devuelve nuevos valores para saber que mostrar en pantalla--------
int boton_press(int presionado) {
DateTime TiempoActual = rtc.now();
int DiaDeLaSemana = TiempoActual.dayOfTheWeek();
if ((digitalRead(presionado) == LOW) && (SELECCIONADOR_APRETADO == 0)) {
SELECCIONADOR_APRETADO = 1;
switch(DiaDeLaSemana) {
case 0: //Está en domingo
pantalla_actual = 4;
funcion_hora = 0;
break;
case 1: //Esta en lunes
pantalla_actual = 4;
funcion_hora = 1;
break;
case 2: //Esta en Martes
pantalla_actual = 4;
funcion_hora = 2;
break;
case 3: //Esta en Miércoles
pantalla_actual = 4;
funcion_hora = 3;
break;
case 4: //Está en Jueves
pantalla_actual = 4;
funcion_hora = 4;
break;
case 5: //Está en Viernes
pantalla_actual = 4;
funcion_hora = 5;
break;
case 6: //Está en sábado
pantalla_actual = 4;
funcion_hora = 6;
break;
}
}
if ((digitalRead(presionado) == HIGH) && (SELECCIONADOR_APRETADO == 1)) {
SELECCIONADOR_APRETADO = 0;
}
return pantalla_actual;
return funcion_hora;
}
//-------------------------Función de tipo entero que devuelve la variable pantalla actual-------------------
int devolverpantalla (int boton_select) {
DateTime TiempoActual = rtc.now();
int DiaDeLaSemana = TiempoActual.dayOfTheWeek();
int dia = TiempoActual.day();
if ((digitalRead(boton_select) == LOW) && (SELECCIONADOR_APRETADO == 0)) {
SELECCIONADOR_APRETADO = 1;
switch(opcion_seleccionada) {
case 0:
pantalla_actual = 1;
if(DiaDeLaSemana == 0) { //Cuando hoy es domingo
dias = 108;
que_dia_tengo = 0;
}
else if(DiaDeLaSemana == 1) { //Cuando hoy es lunes
dias = 0;
que_dia_tengo = 0;
}
else if(DiaDeLaSemana == 2) { //Cuando hoy es martes
dias = 18;
que_dia_tengo = 1;
}
else if(DiaDeLaSemana == 3) { //Cuando hoy es miércoles
dias = 36;
que_dia_tengo = 2;
}
else if(DiaDeLaSemana == 4) { //Cuando hoy es Jueves
dias = 54;
que_dia_tengo = 3;
}
else if(DiaDeLaSemana == 5) { //Cuando hoy es Viernes
dias = 72;
que_dia_tengo = 4;
}
else if(DiaDeLaSemana == 6) { //Cuando hoy es sábado
dias = 90;
que_dia_tengo = 5;
}
break;
case 1:
pantalla_actual = 2;
break;
case 2:
pantalla_actual = 3;
break;
}
if ((digitalRead(boton_select) == HIGH) && (SELECCIONADOR_APRETADO == 1)) {
SELECCIONADOR_APRETADO = 0;
}
return pantalla_actual;
return que_dia_tengo;
}
}
//----------------------FIN DE FUNCIÓN TIPO ENTERO--------------------------------
//-----------------------INICIO FUNCIÓN TIPO ENTERO, detecta cual botón esta siendo presionado y regresa una variable------------------
int botonessub1(int botonarriba, int botonabajo) {
if ((digitalRead(botonarriba) == LOW) && (ARRIBA_APRETADO == 0)) {
dias = dias - 18;
que_dia_tengo--;
ARRIBA_APRETADO = 1;
controlador_dias(dias, que_dia_tengo);
}
else if ((digitalRead(botonabajo) == LOW) && (ABAJO_APRETADO == 0)) {
dias = dias + 18;
que_dia_tengo++;
ABAJO_APRETADO = 1;
controlador_dias(dias, que_dia_tengo);
}
if ((digitalRead(botonarriba) == HIGH) && (ARRIBA_APRETADO == 1)) { // unclick
ARRIBA_APRETADO = 0;
}
if ((digitalRead(botonabajo) == HIGH) && (ABAJO_APRETADO == 1)) { // unclick
ABAJO_APRETADO = 0;
}
return dias; //Regresa la variable días para poder ser pasada a un void que pondrá limitaciones a la variable días
}
//-------------------------FIN DE FUNCIÓN TIPO ENTERO------------------------------------
//---------------------INICIO DE FUNCIÓN TIPO VOID 1----------------------------------------
void controlador_dias(int posicion_marco, int posicion_del_dia) {
DateTime TiempoActual = rtc.now();
int DiaDeLaSemana = TiempoActual.dayOfTheWeek();
int dia = TiempoActual.day();
if (DiaDeLaSemana == 0) { //Cuando es domingo
if(dias > 108 ) { //Se abre un filtro
dias = 108;
} else if (dias < 108) {dias = 108;}
if(que_dia_tengo < 0) {
que_dia_tengo = 0;
} else if (dias > 0) {que_dia_tengo = 0;}
}
else if(DiaDeLaSemana == 1) { //Cuando es lunes
if(dias > 108 ) {
dias = 0;
} else if (dias < 0) {dias = 108;}
if(que_dia_tengo < 0 ) {
que_dia_tengo = 6;
} else if(que_dia_tengo > 6) {que_dia_tengo = 0;}
}
else if(DiaDeLaSemana == 2) { //Cuando es martes
if(dias > 108 ) {
dias = 18;
} else if (dias < 18) {dias = 108;}
if(que_dia_tengo < 1) {
que_dia_tengo = 6;
} else if(que_dia_tengo > 6) {que_dia_tengo = 1;}
}
else if(DiaDeLaSemana == 3) { //Cuando es miércoles
if(dias > 108 ) {
dias = 36;
} else if (dias < 36) {dias = 108;}
if(que_dia_tengo < 2) {
que_dia_tengo = 6;
} else if(que_dia_tengo > 6) {que_dia_tengo = 2;}
}
else if (DiaDeLaSemana == 4) { //Cuando es jueves
if(dias > 108 ) {
dias = 54;
} else if (dias < 54) {dias = 108;}
if(que_dia_tengo < 3) {
que_dia_tengo = 6;
} else if(que_dia_tengo > 6) {que_dia_tengo = 3;}
}
else if (DiaDeLaSemana == 5) { //Cuando es viernes
if(dias > 108 ) {
dias = 72;
} else if (dias < 72) {dias = 108;}
if(que_dia_tengo < 4) {
que_dia_tengo = 6;
} else if(que_dia_tengo > 6) {que_dia_tengo = 4;}
}
else if (DiaDeLaSemana == 6) { //Cuando es sábado
if(dias > 108 ) {
dias = 90;
} else if (dias < 90) {dias = 108;}
if(que_dia_tengo < 5) {
que_dia_tengo = 6;
} else if(que_dia_tengo > 6) {que_dia_tengo = 5;}
}
}
//------------------FUNCIONES VOID SIN PARAMETRO (obligatorio de libreria para mostrar dibujo)----------------
void dibujosubmenu1() {
u8g.firstPage();
do {
u8g.setFont(u8g_font_7x14B);
u8g.drawStr(40, 14, items_de_submenu1[0]);
u8g.drawBitmapP( 2, 24, 16/8, 16, bitmap_iconos_dias[2]);
u8g.drawBitmapP( 20, 24, 16/8, 16, bitmap_iconos_dias[3]);
u8g.drawBitmapP( 38, 24, 16/8, 16, bitmap_iconos_dias[4]);
u8g.drawBitmapP( 56, 24, 16/8, 16, bitmap_iconos_dias[1]);
u8g.drawBitmapP( 74, 24, 16/8, 16, bitmap_iconos_dias[6]);
u8g.drawBitmapP( 92, 24, 16/8, 16, bitmap_iconos_dias[5]);
u8g.drawBitmapP( 110, 24, 16/8, 16, bitmap_iconos_dias[0]);
u8g.drawBitmapP( 47, 46, 16/8, 16, epd_bitmap__ICON_DOS_PUNTOS);
u8g.drawBitmapP( 0, 0, 128/8, 64, epd_bitmap__ICON_MARCO);
u8g.drawBitmapP( dias, 23, 24/8, 18, epd_bitmap__ICON_SELECCION_DIAS);
} while ( u8g.nextPage() );
}
void dibujos() {
u8g.firstPage();
do {
//Esta es la opción anterior del menú.
u8g.setFont(u8g_font_7x14);
u8g.drawStr(11, 14, items_de_menu[opcion_anterior]);
u8g.drawBitmapP( 108, 2, 16/8, 16, bitmap_iconos[opcion_anterior]);
//Esta es la opción que esta siendo seleccionada.
u8g.setFont(u8g_font_7x14B);
u8g.drawStr(11, 35, items_de_menu[opcion_seleccionada]);
u8g.drawBitmapP( 108, 24, 16/8, 16, bitmap_iconos[opcion_seleccionada]);
//Esta es la siguiente opción del menú
u8g.setFont(u8g_font_7x14);
u8g.drawStr(11, 58, items_de_menu[opcion_siguiente]);
u8g.drawBitmapP( 108, 46, 16/8, 16, bitmap_iconos[opcion_siguiente]);
u8g.drawBitmapP( 0, 22, 128/8, 21, epd_bitmap__parte_seleccionada);
u8g.drawBitmapP( 0, 0, 8/8, 64, epd_bitmap__scroll_background);
} while ( u8g.nextPage() );
}
void seleccion_horas_dibujo() {
u8g.firstPage();
do {
u8g.setFont(u8g_font_7x14);
u8g.drawStr(40, 14, items_de_submenu1[0]);
u8g.drawStr(33,59, items_horas[cambiar_horas]);
u8g.drawBitmapP( 2, 24, 16/8, 16, bitmap_iconos_dias[2]);
u8g.drawBitmapP( 20, 24, 16/8, 16, bitmap_iconos_dias[3]);
u8g.drawBitmapP( 38, 24, 16/8, 16, bitmap_iconos_dias[4]);
u8g.drawBitmapP( 56, 24, 16/8, 16, bitmap_iconos_dias[1]);
u8g.drawBitmapP( 74, 24, 16/8, 16, bitmap_iconos_dias[6]);
u8g.drawBitmapP( 92, 24, 16/8, 16, bitmap_iconos_dias[5]);
u8g.drawBitmapP( 110, 24, 16/8, 16, bitmap_iconos_dias[0]);
u8g.drawBitmapP( 47, 46, 16/8, 16, epd_bitmap__ICON_DOS_PUNTOS);
u8g.drawBitmapP( 0, 0, 128/8, 64, epd_bitmap__ICON_MARCO);
u8g.drawBitmapP(29, 43, 24/8, 18, epd_bitmap__ICON_SELECCION_DIAS);
} while ( u8g.nextPage() );
}
//--------------------------FIN DE FUNCIONES VOID SIN PARAMETRO OBLIGATORIAS-----------------------