|
|
|
|
@@ -194,12 +194,6 @@ unsigned char blocks[][5][5] = {{
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,0,1,0,1}
|
|
|
|
|
}, {
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,0,1,0,1}
|
|
|
|
|
},
|
|
|
|
|
[99] = {
|
|
|
|
|
{1,1,1,1,1},
|
|
|
|
|
@@ -209,6 +203,36 @@ unsigned char blocks[][5][5] = {{
|
|
|
|
|
{1,1,1,1,1}
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
LANG_EN,
|
|
|
|
|
LANG_DE,
|
|
|
|
|
LANG_ES,
|
|
|
|
|
LANG_FR,
|
|
|
|
|
LANG_IT,
|
|
|
|
|
LANG_PT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const char* weekdays[][7] = {
|
|
|
|
|
[LANG_EN]={
|
|
|
|
|
"SU","MO","TU","WE","TH","FR","SA"
|
|
|
|
|
},
|
|
|
|
|
[LANG_DE]={
|
|
|
|
|
"SO","MO","DI","MI","DO","FR","SA"
|
|
|
|
|
},
|
|
|
|
|
[LANG_ES]={ // from https://forums.getpebble.com/discussion/comment/166975/#Comment_166975
|
|
|
|
|
"DO","LU","MA","MI","JU","VI","SA"
|
|
|
|
|
},
|
|
|
|
|
[LANG_FR]={ // from https://www.quora.com/How-are-days-of-the-week-abbreviated-in-various-languages
|
|
|
|
|
"DI","LU","MA","ME","JE","VE","SA"
|
|
|
|
|
},
|
|
|
|
|
[LANG_IT]={ // from https://www.quora.com/How-are-days-of-the-week-abbreviated-in-various-languages
|
|
|
|
|
"DO","LU","MA","ME","GI","VE","SA"
|
|
|
|
|
},
|
|
|
|
|
[LANG_PT]={ // from http://www.brazil-help.com/week.htm
|
|
|
|
|
"DO","SG","TE","QA","QI","SX","SA"
|
|
|
|
|
}
|
|
|
|
|
}; // required Letters: ADEFGHIJLMOQRSTUVWX
|
|
|
|
|
|
|
|
|
|
unsigned char alphablocks[][5][5] = {
|
|
|
|
|
[65] = { // A
|
|
|
|
|
{1,1,1,1,1},
|
|
|
|
|
@@ -238,6 +262,13 @@ unsigned char alphablocks[][5][5] = {
|
|
|
|
|
{1,0,0,0,0},
|
|
|
|
|
{1,0,2,2,2}
|
|
|
|
|
},
|
|
|
|
|
[71] = { // G
|
|
|
|
|
{1,1,1,1,1},
|
|
|
|
|
{1,0,0,0,0},
|
|
|
|
|
{1,0,1,1,1},
|
|
|
|
|
{1,0,0,0,1},
|
|
|
|
|
{1,1,1,1,1}
|
|
|
|
|
},
|
|
|
|
|
[72] = { // H
|
|
|
|
|
{1,0,2,0,1},
|
|
|
|
|
{1,0,0,0,1},
|
|
|
|
|
@@ -280,6 +311,13 @@ unsigned char alphablocks[][5][5] = {
|
|
|
|
|
{1,0,0,0,1},
|
|
|
|
|
{1,1,1,1,1}
|
|
|
|
|
},
|
|
|
|
|
[81] = { // Q
|
|
|
|
|
{1,1,1,1,1},
|
|
|
|
|
{1,0,0,0,1},
|
|
|
|
|
{1,0,0,0,1},
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,1,1,1,1}
|
|
|
|
|
},
|
|
|
|
|
[82] = { // R
|
|
|
|
|
{1,1,1,1,1},
|
|
|
|
|
{0,0,0,0,1},
|
|
|
|
|
@@ -322,6 +360,13 @@ unsigned char alphablocks[][5][5] = {
|
|
|
|
|
{1,0,1,0,1},
|
|
|
|
|
{1,1,1,1,1}
|
|
|
|
|
},
|
|
|
|
|
[88] = { // X
|
|
|
|
|
{1,0,0,0,1},
|
|
|
|
|
{0,1,0,1,0},
|
|
|
|
|
{0,0,1,0,0},
|
|
|
|
|
{0,1,0,1,0},
|
|
|
|
|
{1,0,0,0,1}
|
|
|
|
|
},
|
|
|
|
|
[10] = {
|
|
|
|
|
{2,2,2,2,2},
|
|
|
|
|
{0,0,0,0,0},
|
|
|
|
|
@@ -642,25 +687,39 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
|
|
|
|
|
da = t->tm_mday;
|
|
|
|
|
mo = t->tm_mon+1;
|
|
|
|
|
if (debug) {
|
|
|
|
|
//ho = 9;
|
|
|
|
|
//ho = 8+(mi%4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (WEEKDAY) {
|
|
|
|
|
strftime(weekday_buffer, sizeof(weekday_buffer), "%a", t);
|
|
|
|
|
for (int i=0; i<2; i++) {
|
|
|
|
|
if ((int) weekday_buffer[i] == 225) { // á
|
|
|
|
|
weekday_buffer[i] = 65; // A
|
|
|
|
|
}
|
|
|
|
|
if ((int) weekday_buffer[i] > 90) { // lower case
|
|
|
|
|
weekday_buffer[i] =weekday_buffer[i]-0x20; // make upper case
|
|
|
|
|
}
|
|
|
|
|
const char* locale;
|
|
|
|
|
uint8_t localeid;
|
|
|
|
|
char weekdayname[5];
|
|
|
|
|
locale = i18n_get_system_locale();
|
|
|
|
|
if (WEEKDAY) {
|
|
|
|
|
strftime(weekday_buffer, sizeof(weekday_buffer), "%w", t);
|
|
|
|
|
if (strncmp("de", locale, 2) == 0) {
|
|
|
|
|
localeid = 1;
|
|
|
|
|
} else if (strncmp("es", locale, 2) == 0) {
|
|
|
|
|
localeid = 2;
|
|
|
|
|
} else if (strncmp("fr", locale, 2) == 0) {
|
|
|
|
|
localeid = 3;
|
|
|
|
|
} else if (strncmp("it", locale, 2) == 0) {
|
|
|
|
|
localeid = 4;
|
|
|
|
|
} else if (strncmp("pt", locale, 2) == 0) {
|
|
|
|
|
localeid = 5;
|
|
|
|
|
} else {
|
|
|
|
|
localeid = 0;
|
|
|
|
|
}
|
|
|
|
|
uint8_t weekdaynum = ((int)weekday_buffer[0])-0x30;
|
|
|
|
|
if (debug) {
|
|
|
|
|
//weekdaynum = (int)mi%7;
|
|
|
|
|
}
|
|
|
|
|
strcpy(weekdayname, weekdays[localeid][weekdaynum]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (debug) {
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "It is now %d:%d %d.%d.", (int)ho, (int)mi, (int)da, (int)mo);
|
|
|
|
|
if (WEEKDAY) {
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "The Weekday is %c%c", weekday_buffer[0], weekday_buffer[1]);
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "Locale is %s", locale);
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "The Weekday is %c%c", weekdayname[0], weekdayname[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -673,7 +732,7 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
|
|
|
|
|
}
|
|
|
|
|
} else if (DISABLE_ANIM_START_TIME > DISABLE_ANIM_END_TIME) {
|
|
|
|
|
// across midnight
|
|
|
|
|
if (ho >= DISABLE_ANIM_START_TIME || ho < DISABLE_ANIM_END_TIME) {
|
|
|
|
|
if (t->tm_hour >= DISABLE_ANIM_START_TIME || t->tm_hour < DISABLE_ANIM_END_TIME) {
|
|
|
|
|
allow_animate = false;
|
|
|
|
|
if (debug) {
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "No Animation because time is between %d:00 and %d:00", (int)DISABLE_ANIM_START_TIME , (int)DISABLE_ANIM_END_TIME );
|
|
|
|
|
@@ -681,7 +740,7 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// prior to midnight
|
|
|
|
|
if (ho >= DISABLE_ANIM_START_TIME && ho < DISABLE_ANIM_END_TIME) {
|
|
|
|
|
if (t->tm_hour >= DISABLE_ANIM_START_TIME && t->tm_hour < DISABLE_ANIM_END_TIME) {
|
|
|
|
|
allow_animate = false;
|
|
|
|
|
if (debug) {
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "No Animation because time is between %d:00 and %d:00", (int)DISABLE_ANIM_START_TIME , (int)DISABLE_ANIM_END_TIME );
|
|
|
|
|
@@ -708,8 +767,8 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
|
|
|
|
|
if (WEEKDAY) {
|
|
|
|
|
slot[4].isalpha = true;
|
|
|
|
|
slot[5].isalpha = true;
|
|
|
|
|
slot[4].curDigit = (int) weekday_buffer[0];
|
|
|
|
|
slot[5].curDigit = (int) weekday_buffer[1];
|
|
|
|
|
slot[4].curDigit = (int) weekdayname[0];
|
|
|
|
|
slot[5].curDigit = (int) weekdayname[1];
|
|
|
|
|
} else {
|
|
|
|
|
slot[4].curDigit = mo/10;
|
|
|
|
|
slot[5].curDigit = mo%10;
|
|
|
|
|
@@ -731,8 +790,8 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
|
|
|
|
|
if (WEEKDAY) {
|
|
|
|
|
slot[6].isalpha = true;
|
|
|
|
|
slot[7].isalpha = true;
|
|
|
|
|
slot[6].curDigit = (int) weekday_buffer[0];
|
|
|
|
|
slot[7].curDigit = (int) weekday_buffer[1];
|
|
|
|
|
slot[6].curDigit = (int) weekdayname[0];
|
|
|
|
|
slot[7].curDigit = (int) weekdayname[1];
|
|
|
|
|
} else {
|
|
|
|
|
if (CENTER_DATE && mo < 10) {
|
|
|
|
|
slot[6].curDigit = mo%10;
|
|
|
|
|
@@ -750,14 +809,14 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
|
|
|
|
|
|
|
|
|
|
if (NO_ZERO) {
|
|
|
|
|
if (debug) {
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "Slot 0 was %d", (int) slot[0].prevDigit);
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "Slot 0 was %d and is %d", (int) slot[0].prevDigit, (int) slot[0].curDigit);
|
|
|
|
|
}
|
|
|
|
|
if (ho < 10 && slot[0].prevDigit >= 10) {
|
|
|
|
|
if (slot[0].curDigit == 0) {
|
|
|
|
|
if (NUMSLOTS > 8) {
|
|
|
|
|
if (debug) {
|
|
|
|
|
APP_LOG(APP_LOG_LEVEL_INFO, "More than 8 slots");
|
|
|
|
|
}
|
|
|
|
|
if (slot[10].prevDigit != 10 && slot[10].prevDigit < 12) {
|
|
|
|
|
if (slot[10].prevDigit != 10 && slot[10].prevDigit != 12) {
|
|
|
|
|
slot[0].curDigit = 11;
|
|
|
|
|
} else {
|
|
|
|
|
slot[0].curDigit = 10;
|
|
|
|
|
|