I had a RAM issue, but I converted all the const to PROGMEM
icons.h
static const int CLOCK_X[] PROGMEM =
{
1,2,3,4,5,6,7,8,
0, 4, 9,
0, 4, 9,
0, 4, 9,
0, 4,5,6,7,8,9,
0, 9,
0, 9,
1,2,3,4,5,6,7,8,
};
static const int CLOCK_Y[] PROGMEM =
{
0,0,0,0,0,0,0,0,
1,1,1,
2,2,2,
3,3,3,
4,4,4,4,4,4,4,
5,5,
6,6,
7,7,7,7,7,7,7,7,
};
const int CLOCK_C[] =
{
matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(0, 191, 255),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(0, 191, 255),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(0, 191, 255),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(0, 191, 255),matrix.Color(0, 191, 255),matrix.Color(0, 191, 255),matrix.Color(0, 191, 255),matrix.Color(0, 191, 255),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),
matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),matrix.Color(255, 255, 0),
};
const int CLOCK_N PROGMEM = sizeof(CLOCK_X)/sizeof(int);
const int DOTS_X[] PROGMEM =
{
19,
19,
};
const int DOTS_Y[] PROGMEM =
{
1,
3,
};
const int DOTS_C[] =
{
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
};
const int DOTS_N PROGMEM = sizeof(DOTS_X)/sizeof(int);
const int SUNNY_X[] PROGMEM =
{
2,3,7,8,
0,2,3,4,5,6,7,8,10,
2,3,4,5,6,7,8,
2,3,4,5,6,7,8,
0,2,3,4,5,6,7,8,10,
2,3,7,8,
};
const int SUNNY_Y[] PROGMEM =
{
0,0,0,0,
2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,
4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,
7,7,7,7,
};
const int SUNNY_C[] =
{
matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),
matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),
matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),
matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),
matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),
matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),matrix.Color(255,255,153),
};
const int SUNNY_N PROGMEM = sizeof(SUNNY_X)/sizeof(int);
const int CLOUDY_X[] PROGMEM = {
6,7,8,9,
2,4,5,6,7,8,9,10,
1,2,3,4,5,6,7,8,9,10,
2,3,4,5,6,7,8,9,10,
1,2,3,4,5,6,7,8,9,
};
const int CLOUDY_Y[] PROGMEM = {
0,0,0,0,
1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,4,
};
const int CLOUDY_C[] = {
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
};
const int CLOUDY_N PROGMEM= sizeof(CLOUDY_X)/sizeof(int);
const int RAINNY_X[] PROGMEM = {
6,7,8,9,
2,4,5,6,7,8,9,10,
1,2,3,4,5,6,7,8,9,10,
2,3,4,5,6,7,8,9,10,
1,2,3,4,5,6,7,8,9,
2,4,6,8,
3,5,7,9,
4,6,8,10,
};
const int RAINNY_Y[] PROGMEM = {
0,0,0,0,
1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,4,
5,5,5,5,
6,6,6,6,
7,7,7,7,
};
const int RAINNY_C[] = {
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),
matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),
matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),matrix.Color(68, 166, 198),
};
const int RAINNY_N PROGMEM = sizeof(RAINNY_X)/sizeof(int);
const int SNOWY_X[] PROGMEM = {
6,7,8,9,
2,4,5,6,7,8,9,10,
1,2,3,4,5,6,7,8,9,10,
2,3,4,5,6,7,8,9,10,
1,2,3,4,5,6,7,8,9,
2,4,6,8,
3,5,7,9,
4,6,8,10,
};
const int SNOWY_Y[] PROGMEM = {
0,0,0,0,
1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,4,
5,5,5,5,
6,6,6,6,
7,7,7,7,
};
const int SNOWY_C[] = {
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int SNOWY_N PROGMEM = sizeof(RAINNY_X)/sizeof(int);
const int TIME_MODE_X[] PROGMEM =
{
13,14,15,16,
18,19,20,21,
23,24,25,26,
};
const int TIME_MODE_Y[] PROGMEM =
{
6,6,6,6,
6,6,6,6,
6,6,6,6,
};
const int TIME_MODE_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
};
const int TIME_MODE_N PROGMEM = sizeof(TIME_MODE_X)/sizeof(int);
const int WEATHER_MODE_X[] PROGMEM =
{
13,14,15,16,
18,19,20,21,
23,24,25,26,
};
const int WEATHER_MODE_Y[] PROGMEM =
{
6,6,6,6,
6,6,6,6,
6,6,6,6,
};
const int WEATHER_MODE_C[] =
{
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
};
const int WEATHER_MODE_N PROGMEM = sizeof(TIME_MODE_X)/sizeof(int);
const int CRONOMETER_MODE_X[] PROGMEM =
{
13,14,15,16,
18,19,20,21,
23,24,25,26,
};
const int CRONOMETER_MODE_Y[] PROGMEM =
{
6,6,6,6,
6,6,6,6,
6,6,6,6,
};
const int CRONOMETER_MODE_C[] =
{
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),matrix.Color(128, 128, 128),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int CRONOMETER_MODE_N PROGMEM = sizeof(TIME_MODE_X)/sizeof(int);
numbers.h
const int ZERO_X[] PROGMEM =
{
11,12,13,
11,13,
11,13,
11,13,
11,12,13,
};
const int ZERO_Y[] PROGMEM =
{
0,0,0,
1,1,
2,2,
3,3,
4,4,4,
};
const int ZERO_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int ZERO_N = sizeof(ZERO_X)/sizeof(int);
const int ONE_X[] PROGMEM =
{
12,
11,12,
12,
12,
11,12,13,
};
const int ONE_Y[] PROGMEM =
{
0,
1,1,
2,
3,
4,4,4
};
const int ONE_C[] =
{
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int ONE_N = sizeof(ONE_X)/sizeof(int);
const int TWO_X[] PROGMEM =
{
11,12,13,
13,
11,12,13,
11,
11,12,13
};
const int TWO_Y[] PROGMEM =
{
0,0,0,
1,
2,2,2,
3,
4,4,4,
};
const int TWO_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int TWO_N = sizeof(TWO_X)/sizeof(int);
const int THREE_X[] PROGMEM =
{
11,12,13,
13,
11,12,13,
13,
11,12,13,
};
const int THREE_Y[] PROGMEM =
{
0,0,0,
1,
2,2,2,
3,
4,4,4,
};
const int THREE_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int THREE_N = sizeof(THREE_X)/sizeof(int);
const int FOUR_X[] PROGMEM =
{
11, 13,
11, 13,
11,12,13,
13,
13,
};
const int FOUR_Y[] PROGMEM =
{
0,0,
1,1,
2,2,2,
3,
4,
};
const int FOUR_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
};
const int FOUR_N = sizeof(FOUR_X)/sizeof(int);
const int FIVE_X[] PROGMEM =
{
11,12,13,
11,
11,12,13,
13,
11,12,13,
};
const int FIVE_Y[] PROGMEM =
{
0,0,0,
1,
2,2,2,
3,
4,4,4,
};
const int FIVE_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int FIVE_N = sizeof(FIVE_X)/sizeof(int);
const int SIX_X[] PROGMEM =
{
11,12,13,
11,
11,12,13,
11, 13,
11,12,13,
};
const int SIX_Y[] PROGMEM =
{
0,0,0,
1,
2,2,2,
3 ,3,
4,4,4,
};
const int SIX_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int SIX_N = sizeof(SIX_X)/sizeof(int);
const int SEVEN_X[] PROGMEM =
{
11,12,13,
13,
13,
13,
13,
};
const int SEVEN_Y[] PROGMEM =
{
0,0,0,
1,
2,
3,
4,
};
const int SEVEN_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
};
const int SEVEN_N = sizeof(SEVEN_X)/sizeof(int);
const int EIGHT_X[] PROGMEM =
{
11,12,13,
11, 13,
11,12,13,
11, 13,
11,12,13,
};
const int EIGHT_Y[] PROGMEM =
{
0,0,0,
1,1,
2,2,2,
3,3,
4,4,4,
};
const int EIGHT_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int EIGHT_N = sizeof(EIGHT_X)/sizeof(int);
const int NINE_X[] PROGMEM =
{
11,12,13,
11, 13,
11,12,13,
13,
11,12,13,
};
const int NINE_Y[] PROGMEM =
{
0,0,0,
1,1,
2,2,2,
3,
4,4,4,
};
const int NINE_C[] =
{
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),
matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),matrix.Color(255, 255, 255),
};
const int NINE_N = sizeof(NINE_X)/sizeof(int);
matrix_draw_utils.h
#include <avr/pgmspace.h>
void drawIcon(int xA[] PROGMEM, int yA[] PROGMEM, int cA[], int n, int plus) {
for (int i=0;i<n;i++) {
int x = pgm_read_word_near(&(xA[i]));
int y = pgm_read_word_near(&(yA[i]));
int color = cA[i];
matrix.drawPixel(x+plus, (uint16_t) y, (uint16_t) color);
}
}
int i;
void drawDots() {
int interval = 75;
if (i >= interval) {
drawIcon(DOTS_X, DOTS_Y, DOTS_C, DOTS_N, 0);
}
if (i < interval) {
int colors[] =
{
matrix.Color(0,0,0),matrix.Color(0,0,0),
};
drawIcon(DOTS_X, DOTS_Y, colors, DOTS_N, 0);
if (i == 0) i = interval*2;
}
i--;
}
void drawTime() {
DateTime now = rtc.now();
int hour = now.hour();
String hourString = String(hour);
char hourFirstDigit = hourString.charAt(0);
char hourSecondDigit = hourString.charAt(1);
if (hour < 10) {
hourSecondDigit = hourFirstDigit;
hourFirstDigit = '0';
}
switch (hourFirstDigit) {
case '0':
drawIcon(ZERO_X, ZERO_Y, ZERO_C, ZERO_N, 0);
break;
case '1':
drawIcon(ONE_X, ONE_Y, ONE_C, ONE_N, 0);
break;
case '2':
drawIcon(TWO_X, TWO_Y, TWO_C, TWO_N, 0);
break;
case '3':
drawIcon(THREE_X, THREE_Y, THREE_C, THREE_N, 0);
break;
case '4':
drawIcon(FOUR_X, FOUR_Y, FOUR_C, FOUR_N, 0);
break;
case '5':
drawIcon(FIVE_X, FIVE_Y, FIVE_C, FIVE_N, 0);
break;
case '6':
drawIcon(SIX_X, SIX_Y, SIX_C, SIX_N, 0);
break;
case '7':
drawIcon(SEVEN_X, SEVEN_Y, SEVEN_C, SEVEN_N, 0);
break;
case '8':
drawIcon(EIGHT_X, EIGHT_Y, EIGHT_C, EIGHT_N, 0);
break;
case '9':
drawIcon(NINE_X, NINE_Y, NINE_C, NINE_N, 0);
break;
}
if (hourSecondDigit != NULL) {
int plus = 4;
switch (hourSecondDigit) {
case '0':
drawIcon(ZERO_X, ZERO_Y, ZERO_C, ZERO_N, plus);
break;
case '1':
drawIcon(ONE_X, ONE_Y, ONE_C, ONE_N, plus);
break;
case '2':
drawIcon(TWO_X, TWO_Y, TWO_C, TWO_N, plus);
break;
case '3':
drawIcon(THREE_X, THREE_Y, THREE_C, THREE_N, plus);
break;
case '4':
drawIcon(FOUR_X, FOUR_Y, FOUR_C, FOUR_N, plus);
break;
case '5':
drawIcon(FIVE_X, FIVE_Y, FIVE_C, FIVE_N, plus);
break;
case '6':
drawIcon(SIX_X, SIX_Y, SIX_C, SIX_N, plus);
break;
case '7':
drawIcon(SEVEN_X, SEVEN_Y, SEVEN_C, SEVEN_N, plus);
break;
case '8':
drawIcon(EIGHT_X, EIGHT_Y, EIGHT_C, EIGHT_N, plus);
break;
case '9':
drawIcon(NINE_X, NINE_Y, NINE_C, NINE_N, plus);
break;
}
}
drawDots();
int minute = now.minute();
String minuteString = String(minute);
char minuteFirstDigit = minuteString.charAt(0);
char minuteSecondDigit = minuteString.charAt(1);
if (minute < 10) {
minuteSecondDigit = minuteFirstDigit;
minuteFirstDigit = '0';
}
switch (minuteFirstDigit) {
case '0':
drawIcon(ZERO_X, ZERO_Y, ZERO_C, ZERO_N, 10);
break;
case '1':
drawIcon(ONE_X, ONE_Y, ONE_C, ONE_N, 10);
break;
case '2':
drawIcon(TWO_X, TWO_Y, TWO_C, TWO_N, 10);
break;
case '3':
drawIcon(THREE_X, THREE_Y, THREE_C, THREE_N, 10);
break;
case '4':
drawIcon(FOUR_X, FOUR_Y, FOUR_C, FOUR_N, 10);
break;
case '5':
drawIcon(FIVE_X, FIVE_Y, FIVE_C, FIVE_N, 10);
break;
case '6':
drawIcon(SIX_X, SIX_Y, SIX_C, SIX_N, 10);
break;
case '7':
drawIcon(SEVEN_X, SEVEN_Y, SEVEN_C, SEVEN_N, 10);
break;
case '8':
drawIcon(EIGHT_X, EIGHT_Y, EIGHT_C, EIGHT_N, 10);
break;
case '9':
drawIcon(NINE_X, NINE_Y, NINE_C, NINE_N, 10);
break;
}
if (minuteSecondDigit != NULL) {
int plus = 14;
switch (minuteSecondDigit) {
case '0':
drawIcon(ZERO_X, ZERO_Y, ZERO_C, ZERO_N, plus);
break;
case '1':
drawIcon(ONE_X, ONE_Y, ONE_C, ONE_N, plus);
break;
case '2':
drawIcon(TWO_X, TWO_Y, TWO_C, TWO_N, plus);
break;
case '3':
drawIcon(THREE_X, THREE_Y, THREE_C, THREE_N, plus);
break;
case '4':
drawIcon(FOUR_X, FOUR_Y, FOUR_C, FOUR_N, plus);
break;
case '5':
drawIcon(FIVE_X, FIVE_Y, FIVE_C, FIVE_N, plus);
break;
case '6':
drawIcon(SIX_X, SIX_Y, SIX_C, SIX_N, plus);
break;
case '7':
drawIcon(SEVEN_X, SEVEN_Y, SEVEN_C, SEVEN_N, plus);
break;
case '8':
drawIcon(EIGHT_X, EIGHT_Y, EIGHT_C, EIGHT_N, plus);
break;
case '9':
drawIcon(NINE_X, NINE_Y, NINE_C, NINE_N, plus);
break;
}
}
}
void drawWeatherIcon() {
WMO w = deserializeWmoCode(wmo.toInt());
switch (w) {
case SUNNY:
drawIcon(SUNNY_X, SUNNY_Y, SUNNY_C, SUNNY_N, 0);
break;
case CLOUDY:
drawIcon(CLOUDY_X, CLOUDY_Y, CLOUDY_C, CLOUDY_N, 0);
break;
case RAINNY:
drawIcon(RAINNY_X, RAINNY_Y, RAINNY_C, RAINNY_N, 0);
break;
case SNOWY:
drawIcon(SNOWY_X, SNOWY_Y, SNOWY_C, SNOWY_N, 0);
break;
}
}
void drawTemperature() {
char temperatureFirstDigit = temperature.charAt(0);
char temperatureSecondDigit = temperature.charAt(1);
if (temperature.toInt() < 10) {
temperatureSecondDigit = temperatureFirstDigit;
temperatureFirstDigit = '0';
}
int firstPlus = temperatureSecondDigit == NULL ? 7 : 5;
switch (temperatureFirstDigit) {
case '0':
drawIcon(ZERO_X, ZERO_Y, ZERO_C, ZERO_N, firstPlus);
break;
case '1':
drawIcon(ONE_X, ONE_Y, ONE_C, ONE_N, firstPlus);
break;
case '2':
drawIcon(TWO_X, TWO_Y, TWO_C, TWO_N, firstPlus);
break;
case '3':
drawIcon(THREE_X, THREE_Y, THREE_C, THREE_N, firstPlus);
break;
case '4':
drawIcon(FOUR_X, FOUR_Y, FOUR_C, FOUR_N, firstPlus);
break;
case '5':
drawIcon(FIVE_X, FIVE_Y, FIVE_C, FIVE_N, firstPlus);
break;
case '6':
drawIcon(SIX_X, SIX_Y, SIX_C, SIX_N, firstPlus);
break;
case '7':
drawIcon(SEVEN_X, SEVEN_Y, SEVEN_C, SEVEN_N, firstPlus);
break;
case '8':
drawIcon(EIGHT_X, EIGHT_Y, EIGHT_C, EIGHT_N, firstPlus);
break;
case '9':
drawIcon(NINE_X, NINE_Y, NINE_C, NINE_N, firstPlus);
break;
}
if (temperatureSecondDigit != NULL) {
int plus = 9;
switch (temperatureSecondDigit) {
case '0':
drawIcon(ZERO_X, ZERO_Y, ZERO_C, ZERO_N, plus);
break;
case '1':
drawIcon(ONE_X, ONE_Y, ONE_C, ONE_N, plus);
break;
case '2':
drawIcon(TWO_X, TWO_Y, TWO_C, TWO_N, plus);
break;
case '3':
drawIcon(THREE_X, THREE_Y, THREE_C, THREE_N, plus);
break;
case '4':
drawIcon(FOUR_X, FOUR_Y, FOUR_C, FOUR_N, plus);
break;
case '5':
drawIcon(FIVE_X, FIVE_Y, FIVE_C, FIVE_N, plus);
break;
case '6':
drawIcon(SIX_X, SIX_Y, SIX_C, SIX_N, plus);
break;
case '7':
drawIcon(SEVEN_X, SEVEN_Y, SEVEN_C, SEVEN_N, plus);
break;
case '8':
drawIcon(EIGHT_X, EIGHT_Y, EIGHT_C, EIGHT_N, plus);
break;
case '9':
drawIcon(NINE_X, NINE_Y, NINE_C, NINE_N, plus);
break;
}
}
}
modes.h
enum Mode {
time, cronometer, weather
};