diff options
author | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-10-13 11:34:04 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-10-13 11:34:04 +0300 |
commit | 0a6144f10edcda677403b905c86adf1b7b6b86c9 (patch) | |
tree | 057915ba78ded46d17affad6931080037081f1c4 | |
parent | 64e2f4062e8c75bef08ad48e89911d2ec5f14f4f (diff) |
Hourly vibration, bugfixes
-rw-r--r-- | appinfo.json | 13 | ||||
-rw-r--r-- | resources/images/mario_bg_day.png (renamed from resources/images/mario_bg_day_bw (2).png) | bin | 811 -> 811 bytes | |||
-rw-r--r-- | resources/images/mario_bg_day~color.png | bin | 0 -> 4968 bytes | |||
-rw-r--r-- | src/js/pebble-js-app.js | 6 | ||||
-rw-r--r-- | src/pebble-mario.c | 27 |
5 files changed, 36 insertions, 10 deletions
diff --git a/appinfo.json b/appinfo.json index 4c62fb3..0fae2e6 100644 --- a/appinfo.json +++ b/appinfo.json @@ -8,6 +8,7 @@ "config_show_weather": 8, "config_temperature_units": 999, "config_vibe": 2, + "config_vibe_hour": 14, "weather_icon_id": 10, "weather_request": 12, "weather_temperature": 11 @@ -22,6 +23,11 @@ "resources": { "media": [ { + "file": "images/mario_bg_day.png", + "name": "IMAGE_BACKGROUND_DAY", + "type": "png" + }, + { "file": "images/mario-jump-bw.png", "name": "IMAGE_MARIO_JUMP", "type": "png" @@ -32,11 +38,6 @@ "type": "png" }, { - "file": "images/mario_bg_day_bw (2).png", - "name": "IMAGE_BACKGROUND_DAY", - "type": "png" - }, - { "file": "images/weather_few_clouds_night.png", "name": "IMAGE_WEATHER_FEW_CLOUDS_NIGHT", "type": "png" @@ -173,7 +174,7 @@ "basalt" ], "uuid": "43caa750-2896-4f46-94dc-1adbd4bc1ff3", - "versionLabel": "3.20", + "versionLabel": "3.22", "watchapp": { "watchface": true } diff --git a/resources/images/mario_bg_day_bw (2).png b/resources/images/mario_bg_day.png Binary files differindex 8a8b1da..8a8b1da 100644 --- a/resources/images/mario_bg_day_bw (2).png +++ b/resources/images/mario_bg_day.png diff --git a/resources/images/mario_bg_day~color.png b/resources/images/mario_bg_day~color.png Binary files differnew file mode 100644 index 0000000..499738a --- /dev/null +++ b/resources/images/mario_bg_day~color.png diff --git a/src/js/pebble-js-app.js b/src/js/pebble-js-app.js index 029fe08..827bf6b 100644 --- a/src/js/pebble-js-app.js +++ b/src/js/pebble-js-app.js @@ -6,6 +6,7 @@ var options = { "config_show_battery": true, "config_show_phone_battery": false, "config_vibe": false, + "config_vibe_hour": false, "config_background": 0, }; @@ -82,8 +83,9 @@ Pebble.addEventListener("showConfiguration", function() { var watch = null; } var platform = "&platform=" + ((watch != null) ? watch.platform : "unknown"); - console.log("showing configuration"); - Pebble.openURL("http://clusterrr.com/pebble_configs/mario_w.php" + cfg + platform); + var config_version = "&v=2"; + console.log("Showing configuration"); + Pebble.openURL("http://clusterrr.com/pebble_configs/mario_w.php" + cfg + platform + config_version); }); Pebble.addEventListener("webviewclosed", function(e) { diff --git a/src/pebble-mario.c b/src/pebble-mario.c index e6e4691..665469c 100644 --- a/src/pebble-mario.c +++ b/src/pebble-mario.c @@ -84,6 +84,7 @@ static bool config_show_weather = true; static bool config_vibe = false; static int config_background = 0; static int phone_battery_level = -1; +static bool config_vibe_hour = false; static time_t weather_last_update = 0; static int weather_icon_id = -1; @@ -124,6 +125,7 @@ static char digits[10][15] = {{1,1,1,1,0,1,1,0,1,1,0,1,1,1,1},{0,0,1,0,0,1,0,0,1 #define MSG_WEATHER_TEMPERATURE 11 #define MSG_WEATHER_REQUEST 12 #define ID_LEFT_INFO_MODE 13 +#define MSG_VIBE_HOUR 14 void handle_tick(struct tm *tick_time, TimeUnits units_changed); @@ -616,6 +618,14 @@ void in_received_handler(DictionaryIterator *received, void *context) { config_vibe = tuple->value->int8; persist_write_bool(MSG_VIBE, config_vibe); } + tuple = dict_find(received, MSG_VIBE_HOUR); + if (tuple) { + if (tuple->type == TUPLE_CSTRING) + config_vibe_hour = (strcmp(tuple->value->cstring, "true") == 0); + else + config_vibe_hour = tuple->value->int8; + persist_write_bool(MSG_VIBE_HOUR, config_vibe_hour); + } tuple = dict_find(received, MSG_BACKGROUND); if (tuple) { config_background = tuple->value->int8; @@ -658,6 +668,8 @@ void handle_init() config_show_weather = persist_read_bool(MSG_SHOW_WEATHER); if (persist_exists(MSG_VIBE)) config_vibe = persist_read_bool(MSG_VIBE); + if (persist_exists(MSG_VIBE_HOUR)) + config_vibe_hour = persist_read_bool(MSG_VIBE_HOUR); if (persist_exists(MSG_BACKGROUND)) config_background = persist_read_int(MSG_BACKGROUND); if (persist_exists(ID_WEATHER_LAST_UPDATE)) @@ -928,7 +940,7 @@ void handle_tick(struct tm *tick_time, TimeUnits units_changed) animation_schedule((Animation *)block_animation_beg); int weather_age = time(NULL)-weather_last_update; - if (units_changed | MINUTE_UNIT) + if (units_changed & MINUTE_UNIT) { if ((tick_time->tm_min % 30 == 0) || ((tick_time->tm_min % 5 == 0) && (weather_age > WEATHER_UPDATE_INTERVAL))) request_all(); @@ -942,8 +954,19 @@ void handle_tick(struct tm *tick_time, TimeUnits units_changed) layer_mark_dirty(phone_battery_layer); } - if (units_changed | HOUR_UNIT) + if (units_changed & HOUR_UNIT) + { need_update_background = 1; + if (config_vibe_hour) + { + static const uint32_t const segments[] = { 50, 100, 50, 100, 50, 100, 50, 100, 50 }; + VibePattern pat = { + .durations = segments, + .num_segments = ARRAY_LENGTH(segments), + }; + vibes_enqueue_custom_pattern(pat); + } + } } int main(void) |