Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a291b56e5e | |||
| a572e02813 | |||
| 467173ad9e |
@@ -38,7 +38,7 @@
|
||||
"chalk"
|
||||
],
|
||||
"uuid": "793bab03-9464-48a2-b63f-3f779c473db8",
|
||||
"versionLabel": "4.9",
|
||||
"versionLabel": "4.10",
|
||||
"watchapp": {
|
||||
"watchface": true
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ String.prototype.hashCode = function(){
|
||||
return hash;
|
||||
};
|
||||
|
||||
var debugwatches = Array(/*1568511776, */1135189913, -826258655);
|
||||
var debugwatches = Array(/*1568511776, */1135189913, -826258655, -1783317168);
|
||||
var tokenhash;
|
||||
|
||||
Pebble.addEventListener('ready', function() {
|
||||
console.log('PebbleKit JS ready!');
|
||||
var tokenhash = Pebble.getWatchToken().hashCode();
|
||||
tokenhash = Pebble.getWatchToken().hashCode();
|
||||
console.log('Watch identifier '+tokenhash);
|
||||
if (debugwatches.indexOf(tokenhash) > -1) {
|
||||
var dict = {"debugwatch": 1};
|
||||
@@ -37,6 +38,10 @@ Pebble.addEventListener('showConfiguration', function() {
|
||||
} else if (watch.platform == "aplite") {
|
||||
url += "&rect=true&bw=true";
|
||||
}
|
||||
tokenhash = Pebble.getWatchToken().hashCode();
|
||||
if (debugwatches.indexOf(tokenhash) > -1) {
|
||||
url += "&debug=true";
|
||||
}
|
||||
console.log('Showing configuration page: '+url);
|
||||
Pebble.openURL(url);
|
||||
});
|
||||
|
||||
103
src/squared.c
103
src/squared.c
@@ -203,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},
|
||||
@@ -232,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},
|
||||
@@ -274,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},
|
||||
@@ -316,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},
|
||||
@@ -534,7 +585,7 @@ static GColor8 getSlotColor(int x, int y, int digit, int pos, bool isalpha) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (should_add_var || 1) {
|
||||
if (should_add_var) {
|
||||
if (argb == 0b11111111) {
|
||||
argb -= variation[ ( y*5 + x + digit*17 + pos*19 )%sizeof(variation) ];
|
||||
} else {
|
||||
@@ -636,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);
|
||||
}
|
||||
|
||||
const char* locale;
|
||||
uint8_t localeid;
|
||||
char weekdayname[5];
|
||||
locale = i18n_get_system_locale();
|
||||
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
|
||||
}
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,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;
|
||||
@@ -725,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;
|
||||
@@ -744,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;
|
||||
|
||||
Reference in New Issue
Block a user