From 51344a172bca68262300775eff1c3533dce69ffc Mon Sep 17 00:00:00 2001 From: Brandon Berookhim Date: Mon, 2 Mar 2015 18:38:33 -0800 Subject: [PATCH 1/5] Update README.md --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e96f7be..96c4c42 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ -ToothTimer +Toothbrush Buddy (fork of @mlv's ToothTimer) ========== -Pebble app for timing the brushing of teeth (2 minutes). +Pebble app for timing the brushing of teeth (3 minutes). -It shows different parts of the mouth (upper right outer, lower left inner, etc) with a countdown timer for how long -to focus on it (currently 15 seconds each), along with a brief delay at the start to get ready, and a brief delay -halfway through to spit. It vibrates between each step so you don't have to watch the watch while you're brushing. - -TODO: add option for brushing duration (eg. change it to 3 minutes). +It shows different, specific parts of the mouth (upper right outer, lower left inner, etc.) with a countdown timer for how long +to focus on it (currently 10 seconds each), along with a brief delay at the start to get ready. It vibrates between each step so you don't have to watch the watch while you're brushing. The backlight turns on right before it proceeds to the next step to make it easy for the user to see what is coming up next. From dfd8418cccf36740bb3984f20bd27f6c1af960f8 Mon Sep 17 00:00:00 2001 From: Brandon Berookhim Date: Mon, 2 Mar 2015 18:40:23 -0800 Subject: [PATCH 2/5] Code This code includes the changes I made to @mlv's ToothTimer. --- src/{ToothTimer.c => ToothbrushBuddy.c} | 92 +++++++++++++++++-------- 1 file changed, 63 insertions(+), 29 deletions(-) rename src/{ToothTimer.c => ToothbrushBuddy.c} (70%) diff --git a/src/ToothTimer.c b/src/ToothbrushBuddy.c similarity index 70% rename from src/ToothTimer.c rename to src/ToothbrushBuddy.c index 49e7987..4fbf244 100644 --- a/src/ToothTimer.c +++ b/src/ToothbrushBuddy.c @@ -19,13 +19,8 @@ static VibePattern oneshort_pattern = { .num_segments = 1 }; -static VibePattern twoshort_pattern = { - .durations = (uint32_t []) {100, 200, 100}, - .num_segments = 3 -}; - static VibePattern threeshort_pattern = { - .durations = (uint32_t []) {100, 200, 100, 200, 100}, + .durations = (uint32_t []) {100, 200, 100, 200, 300}, .num_segments = 5 }; @@ -33,22 +28,61 @@ struct { int time; // in seconds char *text; VibePattern *vibe; -} msgs[10] = { - { 3, "Get ready", NULL }, - - { 15, "Lower right outer", &twoshort_pattern }, - { 15, "Lower left outer", &oneshort_pattern }, - - { 15, "Lower left inner", &oneshort_pattern }, - { 15, "Lower right inner", &oneshort_pattern }, - - { 3, "Spit", &twoshort_pattern }, - - { 15, "Upper right outer", &twoshort_pattern }, - { 15, "Upper left outer", &oneshort_pattern }, - - { 15, "Upper left inner", &oneshort_pattern }, - { 15, "Upper right inner", &oneshort_pattern }, +#if 0 +} msgs[18] = { + { 10, "Upper left inner" }, + { 10, "Upper left bottom" }, + { 10, "Upper left outer" }, + { 10, "Upper right inner" }, + { 10, "Upper right bottom" }, + { 10, "Upper right outer" }, + { 10, "Lower left inner" }, + { 10, "Lower left top" }, + { 10, "Lower left outer" }, + { 10, "Lower right inner" }, + { 10, "Lower right top" }, + { 10, "Lower right outer" }, + { 10, “Lower middle inner” }, + { 10, “Lower middle outer” }, + { 10, “Upper middle inner” }, + { 10, “Upper middle outer” }, + { 10, “Tongue” }, + { 10, "Cheeks" }, + { 10, “Top gums” }, + { 10, "Bottom gums"} + +#else //0 +} msgs[21] = { + { 3, "Get ready", &oneshort_pattern}, + + { 10, "Lower right outer", &oneshort_pattern }, + { 10, "Lower right top", &oneshort_pattern }, + { 10, "Lower right inner", &oneshort_pattern }, + + { 10, "Lower middle outer", &oneshort_pattern }, + { 10, "Lower middle inner", &oneshort_pattern }, + + { 10, "Lower left outer", &oneshort_pattern }, + { 10, "Lower left top", &oneshort_pattern }, + { 10, "Lower left inner", &oneshort_pattern }, + + { 10, "Upper right outer", &oneshort_pattern }, + { 10, "Upper right bottom", &oneshort_pattern }, + { 10, "Upper right inner", &oneshort_pattern }, + + { 10, "Upper middle outer", &oneshort_pattern }, + { 10, "Upper middle inner", &oneshort_pattern }, + + { 10, "Upper left outer", &oneshort_pattern }, + { 10, "Upper left bottom", &oneshort_pattern }, + { 10, "Upper left inner", &oneshort_pattern }, + + { 5, "Tongue", &oneshort_pattern }, + { 5, "Cheeks", &oneshort_pattern }, + { 5, "Top gums", &oneshort_pattern }, + { 5, "Bottom gums", &oneshort_pattern }, + +#endif }; const int msgs_size = sizeof(msgs)/sizeof(msgs[0]); @@ -63,24 +97,24 @@ exit_callback(void *data) static void timer_callback(void *data) { - if (nextstep > msgs_size-1) { s_step_layer[0] = 0; s_nextstep_layer[0] = 0; - snprintf(s_countdown_layer, sizeof(s_countdown_layer), "Done!"); + snprintf(s_countdown_layer, sizeof(s_countdown_layer), "DONE!"); layer_mark_dirty(text_layer_get_layer(step_layer)); layer_mark_dirty(text_layer_get_layer(nextstep_layer)); layer_mark_dirty(text_layer_get_layer(countdown_layer)); vibes_enqueue_custom_pattern(threeshort_pattern); - tooth_timer = app_timer_register(5*60*1000 /* 5 minutes */, exit_callback, NULL); + tooth_timer = app_timer_register(1*60*1000 /* 1 minute */, exit_callback, NULL); return; } - tooth_timer = app_timer_register(1000 /* milliseconds */, timer_callback, NULL); + tooth_timer = app_timer_register(1000 /* 1 second */, timer_callback, NULL); APP_LOG(APP_LOG_LEVEL_DEBUG, "timer_callback nextstep:%d, nextstep_countdown:%d", nextstep, nextstep_countdown); if (nextstep_countdown <= 0) { + light_enable_interaction(); nextstep_countdown = msgs[nextstep].time; if (msgs[nextstep].vibe) vibes_enqueue_custom_pattern(*msgs[nextstep].vibe); @@ -89,11 +123,11 @@ timer_callback(void *data) if (nextstep < msgs_size-1) snprintf(s_nextstep_layer, sizeof(s_nextstep_layer), "Next:\n%s", msgs[nextstep+1].text); else - snprintf(s_nextstep_layer, sizeof(s_nextstep_layer), "Next:\nDone!"); + snprintf(s_nextstep_layer, sizeof(s_nextstep_layer), "Next:\nSpit and Gargle!"); layer_mark_dirty(text_layer_get_layer(step_layer)); layer_mark_dirty(text_layer_get_layer(nextstep_layer)); } - if (nextstep_countdown == 1) + if (nextstep_countdown == 1) light_enable_interaction(); snprintf(s_countdown_layer, sizeof(s_countdown_layer), "%d", nextstep_countdown); layer_mark_dirty(text_layer_get_layer(countdown_layer)); @@ -139,7 +173,7 @@ window_load(Window *window) // text_layer_set_text_alignment(step_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(step_layer)); - strcpy(s_countdown_layer, "Start"); + strcpy(s_countdown_layer, "START"); countdown_layer = text_layer_create((GRect) { .origin = { 0, 48 }, .size = { bounds.size.w, 42 } }); text_layer_set_text(countdown_layer, s_countdown_layer); text_layer_set_font(countdown_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD)); From c2daf8f9c9d7483cdfd5dca63ab4432ae93a179b Mon Sep 17 00:00:00 2001 From: Brandon Berookhim Date: Mon, 2 Mar 2015 18:41:42 -0800 Subject: [PATCH 3/5] Update appinfo.json --- appinfo.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appinfo.json b/appinfo.json index 0857465..8ea3c6f 100644 --- a/appinfo.json +++ b/appinfo.json @@ -5,21 +5,21 @@ "capabilities": [ "" ], - "companyName": "Michael Vezie", - "longName": "ToothTimer", + "companyName": "Brandon Berookhim", + "longName": "Toothbrush Buddy", "projectType": "native", "resources": { "media": [] }, "sdkVersion": "3", - "shortName": "ToothTimer", + "shortName": "Toothbrush Buddy", "targetPlatforms": [ "aplite", "basalt" ], "uuid": "2ff736b2-2be5-4e37-8613-bb3c11d75c44", "versionCode": 1, - "versionLabel": "1.1", + "versionLabel": "1.0", "watchapp": { "watchface": false } From c7b7aa65496b15277f4fb3ecdf26159d93d62c6f Mon Sep 17 00:00:00 2001 From: Brandon Berookhim Date: Mon, 2 Mar 2015 18:55:52 -0800 Subject: [PATCH 4/5] Update appinfo.json --- appinfo.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appinfo.json b/appinfo.json index 8ea3c6f..0857465 100644 --- a/appinfo.json +++ b/appinfo.json @@ -5,21 +5,21 @@ "capabilities": [ "" ], - "companyName": "Brandon Berookhim", - "longName": "Toothbrush Buddy", + "companyName": "Michael Vezie", + "longName": "ToothTimer", "projectType": "native", "resources": { "media": [] }, "sdkVersion": "3", - "shortName": "Toothbrush Buddy", + "shortName": "ToothTimer", "targetPlatforms": [ "aplite", "basalt" ], "uuid": "2ff736b2-2be5-4e37-8613-bb3c11d75c44", "versionCode": 1, - "versionLabel": "1.0", + "versionLabel": "1.1", "watchapp": { "watchface": false } From 633c0b5276128fe10315abce0a8846cc6a99439a Mon Sep 17 00:00:00 2001 From: Brandon Berookhim Date: Mon, 2 Mar 2015 18:56:08 -0800 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96c4c42..72fa181 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Toothbrush Buddy (fork of @mlv's ToothTimer) +ToothTimer ========== Pebble app for timing the brushing of teeth (3 minutes).