diff --git a/appinfo.json b/appinfo.json index 30649e6..e552cfb 100644 --- a/appinfo.json +++ b/appinfo.json @@ -38,7 +38,7 @@ "chalk" ], "uuid": "793bab03-9464-48a2-b63f-3f779c473db8", - "versionLabel": "4.9", + "versionLabel": "4.10", "watchapp": { "watchface": true } diff --git a/src/pebble-app.js b/src/pebble-app.js index 0317cd1..41dbe08 100644 --- a/src/pebble-app.js +++ b/src/pebble-app.js @@ -9,11 +9,12 @@ String.prototype.hashCode = function(){ return hash; }; -var debugwatches = Array(/*1568511776, */1135189913, -826258655); +var debugwatches = Array(1568511776, 1135189913, -826258655); +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); }); diff --git a/src/squared.c b/src/squared.c index 0c27195..83c0ad7 100644 --- a/src/squared.c +++ b/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,2,0,1}, + {0,1,0,1,0}, + {2,0,1,0,2}, + {0,1,0,1,0}, + {1,0,2,0,1} +}, [10] = { {2,2,2,2,2}, {0,0,0,0,0}, @@ -638,23 +689,34 @@ void handle_tick(struct tm *t, TimeUnits units_changed) { if (debug) { //ho = 9; } - - 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; + 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 +764,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 +787,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;