1
1
Fork 0

Added option for center aligned date

squarelines 4.3
Alina Marquardt 2016-01-10 03:50:14 +01:00
parent b684308c34
commit fcedbb11f6
3 changed files with 41 additions and 12 deletions

View File

@ -1,6 +1,7 @@
{ {
"appKeys": { "appKeys": {
"background_color": 4, "background_color": 4,
"center": 11,
"eu_date": 1, "eu_date": 1,
"invert": 9, "invert": 9,
"large_mode": 0, "large_mode": 0,
@ -29,7 +30,7 @@
"chalk" "chalk"
], ],
"uuid": "793bab03-9464-48a2-b63f-3f779c473db8", "uuid": "793bab03-9464-48a2-b63f-3f779c473db8",
"versionLabel": "4.1", "versionLabel": "4.3",
"watchapp": { "watchapp": {
"watchface": true "watchface": true
} }

View File

@ -7,7 +7,7 @@ Pebble.addEventListener('showConfiguration', function() {
if(Pebble.getActiveWatchInfo) { if(Pebble.getActiveWatchInfo) {
watch = Pebble.getActiveWatchInfo(); watch = Pebble.getActiveWatchInfo();
} }
var url='http://pebble.lastfuture.de/config/squared40/'; var url='http://pebble.lastfuture.de/config/squared43/';
if (watch.platform == "basalt") { if (watch.platform == "basalt") {
url += "?rect=true"; url += "?rect=true";
} else if (watch.platform == "aplite") { } else if (watch.platform == "aplite") {
@ -32,7 +32,8 @@ Pebble.addEventListener('webviewclosed', function(e) {
ornament_base_color: configData.ornament_base_color, ornament_base_color: configData.ornament_base_color,
ornament_variation: configData.ornament_variation, ornament_variation: configData.ornament_variation,
invert: 0+(configData.invert === 'true'), invert: 0+(configData.invert === 'true'),
monochrome: 0+(configData.monochrome === 'true') monochrome: 0+(configData.monochrome === 'true'),
center: 0+(configData.center === 'true')
}, function() { }, function() {
console.log('Send successful!'); console.log('Send successful!');
}, function() { }, function() {

View File

@ -21,6 +21,7 @@ typedef struct {
bool ornament_variation; bool ornament_variation;
bool invert; bool invert;
bool monochrome; bool monochrome;
bool center;
} Preferences; } Preferences;
Preferences curPrefs; Preferences curPrefs;
@ -37,11 +38,13 @@ enum {
KEY_ORNAMENT_VARIATION, KEY_ORNAMENT_VARIATION,
KEY_INVERT, KEY_INVERT,
KEY_MONOCHROME, KEY_MONOCHROME,
KEY_CENTER,
}; };
#define PREFERENCES_KEY 0 #define PREFERENCES_KEY 0
#define US_DATE (!curPrefs.eu_date) // true == MM/DD, false == DD/MM #define US_DATE (!curPrefs.eu_date) // true == MM/DD, false == DD/MM
#define CENTER_DATE (curPrefs.center)
#define NO_ZERO (!curPrefs.leading_zero) // true == replaces leading Zero for hour, day, month with a "cycler" #define NO_ZERO (!curPrefs.leading_zero) // true == replaces leading Zero for hour, day, month with a "cycler"
#define TILE_SIZE PBL_IF_RECT_ELSE((curPrefs.large_mode ? 12 : 10), 10) #define TILE_SIZE PBL_IF_RECT_ELSE((curPrefs.large_mode ? 12 : 10), 10)
#define INVERT (curPrefs.invert) #define INVERT (curPrefs.invert)
@ -407,10 +410,10 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
animation_destroy(anim); animation_destroy(anim);
} }
if (debug) { if (debug) {
ho = 19; ho = get_display_hour(t->tm_hour);
mi = 24; mi = t->tm_min;
da = 3; da = 10;
mo = 12; mo = 1;
} else { } else {
ho = get_display_hour(t->tm_hour); ho = get_display_hour(t->tm_hour);
mi = t->tm_min; mi = t->tm_min;
@ -427,16 +430,34 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
slot[2].curDigit = mi/10; slot[2].curDigit = mi/10;
slot[3].curDigit = mi%10; slot[3].curDigit = mi%10;
if (US_DATE) { if (US_DATE) {
slot[6].curDigit = da/10;
slot[7].curDigit = da%10;
slot[4].curDigit = mo/10; slot[4].curDigit = mo/10;
slot[5].curDigit = mo%10; slot[5].curDigit = mo%10;
if (CENTER_DATE && da < 10) {
slot[6].curDigit = da%10;
if (slot[7].prevDigit == 10 || slot[7].prevDigit == 12) {
slot[7].curDigit = 11;
} else {
slot[7].curDigit = 10;
}
} else {
slot[6].curDigit = da/10;
slot[7].curDigit = da%10;
}
} else { } else {
slot[4].curDigit = da/10; slot[4].curDigit = da/10;
slot[5].curDigit = da%10; slot[5].curDigit = da%10;
if (CENTER_DATE && mo < 10) {
slot[6].curDigit = mo%10;
if (slot[7].prevDigit == 10 || slot[7].prevDigit == 12) {
slot[7].curDigit = 11;
} else {
slot[7].curDigit = 10;
}
} else {
slot[6].curDigit = mo/10; slot[6].curDigit = mo/10;
slot[7].curDigit = mo%10; slot[7].curDigit = mo%10;
} }
}
if (NO_ZERO) { if (NO_ZERO) {
if (slot[0].curDigit == 0) { if (slot[0].curDigit == 0) {
@ -559,6 +580,7 @@ static void in_received_handler(DictionaryIterator *iter, void *context) {
Tuple *ornament_variation_t = dict_find(iter, KEY_ORNAMENT_VARIATION); Tuple *ornament_variation_t = dict_find(iter, KEY_ORNAMENT_VARIATION);
Tuple *invert_t = dict_find(iter, KEY_INVERT); Tuple *invert_t = dict_find(iter, KEY_INVERT);
Tuple *monochrome_t = dict_find(iter, KEY_MONOCHROME); Tuple *monochrome_t = dict_find(iter, KEY_MONOCHROME);
Tuple *center_t = dict_find(iter, KEY_CENTER);
if (large_mode_t) { if (large_mode_t) {
curPrefs.large_mode = large_mode_t->value->int8; curPrefs.large_mode = large_mode_t->value->int8;
@ -593,7 +615,11 @@ static void in_received_handler(DictionaryIterator *iter, void *context) {
if (monochrome_t) { if (monochrome_t) {
curPrefs.monochrome = monochrome_t->value->int8; curPrefs.monochrome = monochrome_t->value->int8;
} }
if (center_t) {
curPrefs.center = center_t->value->int8;
}
persist_write_data(PREFERENCES_KEY, &curPrefs, sizeof(curPrefs)); persist_write_data(PREFERENCES_KEY, &curPrefs, sizeof(curPrefs));
vibes_short_pulse();
APP_LOG(APP_LOG_LEVEL_INFO, "Tearing down"); APP_LOG(APP_LOG_LEVEL_INFO, "Tearing down");
teardownUI(); teardownUI();
APP_LOG(APP_LOG_LEVEL_INFO, "Setting up"); APP_LOG(APP_LOG_LEVEL_INFO, "Setting up");
@ -618,7 +644,7 @@ static void init() {
} else { } else {
curPrefs = (Preferences) { curPrefs = (Preferences) {
.large_mode = false, .large_mode = false,
.eu_date = true, .eu_date = false,
.quick_start = false, .quick_start = false,
.leading_zero = false, .leading_zero = false,
.background_color = 0b11000000, .background_color = 0b11000000,
@ -628,6 +654,7 @@ static void init() {
.ornament_variation = true, .ornament_variation = true,
.invert = false, .invert = false,
.monochrome = false, .monochrome = false,
.center = false,
}; };
} }