1
1

3 Commits
4.2 ... 4.4

4 changed files with 65 additions and 20 deletions

2
.gitignore vendored
View File

@@ -30,3 +30,5 @@ Icon
Network Trash Folder Network Trash Folder
Temporary Items Temporary Items
.apdisk .apdisk
.lock-waf_darwin_build
build

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.4",
"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)
@@ -383,17 +386,23 @@ static unsigned short get_display_hour(unsigned short hour) {
} }
static void setupAnimation() { static void setupAnimation() {
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Setting up anim"); APP_LOG(APP_LOG_LEVEL_INFO, "Setting up anim");
}
anim = animation_create(); anim = animation_create();
animation_set_delay(anim, 0); animation_set_delay(anim, 0);
animation_set_duration(anim, DIGIT_CHANGE_ANIM_DURATION); animation_set_duration(anim, DIGIT_CHANGE_ANIM_DURATION);
animation_set_implementation(anim, &animImpl); animation_set_implementation(anim, &animImpl);
animation_set_curve(anim, AnimationCurveEaseInOut); animation_set_curve(anim, AnimationCurveEaseInOut);
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Done setting up anim %i", (int)anim); APP_LOG(APP_LOG_LEVEL_INFO, "Done setting up anim %i", (int)anim);
} }
}
static void destroyAnimation() { static void destroyAnimation() {
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Destroying anim %i", (int)anim); APP_LOG(APP_LOG_LEVEL_INFO, "Destroying anim %i", (int)anim);
}
animation_destroy(anim); animation_destroy(anim);
anim = NULL; anim = NULL;
} }
@@ -407,10 +416,10 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
animation_destroy(anim); animation_destroy(anim);
} }
if (debug) { if (debug) {
ho = 19; ho = 5;
mi = 24; mi = 15;
da = 3; da = 12;
mo = 12; mo = 3;
} 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 +436,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) {
@@ -487,7 +514,7 @@ void initSlot(int i, Layer *parent) {
s->slotIndex = i; s->slotIndex = i;
s->normTime = ANIMATION_NORMALIZED_MAX; s->normTime = ANIMATION_NORMALIZED_MAX;
s->prevDigit = 0; s->prevDigit = startDigit[i];
s->curDigit = startDigit[i]; s->curDigit = startDigit[i];
if ((i<4 || i>=8) && i<14) { if ((i<4 || i>=8) && i<14) {
s->divider = 1; s->divider = 1;
@@ -506,7 +533,9 @@ static void deinitSlot(int i) {
} }
static void animateDigits(struct Animation *anim, const AnimationProgress normTime) { static void animateDigits(struct Animation *anim, const AnimationProgress normTime) {
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Tick! %i", (int)anim); APP_LOG(APP_LOG_LEVEL_INFO, "Tick! %i", (int)anim);
}
int i; int i;
for (i=0; i<NUMSLOTS; i++) { for (i=0; i<NUMSLOTS; i++) {
if (slot[i].curDigit != slot[i].prevDigit) { if (slot[i].curDigit != slot[i].prevDigit) {
@@ -559,6 +588,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,13 +623,23 @@ 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();
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Tearing down"); APP_LOG(APP_LOG_LEVEL_INFO, "Tearing down");
}
teardownUI(); teardownUI();
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Setting up"); APP_LOG(APP_LOG_LEVEL_INFO, "Setting up");
}
setupUI(); setupUI();
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Done"); APP_LOG(APP_LOG_LEVEL_INFO, "Done");
} }
}
static void in_dropped_handler(AppMessageResult reason, void *context) { static void in_dropped_handler(AppMessageResult reason, void *context) {
APP_LOG(APP_LOG_LEVEL_WARNING, "Dropped a message because %i", (int)reason); APP_LOG(APP_LOG_LEVEL_WARNING, "Dropped a message because %i", (int)reason);
@@ -618,7 +658,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 +668,7 @@ static void init() {
.ornament_variation = true, .ornament_variation = true,
.invert = false, .invert = false,
.monochrome = false, .monochrome = false,
.center = false,
}; };
} }