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
Temporary Items
.apdisk
.lock-waf_darwin_build
build

View File

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

View File

@@ -7,7 +7,7 @@ Pebble.addEventListener('showConfiguration', function() {
if(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") {
url += "?rect=true";
} else if (watch.platform == "aplite") {
@@ -32,7 +32,8 @@ Pebble.addEventListener('webviewclosed', function(e) {
ornament_base_color: configData.ornament_base_color,
ornament_variation: configData.ornament_variation,
invert: 0+(configData.invert === 'true'),
monochrome: 0+(configData.monochrome === 'true')
monochrome: 0+(configData.monochrome === 'true'),
center: 0+(configData.center === 'true')
}, function() {
console.log('Send successful!');
}, function() {

View File

@@ -21,6 +21,7 @@ typedef struct {
bool ornament_variation;
bool invert;
bool monochrome;
bool center;
} Preferences;
Preferences curPrefs;
@@ -37,11 +38,13 @@ enum {
KEY_ORNAMENT_VARIATION,
KEY_INVERT,
KEY_MONOCHROME,
KEY_CENTER,
};
#define PREFERENCES_KEY 0
#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 TILE_SIZE PBL_IF_RECT_ELSE((curPrefs.large_mode ? 12 : 10), 10)
#define INVERT (curPrefs.invert)
@@ -383,17 +386,23 @@ static unsigned short get_display_hour(unsigned short hour) {
}
static void setupAnimation() {
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Setting up anim");
}
anim = animation_create();
animation_set_delay(anim, 0);
animation_set_duration(anim, DIGIT_CHANGE_ANIM_DURATION);
animation_set_implementation(anim, &animImpl);
animation_set_curve(anim, AnimationCurveEaseInOut);
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Done setting up anim %i", (int)anim);
}
}
static void destroyAnimation() {
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Destroying anim %i", (int)anim);
}
animation_destroy(anim);
anim = NULL;
}
@@ -407,10 +416,10 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
animation_destroy(anim);
}
if (debug) {
ho = 19;
mi = 24;
da = 3;
mo = 12;
ho = 5;
mi = 15;
da = 12;
mo = 3;
} else {
ho = get_display_hour(t->tm_hour);
mi = t->tm_min;
@@ -427,16 +436,34 @@ void handle_tick(struct tm *t, TimeUnits units_changed) {
slot[2].curDigit = mi/10;
slot[3].curDigit = mi%10;
if (US_DATE) {
slot[6].curDigit = da/10;
slot[7].curDigit = da%10;
slot[4].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 {
slot[4].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[7].curDigit = mo%10;
}
}
if (NO_ZERO) {
if (slot[0].curDigit == 0) {
@@ -487,7 +514,7 @@ void initSlot(int i, Layer *parent) {
s->slotIndex = i;
s->normTime = ANIMATION_NORMALIZED_MAX;
s->prevDigit = 0;
s->prevDigit = startDigit[i];
s->curDigit = startDigit[i];
if ((i<4 || i>=8) && i<14) {
s->divider = 1;
@@ -506,7 +533,9 @@ static void deinitSlot(int i) {
}
static void animateDigits(struct Animation *anim, const AnimationProgress normTime) {
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Tick! %i", (int)anim);
}
int i;
for (i=0; i<NUMSLOTS; i++) {
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 *invert_t = dict_find(iter, KEY_INVERT);
Tuple *monochrome_t = dict_find(iter, KEY_MONOCHROME);
Tuple *center_t = dict_find(iter, KEY_CENTER);
if (large_mode_t) {
curPrefs.large_mode = large_mode_t->value->int8;
@@ -593,12 +623,22 @@ static void in_received_handler(DictionaryIterator *iter, void *context) {
if (monochrome_t) {
curPrefs.monochrome = monochrome_t->value->int8;
}
if (center_t) {
curPrefs.center = center_t->value->int8;
}
persist_write_data(PREFERENCES_KEY, &curPrefs, sizeof(curPrefs));
vibes_short_pulse();
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Tearing down");
}
teardownUI();
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Setting up");
}
setupUI();
if (debug) {
APP_LOG(APP_LOG_LEVEL_INFO, "Done");
}
}
static void in_dropped_handler(AppMessageResult reason, void *context) {
@@ -618,7 +658,7 @@ static void init() {
} else {
curPrefs = (Preferences) {
.large_mode = false,
.eu_date = true,
.eu_date = false,
.quick_start = false,
.leading_zero = false,
.background_color = 0b11000000,
@@ -628,6 +668,7 @@ static void init() {
.ornament_variation = true,
.invert = false,
.monochrome = false,
.center = false,
};
}