diff --git a/appinfo.json b/appinfo.json index 24dd564..97645ae 100644 --- a/appinfo.json +++ b/appinfo.json @@ -6,9 +6,8 @@ "KEY_EXPORT": 6, "KEY_MEDICATIONS": 100, "KEY_MODE": 1, - "KEY_PINS_DONE": 8, "KEY_SORT": 3, - "KEY_TIMELINE": 9, + "KEY_TIMELINE": 8, "KEY_TIMESTAMP": 7, "KEY_VERSION": 4 }, @@ -16,10 +15,17 @@ "configurable" ], "companyName": "cmorison@gmail.com", + "enableMultiJS": false, "longName": "Medication Timer", "projectType": "native", "resources": { "media": [ + { + "file": "images/icons-inv.png", + "name": "IMAGE_ICON_MATRIX_INV", + "targetPlatforms": null, + "type": "png" + }, { "file": "images/menu_icon.png", "menuIcon": true, @@ -36,10 +42,12 @@ "sdkVersion": "3", "shortName": "Meds Timer", "targetPlatforms": [ - "basalt" + "aplite", + "basalt", + "chalk" ], "uuid": "95d07e1a-2451-4ffa-aa44-836e523a7648", - "versionLabel": "1.4", + "versionLabel": "1.6", "watchapp": { "watchface": false } diff --git a/resources/images/icons-inv.png b/resources/images/icons-inv.png new file mode 100644 index 0000000..b454339 Binary files /dev/null and b/resources/images/icons-inv.png differ diff --git a/src/job_adjust.c b/src/job_adjust.c index 808b96a..168bbcf 100644 --- a/src/job_adjust.c +++ b/src/job_adjust.c @@ -10,11 +10,9 @@ static const char* help_fixed[2]={"Timer runs from when drug WAS actually taken" static char num_buffer[NUM_BUFFER_LENGTH]; static Window *s_window; -static GFont s_res_gothic_24_bold; -static GFont s_res_gothic_18; -static GFont s_res_gothic_14; static ActionBarLayer *s_actionbarlayer; static TextLayer *s_textlayer_name; +static TextLayer *s_textlayer_repeat; static TextLayer *s_textlayer_hrs; static TextLayer *s_textlayer_note; static TextLayer *layers[N_LAYERS]; @@ -51,7 +49,7 @@ static void action_bar_select_click_handler() { } else { active_layer++; set_layer_text(); - action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_SELECT, bitmap_tick); + action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_SELECT, bitmaps[BITMAP_TICK][PBL_IF_SDK_3_ELSE(1,0)]); } } @@ -67,51 +65,63 @@ static void initialise_ui(void) { window_set_fullscreen(s_window, false); #endif - s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); - s_res_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_18); - s_res_gothic_14 = fonts_get_system_font(FONT_KEY_GOTHIC_14); - // s_actionbarlayer - s_actionbarlayer = action_bar_layer_create(); - action_bar_layer_add_to_window(s_actionbarlayer, s_window); - action_bar_layer_set_background_color(s_actionbarlayer, GColorBlack); - action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_UP, bitmap_add); - action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_DOWN, bitmap_minus); - action_bar_layer_set_click_config_provider(s_actionbarlayer, action_bar_click_config_provider); - layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbarlayer); - // s_textlayer_name s_textlayer_name = text_layer_create(GRect(5, 7, 100, 30)); - text_layer_set_font(s_textlayer_name, s_res_gothic_24_bold); + text_layer_set_font(s_textlayer_name, FONT_GOTHIC_24_BOLD); layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_name); - layers[0] = text_layer_create(GRect(20, 60, 20, 24)); + // s_textlayer_repeat + s_textlayer_repeat = text_layer_create(GRect(5+PBL_IF_ROUND_ELSE(20,0), 36+PBL_IF_ROUND_ELSE(16,0), 100, 30)); + text_layer_set_font(s_textlayer_repeat, FONT_GOTHIC_18); + text_layer_set_text(s_textlayer_repeat, "Repeat Every"); + layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_repeat); + + // hours number + layers[0] = text_layer_create(GRect(20-14+PBL_IF_ROUND_ELSE(20,0), 60+PBL_IF_ROUND_ELSE(16,0), 20, 24)); text_layer_set_text_alignment(layers[0], GTextAlignmentCenter); - text_layer_set_font(layers[0], s_res_gothic_18); + text_layer_set_font(layers[0], FONT_GOTHIC_18); layer_add_child(window_get_root_layer(s_window), (Layer *)layers[0]); // s_textlayer_hrs - s_textlayer_hrs = text_layer_create(GRect(20+20+2, 60, 30, 24)); - text_layer_set_font(s_textlayer_hrs, s_res_gothic_18); + s_textlayer_hrs = text_layer_create(GRect(20+20+2-14+PBL_IF_ROUND_ELSE(20,0), 60+PBL_IF_ROUND_ELSE(16,0), 30, 24)); + text_layer_set_font(s_textlayer_hrs, FONT_GOTHIC_18); text_layer_set_text(s_textlayer_hrs, "hrs"); text_layer_set_text_alignment(s_textlayer_hrs, GTextAlignmentLeft); layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_hrs); // s_textlayer_fixed - layers[1] = text_layer_create(GRect(66, 60, 50, 24)); + layers[1] = text_layer_create(GRect(66-14+PBL_IF_ROUND_ELSE(20,0), 60+PBL_IF_ROUND_ELSE(16,0), 50, 24)); text_layer_set_text_alignment(layers[1], GTextAlignmentCenter); - text_layer_set_font(layers[1], s_res_gothic_18); + text_layer_set_font(layers[1], FONT_GOTHIC_18); layer_add_child(window_get_root_layer(s_window), (Layer *)layers[1]); // s_textlayer_note - s_textlayer_note = text_layer_create(GRect(15, 94, 100, 45)); - text_layer_set_font(s_textlayer_note, s_res_gothic_14); + s_textlayer_note = text_layer_create(GRect(15-2+PBL_IF_ROUND_ELSE(20,0), 94+PBL_IF_ROUND_ELSE(16,0), 100, 45)); + text_layer_set_font(s_textlayer_note, FONT_GOTHIC_14); layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_note); + + // s_actionbarlayer + s_actionbarlayer = action_bar_layer_create(); + action_bar_layer_add_to_window(s_actionbarlayer, s_window); + action_bar_layer_set_background_color(s_actionbarlayer, GColorBlack); + action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_UP, bitmaps[BITMAP_ADD][PBL_IF_SDK_3_ELSE(1,0)]); + action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_DOWN, bitmaps[BITMAP_MINUS][PBL_IF_SDK_3_ELSE(1,0)]); + action_bar_layer_set_click_config_provider(s_actionbarlayer, action_bar_click_config_provider); + layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbarlayer); + + #ifdef PBL_ROUND + GRect bounds = layer_get_bounds(window_get_root_layer(s_window)); + layer_set_frame((Layer *)s_textlayer_name, GRect(0,20,bounds.size.w,30)); + text_layer_set_text_alignment(s_textlayer_name, GTextAlignmentCenter); + #endif } static void destroy_ui(void) { window_destroy(s_window); action_bar_layer_destroy(s_actionbarlayer); text_layer_destroy(s_textlayer_name); + text_layer_destroy(s_textlayer_repeat); + text_layer_destroy(s_textlayer_hrs); text_layer_destroy(s_textlayer_note); for (uint8_t l=0; lrow) { case MENU_JOB: menu_cell_draw_job(ctx, cell_layer, job_index); break; - case MENU_RESET: menu_cell_draw_other(ctx, cell_layer, "Reset Timer", NULL, bitmap_reset); break; - case MENU_ADD10: menu_cell_draw_other(ctx, cell_layer, "Add 10 Minutes", NULL, bitmap_add); break; - case MENU_SUB10: menu_cell_draw_other(ctx, cell_layer, "Sub 10 Minutes", NULL, bitmap_minus); break; - case MENU_RENAME: menu_cell_draw_other(ctx, cell_layer, "Rename", NULL, bitmap_edit); break; - case MENU_ADJUST: menu_cell_draw_other(ctx, cell_layer, "Set Repeat", NULL, bitmap_adjust); break; - case MENU_DELETE: menu_cell_draw_other(ctx, cell_layer, "Delete", NULL, bitmap_delete); break; + case MENU_RESET: menu_cell_draw_other(ctx, cell_layer, "Reset Timer", NULL, bitmaps[BITMAP_RESET]); break; + case MENU_ADD10: menu_cell_draw_other(ctx, cell_layer, "Add 10 Minutes", NULL, bitmaps[BITMAP_ADD]); break; + case MENU_SUB10: menu_cell_draw_other(ctx, cell_layer, "Sub 10 Minutes", NULL, bitmaps[BITMAP_MINUS]); break; + case MENU_RENAME: menu_cell_draw_other(ctx, cell_layer, "Rename", NULL, bitmaps[BITMAP_EDIT]); break; + case MENU_ADJUST: menu_cell_draw_other(ctx, cell_layer, "Set Repeat", NULL, bitmaps[BITMAP_ADJUST]); break; + case MENU_DELETE: menu_cell_draw_other(ctx, cell_layer, "Delete", NULL, bitmaps[BITMAP_DELETE]); break; } } diff --git a/src/jobs.c b/src/jobs.c index 7cb0ad4..c3ad2e3 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -1,19 +1,6 @@ #include "main.h" -#define JOB_NAME_LENGTH 24 -typedef struct { - char Name[JOB_NAME_LENGTH]; - time_t Seconds; - uint8_t Repeat_hrs; - bool Fixed; -} Job; - -typedef struct Job_ptr { - Job* Job; - struct Job_ptr* Next_ptr; -} Job_ptr ; - -static Job_ptr* first_job_ptr=NULL; +struct Job jobs[MAX_JOBS]; uint8_t jobs_count=0; // ***************************************************************************************************** @@ -21,89 +8,60 @@ uint8_t jobs_count=0; // ***************************************************************************************************** static void jobs_list_append_job(const char* name, time_t seconds, uint8_t repeat, int fixed) { - Job* new_job = malloc(sizeof(Job)); - Job_ptr* new_job_ptr = malloc(sizeof(Job_ptr)); - - new_job_ptr->Job = new_job; - new_job_ptr->Next_ptr = NULL; - strncpy(new_job->Name, name, JOB_NAME_LENGTH); + if (jobs_count==MAX_JOBS) return; + struct Job* new_job=&jobs[jobs_count++]; + strncpy(new_job->Name, name, JOB_NAME_SIZE)[JOB_NAME_SIZE-1]=0; new_job->Seconds = seconds; new_job->Repeat_hrs = repeat; new_job->Fixed = fixed ? true : false; - - if (first_job_ptr) { - Job_ptr* last_job_ptr = first_job_ptr; - while (last_job_ptr->Next_ptr) last_job_ptr=last_job_ptr->Next_ptr; - last_job_ptr->Next_ptr = new_job_ptr; - } else { - first_job_ptr = new_job_ptr; - } LOG("appended job: %s, seconds=%ld, repeat=%d, fixed=%d", new_job->Name, new_job->Seconds, new_job->Repeat_hrs, new_job->Fixed); - jobs_count++; } void jobs_list_sort(void) { - time_t end_time; - - Job_ptr* job_ptr_before = first_job_ptr; - while (job_ptr_before && job_ptr_before->Next_ptr) { - end_time = END_TIME(job_ptr_before->Job); - Job_ptr* job_ptr_min = job_ptr_before; + for (uint8_t before=0; beforeNext_ptr; - while (job_ptr_loop) { - if (END_TIME(job_ptr_loop->Job) < end_time) { - end_time = END_TIME(job_ptr_loop->Job); - job_ptr_min = job_ptr_loop; + for (uint8_t loop=before+1; loopNext_ptr; } - if (job_ptr_min != job_ptr_before) { + if (job_min!=before) { // swap med - Job* temp_job = job_ptr_before->Job; - job_ptr_before->Job = job_ptr_min->Job; - job_ptr_min->Job = temp_job; + struct Job temp_job = jobs[before]; + jobs[before] = jobs[job_min]; + jobs[job_min] = temp_job; } - - job_ptr_before = job_ptr_before->Next_ptr; } } void jobs_list_save(uint8_t first_key) { - Job_ptr* job_ptr = first_job_ptr; - while (job_ptr) { - persist_write_data(first_key++, job_ptr->Job, sizeof(Job)); - job_ptr=job_ptr->Next_ptr; - } + for (uint8_t a=0; aJob; - snprintf(buffer,JOB_NAME_LENGTH+30,"%s|%ld|%u|%d",job->Name, job->Seconds, job->Repeat_hrs, job->Fixed ? 1:0); + char buffer[JOB_NAME_SIZE+30]; + for (uint8_t a=0; aNext_ptr; } } void jobs_list_read_dict(DictionaryIterator *iter, uint8_t first_key, const uint8_t version) { - if (first_job_ptr!=NULL) return; - + if (jobs_count) return; Tuple *tuple_t; uint8_t fields=4; - char buffer[fields][JOB_NAME_LENGTH]; - + char buffer[fields][JOB_NAME_SIZE]; while ((tuple_t=dict_find(iter, first_key++))) { char *source = tuple_t->value->cstring; for (int c=0; cFixed = false; // this flag was not included before storage version 2 - LOG("loaded job: %s, seconds=%ld, repeat=%d, fixed=%d, version=%d", new_job->Name, new_job->Seconds, new_job->Repeat_hrs, new_job->Fixed, version); - new_job_ptr = malloc(sizeof(Job_ptr)); - new_job_ptr->Job = new_job; - new_job_ptr->Next_ptr = NULL; - if (prev_job_ptr) prev_job_ptr->Next_ptr = new_job_ptr; - prev_job_ptr = new_job_ptr; - if (NULL==first_job_ptr) first_job_ptr = new_job_ptr; - jobs_count++; - first_key++; } LOG("Loaded %d jobs.",jobs_count); } -Job* jobs_list_get_index(uint8_t index) { - if (index>=jobs_count) return NULL; - Job_ptr* job_ptr = first_job_ptr; - while (index--) job_ptr=job_ptr->Next_ptr; - return job_ptr->Job; -} - -void jobs_list_move_to_top(uint8_t index) { +void jobs_list_move_to_top_not_used(uint8_t index) { if (index==0 || index>=jobs_count) return; - Job_ptr* job_ptr = first_job_ptr; - Job_ptr* prev_job_ptr=NULL; - while (index--) { - prev_job_ptr=job_ptr; - job_ptr=job_ptr->Next_ptr; + + struct Job removed_job=jobs[index]; + while (index) { + jobs[index]=jobs[index-1]; + index--; } - // remove job_ptr from list - prev_job_ptr->Next_ptr = job_ptr->Next_ptr; - // Insert before first_job_ptr - job_ptr->Next_ptr = first_job_ptr; - first_job_ptr=job_ptr; + jobs[0]=removed_job; } // ***************************************************************************************************** // PUBLIC FUNCTIONS // ***************************************************************************************************** +static uint8_t jobs_find_job_index_from_name(const char *name) { + // get new index of job after sort + uint8_t index=0; + while (strcmp(jobs[index].Name,name)) index++; + return index; +} + static void callback(const char* result, size_t result_length, void* extra) { // Do something with result int index = (int) extra; if (index==-1) { - jobs_list_append_job(result, time(NULL), 0, 0); + jobs_list_append_job(result, time(NULL), 0, 0); } else { - snprintf(jobs_list_get_index(index)->Name,JOB_NAME_LENGTH, result); + strncpy(jobs[index].Name, result, JOB_NAME_SIZE)[JOB_NAME_SIZE-1]=0; } main_save_data(); main_menu_update(); + if (index==-1) { + job_menu_show(jobs_find_job_index_from_name(result)); + job_adjust_show(); + } } void jobs_add_job() { @@ -185,81 +131,31 @@ void jobs_add_job() { } void jobs_rename_job(uint8_t index) { - tertiary_text_prompt(jobs_get_job_name(index), callback, (void*) (int) index); + tertiary_text_prompt(jobs[index].Name, callback, (void*) (int) index); } void jobs_delete_all_jobs(void) { - while (first_job_ptr) { - Job_ptr * next_job=first_job_ptr->Next_ptr; - free(first_job_ptr->Job); - free(first_job_ptr); - first_job_ptr=next_job; - } jobs_count=0; } void jobs_delete_job_and_save(uint8_t index) { - if (index>=jobs_count) return; - - Job_ptr* job_ptr = first_job_ptr; - - if (index) { - Job_ptr* prev_job_ptr = NULL; - while (index--) { - prev_job_ptr=job_ptr; - job_ptr=job_ptr->Next_ptr; - } - prev_job_ptr->Next_ptr = job_ptr->Next_ptr; - } else { - first_job_ptr = job_ptr->Next_ptr; + jobs_count--; + while (indexJob); - free(job_ptr); - jobs_count--; main_save_data(); main_menu_update(); } -char* jobs_get_job_name(uint8_t index) { - Job* job=jobs_list_get_index(index); - return (job) ? job->Name : NULL; -} - -uint32_t jobs_get_job_seconds(uint8_t index) { - Job* job=jobs_list_get_index(index); - return (job) ? time(NULL) - job->Seconds : 0; -} - -uint8_t jobs_get_job_repeat(uint8_t index) { - Job* job=jobs_list_get_index(index); - return (job) ? job->Repeat_hrs : 0; -} - -bool jobs_get_job_fixed(uint8_t index) { - Job* job=jobs_list_get_index(index); - return (job) ? job->Fixed : 0; -} -static void jobs_update_job_index(Job* job, uint8_t *index) { - // check if job was moved during sort - if (job==jobs_list_get_index(*index)) return; - // get new index - Job_ptr* job_ptr = first_job_ptr; - *index=0; - while (job_ptr->Job != job) { - (*index)++; - job_ptr=job_ptr->Next_ptr; - } -} - void jobs_set_job_repeat(uint8_t *index, uint8_t repeat, uint8_t fixed) { - Job* job=jobs_list_get_index(*index); - if (job) { - job->Repeat_hrs=repeat; - job->Fixed = fixed ? true : false; - main_save_data(); - jobs_update_job_index(job, index); - } + char name[JOB_NAME_SIZE]; + strncpy(name,jobs[*index].Name,JOB_NAME_SIZE); + jobs[*index].Repeat_hrs=repeat; + jobs[*index].Fixed = fixed ? true : false; + main_save_data(); // this might resort the jobs. + *index=jobs_find_job_index_from_name(name); } #define MAX_CLOCK_LENGTH 24 @@ -267,22 +163,21 @@ char clock_buffer[MAX_CLOCK_LENGTH]; char repeat_buffer[MAX_CLOCK_LENGTH]; char* jobs_get_job_clock_as_text(uint8_t index) { - Job* job=jobs_list_get_index(index); time_t seconds; switch (settings.Mode) { case MODE_COUNT_DOWN: - seconds = job->Seconds + job->Repeat_hrs*3600 - time(NULL); + seconds = END_TIME(jobs[index]) - time(NULL); bool minus = seconds < 0; if (minus) seconds = -seconds; snprintf(clock_buffer,MAX_CLOCK_LENGTH,"%s%ld:%02ld:%02ld",minus?"+":"-",(seconds/3600) /*hours*/,(seconds / 60) % 60 /*mins*/,seconds % 60 /*secs*/); break; case MODE_COUNT_UP: - seconds = time(NULL) - job->Seconds; + seconds = time(NULL) - jobs[index].Seconds; snprintf(clock_buffer,MAX_CLOCK_LENGTH,"%ld:%02ld:%02ld",(seconds/3600) /*hours*/,(seconds / 60) % 60 /*mins*/,seconds % 60 /*secs*/); break; case MODE_NEXT_TIME: - ; time_t next = END_TIME(job); + ; time_t next = END_TIME(jobs[index]); strftime(clock_buffer,MAX_CLOCK_LENGTH,clock_is_24h_style() ? "%H:%M" : "%I:%M %p",localtime(&next)); break; } @@ -290,42 +185,33 @@ char* jobs_get_job_clock_as_text(uint8_t index) { } char* jobs_get_job_repeat_as_text(uint8_t index) { - Job* job=jobs_list_get_index(index); - - snprintf(repeat_buffer,MAX_CLOCK_LENGTH,"Every %d%s hrs", job->Repeat_hrs, job->Fixed ? "" : "+"); + snprintf(repeat_buffer,MAX_CLOCK_LENGTH,"Every %d%s hrs", jobs[index].Repeat_hrs, jobs[index].Fixed ? "" : "+"); return repeat_buffer; } void jobs_reset_and_save(uint8_t *index) { - Job* job=jobs_list_get_index(*index); - if (job->Fixed) { - job->Seconds+=job->Repeat_hrs*3600; + char name[JOB_NAME_SIZE]; + strncpy(name,jobs[*index].Name,JOB_NAME_SIZE); + + if (jobs[*index].Fixed) { + jobs[*index].Seconds+=jobs[*index].Repeat_hrs*3600; } else { - job->Seconds=time(NULL); + jobs[*index].Seconds=time(NULL); } - main_save_data(); - jobs_update_job_index(job, index); + main_save_data(); // this might resort the jobs. + *index=jobs_find_job_index_from_name(name); } void jobs_add_minutes(uint8_t *index, int minutes) { - Job* job=jobs_list_get_index(*index); - int seconds = (int) job->Seconds; - //if (seconds + 60*minutes < time(NULL)) { - seconds += 60*minutes; - //} else { - // seconds = time(NULL); - //} - job->Seconds = seconds; + jobs[*index].Seconds += 60*minutes; } time_t jobs_get_next_wakeup_time(void) { - Job_ptr* job_ptr = first_job_ptr; - time_t min_time = (END_TIME(job_ptr->Job) > time(NULL)) ? END_TIME(job_ptr->Job) : 0; - - while (job_ptr) { - if (job_ptr->Job->Repeat_hrs && END_TIME(job_ptr->Job) > time(NULL) && (min_time==0 || END_TIME(job_ptr->Job)Job); - job_ptr = job_ptr->Next_ptr; + time_t min_time = 0; + for (uint8_t a=0; a time(NULL) && (min_time==0 || END_TIME(jobs[a])Job->Repeat_hrs && END_TIME(job_ptr->Job) <= time(NULL)) new_alarm_count++; - job_ptr=job_ptr->Next_ptr; + for (uint8_t a=0; ajobs_alarm_count) vibrate(); jobs_alarm_count=new_alarm_count; diff --git a/src/jobs.h b/src/jobs.h index 946badd..3b31c26 100644 --- a/src/jobs.h +++ b/src/jobs.h @@ -1,5 +1,16 @@ #pragma once +#define MAX_JOBS 20 +#define JOB_NAME_SIZE 24 + +extern uint8_t jobs_count; +struct Job { + char Name[JOB_NAME_SIZE]; + time_t Seconds; + uint8_t Repeat_hrs; + bool Fixed; +}; +extern struct Job jobs[MAX_JOBS]; extern uint8_t jobs_count; void jobs_list_sort(void); @@ -12,11 +23,7 @@ void jobs_delete_all_jobs(void); void jobs_delete_job_and_save(uint8_t index); void jobs_add_job(); void jobs_rename_job(uint8_t index); -uint32_t jobs_get_job_seconds(uint8_t index); -uint8_t jobs_get_job_repeat(uint8_t index); -bool jobs_get_job_fixed(uint8_t index); void jobs_set_job_repeat(uint8_t *index, uint8_t repeat, uint8_t fixed); -char* jobs_get_job_name(uint8_t index); char* jobs_get_job_clock_as_text(uint8_t index); char* jobs_get_job_repeat_as_text(uint8_t index); void jobs_reset_and_save(uint8_t *index); diff --git a/src/main.c b/src/main.c index 42dbd49..e39a14d 100644 --- a/src/main.c +++ b/src/main.c @@ -5,17 +5,7 @@ extern const PebbleProcessInfo __pbl_app_info; #define APP_VERSION_LENGTH 10 char app_version[APP_VERSION_LENGTH]; -GBitmap *bitmap_matrix; -//GBitmap *bitmap_pause; -GBitmap *bitmap_play; -GBitmap *bitmap_add; -GBitmap *bitmap_settings; -GBitmap *bitmap_delete; -GBitmap *bitmap_edit; -GBitmap *bitmap_adjust; -GBitmap *bitmap_reset; -GBitmap *bitmap_minus; -GBitmap *bitmap_tick; +GBitmap *bitmaps[N_BITMAPS][PBL_IF_SDK_3_ELSE(2,1)]; Settings settings={MODE_COUNT_UP, false /*alarm*/, true /*sort*/}; static bool JS_ready = false; @@ -24,9 +14,8 @@ static uint32_t data_timestamp = 0; uint8_t stored_version=0; bool export_after_save=false; #ifdef PBL_SDK_3 - bool waiting_for_pins=false; - bool quit_after_pins=false; uint8_t timeline_settings=TIMELINE_FLAG_ON | TIMELINE_FLAG_NOTIFICATIONS; + uint8_t quit_after_secs=0; #endif // ***************************************************************************************************** @@ -42,8 +31,7 @@ bool export_after_save=false; #define KEY_APP_VERSION 5 #define KEY_EXPORT 6 #define KEY_TIMESTAMP 7 -#define KEY_PINS_DONE 8 -#define KEY_TIMELINE 9 +#define KEY_TIMELINE 8 static void send_settings_to_phone() { if (!JS_ready) return; @@ -69,10 +57,9 @@ static void send_settings_to_phone() { } dict_write_end(iter); + + //LOG("ended, dict_size=%d", (int) dict_size(iter)); app_message_outbox_send(); - #ifdef PBL_SDK_3 - waiting_for_pins=true; - #endif } static void inbox_received_handler(DictionaryIterator *iter, void *context) { @@ -80,14 +67,6 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) { JS_ready = true; Tuple *tuple_t; - #ifdef PBL_SDK_3 - if (dict_find(iter, KEY_PINS_DONE)) { - waiting_for_pins=false; - if (quit_after_pins) main_menu_hide(); - return; - } - #endif - bool new_data_from_config_page = dict_find(iter, KEY_CONFIG_DATA); tuple_t= dict_find(iter, KEY_TIMESTAMP); uint32_t inbox_timestamp = tuple_t ? tuple_t->value->int32 : 0; @@ -181,35 +160,65 @@ void init(void) { snprintf(app_version,APP_VERSION_LENGTH,"%d.%d",__pbl_app_info.process_version.major, __pbl_app_info.process_version.minor); main_load_data(); - bitmap_matrix=gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ICON_MATRIX); - //bitmap_pause=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_PAUSE); - bitmap_play=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_PLAY); - bitmap_add=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_ADD); - bitmap_settings=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_SETTINGS); - bitmap_delete=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_DELETE); - bitmap_edit=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_EDIT); - bitmap_adjust=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_ADJUST); - bitmap_reset=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_RESET); - bitmap_minus=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_MINUS); - bitmap_tick=gbitmap_create_as_sub_bitmap(bitmap_matrix, ICON_RECT_TICK); - main_menu_show(); - if (data_loaded_from_watch && stored_version < CURRENT_STORAGE_VERSION) update_show(stored_version); + bitmaps[BITMAP_MATRIX][0] =gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ICON_MATRIX); + bitmaps[BITMAP_ADD][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_ADD); + bitmaps[BITMAP_MINUS][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_MINUS); + bitmaps[BITMAP_SETTINGS][0]=gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_SETTINGS); + bitmaps[BITMAP_DELETE][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_DELETE); + bitmaps[BITMAP_EDIT][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_EDIT); + bitmaps[BITMAP_ADJUST][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_ADJUST); + bitmaps[BITMAP_RESET][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_RESET); + bitmaps[BITMAP_PLAY][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_PLAY); + bitmaps[BITMAP_TICK][0] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][0], ICON_RECT_TICK); + #ifdef PBL_SDK_3 + // SDK 3 doesn't invert highligted menu icon, so need to use pre-inverted image... + bitmaps[BITMAP_MATRIX][1] =gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ICON_MATRIX_INV); + bitmaps[BITMAP_ADD][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_ADD); + bitmaps[BITMAP_MINUS][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_MINUS); + bitmaps[BITMAP_SETTINGS][1]=gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_SETTINGS); + bitmaps[BITMAP_DELETE][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_DELETE); + bitmaps[BITMAP_EDIT][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_EDIT); + bitmaps[BITMAP_ADJUST][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_ADJUST); + bitmaps[BITMAP_RESET][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_RESET); + bitmaps[BITMAP_PLAY][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_PLAY); + bitmaps[BITMAP_TICK][1] =gbitmap_create_as_sub_bitmap(bitmaps[BITMAP_MATRIX][1], ICON_RECT_TICK); + #endif + + if (data_loaded_from_watch && stored_version < CURRENT_STORAGE_VERSION) update_show(stored_version); app_message_register_inbox_received(inbox_received_handler); - app_message_open(2048, 2048); + app_message_open(636, 636); // should be enough for 23 meds: 78bytes+23meds*24bytes = 630 #ifdef PBL_SDK_3 if (launch_reason() == APP_LAUNCH_TIMELINE_ACTION) { uint8_t reason=launch_get_args(); LOG("launch code: %d", reason); if (reason>=10) { - reason-=10; - jobs_reset_and_save(&reason); - quit_after_pins=true; + // let list of med names, to find alphabetical order + uint8_t names[MAX_JOBS]; + uint8_t temp; + for (uint8_t a=0; aSeconds + (time_t) (JOB)->Repeat_hrs*3600) +#define END_TIME(JOB) ((time_t) (JOB).Seconds + (time_t) (JOB).Repeat_hrs*3600) #define FONT_GOTHIC_24_BOLD fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD) #define FONT_GOTHIC_28_BOLD fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD) @@ -85,17 +85,21 @@ #define ICON_RECT_MINUS (GRect) { { 16, 48 }, { 16, 16 } } #define ICON_RECT_CLOCK (GRect) { { 32, 16 }, { 16, 16 } } -extern GBitmap *bitmap_matrix; -//extern GBitmap *bitmap_pause; -extern GBitmap *bitmap_play; -extern GBitmap *bitmap_add; -extern GBitmap *bitmap_settings; -extern GBitmap *bitmap_delete; -extern GBitmap *bitmap_edit; -extern GBitmap *bitmap_adjust; -extern GBitmap *bitmap_reset; -extern GBitmap *bitmap_minus; -extern GBitmap *bitmap_tick; +enum { + BITMAP_MATRIX, + BITMAP_ADD, + BITMAP_MINUS, + BITMAP_SETTINGS, + BITMAP_DELETE, + BITMAP_EDIT, + BITMAP_ADJUST, + BITMAP_RESET, + BITMAP_TICK, + BITMAP_PLAY, + N_BITMAPS +}; + +extern GBitmap *bitmaps[N_BITMAPS][PBL_IF_SDK_3_ELSE(2,1)]; // Persistent Storage Keys #define STORAGE_KEY_VERSION 1 @@ -126,9 +130,8 @@ enum { #ifdef PBL_SDK_3 - extern bool waiting_for_pins; - extern bool quit_after_pins; extern uint8_t timeline_settings; + extern uint8_t quit_after_secs; #define TIMELINE_FLAG_ON 1 #define TIMELINE_FLAG_NOTIFICATIONS 2 #endif diff --git a/src/main_menu.c b/src/main_menu.c index f927c90..c86b8a2 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -4,42 +4,10 @@ static Window *s_window; static MenuLayer *s_menulayer; #ifdef PBL_SDK_3 static StatusBarLayer *s_status_bar; -static TextLayer *s_textlayer_wait; #endif static bool check_phone_message = false; -/*************************************** Back Button Override ********************************/ -// https://gist.github.com/sarfata/10574031 -#ifdef PBL_SDK_3 -// Define what you want to do when the back button is pressed -void back_button_handler(ClickRecognizerRef recognizer, void *context) { - if (waiting_for_pins) { - quit_after_pins=true; - layer_set_hidden((Layer *)s_textlayer_wait,false); - } else { - main_menu_hide(); - } -} - -// We need to save a reference to the ClickConfigProvider originally set by the menu layer -ClickConfigProvider previous_ccp; - -// This is the new ClickConfigProvider we will set, it just calls the old one and then subscribe -// for back button events. -void new_ccp(void *context) { - previous_ccp(context); - window_single_click_subscribe(BUTTON_ID_BACK, back_button_handler); -} - -// Call this from your init function to do the hack -void force_back_button(Window *window, MenuLayer *menu_layer) { - previous_ccp = window_get_click_config_provider(window); - window_set_click_config_provider_with_context(window, new_ccp, menu_layer); -} -#endif -/********************************* end of Back Button Override ********************************/ - static void initialise_ui(void) { s_window = window_create(); #ifndef PBL_SDK_3 @@ -54,16 +22,6 @@ static void initialise_ui(void) { layer_add_child(window_get_root_layer(s_window), (Layer *)s_menulayer); #ifdef PBL_SDK_3 - force_back_button(s_window,s_menulayer); - // s_textlayer_wait - s_textlayer_wait = text_layer_create(GRect(14+margin, (bounds.size.h-5*26)/2, bounds.size.w-2*(14+margin), 5*26)); - text_layer_set_background_color(s_textlayer_wait,GColorBlack); - text_layer_set_text_color(s_textlayer_wait,GColorWhite); - text_layer_set_text(s_textlayer_wait, "\nUpdating timeline before closing..."); - text_layer_set_text_alignment(s_textlayer_wait, GTextAlignmentCenter); - text_layer_set_font(s_textlayer_wait, FONT_ROBOTO_21_CONDENSED); - layer_set_hidden((Layer *)s_textlayer_wait,true); - layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_wait); // Set up the status bar last to ensure it is on top of other Layers s_status_bar = status_bar_layer_create(); layer_add_child(window_get_root_layer(s_window), status_bar_layer_get_layer(s_status_bar)); @@ -76,12 +34,17 @@ static void destroy_ui(void) { #ifdef PBL_SDK_3 status_bar_layer_destroy(s_status_bar); - text_layer_destroy(s_textlayer_wait); #endif } void handle_ticktimer_tick(struct tm *tick_time, TimeUnits units_changed) { //LOG("tick timer, units changed=%d",(int) units_changed); + #ifdef PBL_SDK_3 + if (quit_after_secs) { + if (--quit_after_secs==1) main_menu_hide(); + return; + } + #endif if (units_changed & SECOND_UNIT) { main_menu_update(); job_menu_update(); @@ -159,14 +122,14 @@ void menu_cell_draw_job(GContext* ctx, const Layer *cell_layer, const uint8_t in #endif uint8_t margin=(bounds.size.w-144)/2; - graphics_draw_text(ctx, jobs_get_job_name(index), FONT_GOTHIC_24_BOLD, GRect(4+margin, -4, bounds.size.w-2*(4+margin), 4+18), GTextOverflowModeFill, GTextAlignmentLeft, NULL); + graphics_draw_text(ctx, jobs[index].Name, FONT_GOTHIC_24_BOLD, GRect(4+margin, -4, bounds.size.w-2*(4+margin), 4+18), GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(ctx, jobs_get_job_clock_as_text(index), FONT_GOTHIC_18, GRect(4+margin, 20, bounds.size.w-2*(4+margin), 14), GTextOverflowModeFill, GTextAlignmentRight, NULL); graphics_draw_text(ctx, jobs_get_job_repeat_as_text(index), FONT_GOTHIC_14, GRect(4+margin, 20+4, bounds.size.w-2*(4+margin), 14), GTextOverflowModeFill, GTextAlignmentLeft, NULL); //graphics_draw_bitmap_in_rect(ctx, timer.Active && timer.Job==index ? bitmap_play : bitmap_pause, GRect(6, (bounds.size.h-16)/2, 16, 16)); } -void menu_cell_draw_other(GContext* ctx, const Layer *cell_layer, const char *title, const char *sub_title, GBitmap * icon) { +void menu_cell_draw_other(GContext* ctx, const Layer *cell_layer, const char *title, const char *sub_title, GBitmap ** icon) { GRect bounds = layer_get_frame(cell_layer); #ifndef PBL_SDK_3 @@ -177,7 +140,7 @@ void menu_cell_draw_other(GContext* ctx, const Layer *cell_layer, const char *ti graphics_draw_text(ctx, title, FONT_GOTHIC_24_BOLD, GRect(28+margin, -4, bounds.size.w-28-2*margin, 4+18), GTextOverflowModeFill, GTextAlignmentLeft, NULL); if (sub_title) graphics_draw_text(ctx, sub_title, FONT_GOTHIC_18, GRect(28+margin, 20, bounds.size.w-28-margin-4, 14), GTextOverflowModeFill, GTextAlignmentLeft, NULL); - if (icon) graphics_draw_bitmap_in_rect(ctx, icon, GRect(6+margin,(bounds.size.h-16)/2, 16, 16)); + if (icon) graphics_draw_bitmap_in_rect(ctx, icon[PBL_IF_SDK_3_ELSE(menu_cell_layer_is_highlighted(cell_layer), 0)], GRect(6+margin,(bounds.size.h-16)/2, 16, 16)); } static void menu_cell_draw_setting(GContext* ctx, const Layer *cell_layer, const char *title, const char *setting, const char *hint) { @@ -202,13 +165,13 @@ static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuI default: switch (MENU_SECTION_CELL) { - case MENU_OTHER_ADD: menu_cell_draw_other(ctx, cell_layer, "Add Medication", NULL, bitmap_add); break; + case MENU_OTHER_ADD: menu_cell_draw_other(ctx, cell_layer, "Add Medication", NULL, bitmaps[BITMAP_ADD]); break; case MENU_SETTINGS_MODE: menu_cell_draw_setting(ctx, cell_layer, "Mode", mode[settings.Mode],NULL); break; case MENU_SETTINGS_ALARM: menu_cell_draw_setting(ctx, cell_layer, "Alarm", settings.Alarm ? "ON" : "OFF",NULL); break; case MENU_SETTINGS_SORT: menu_cell_draw_setting(ctx, cell_layer, "Sort", settings.Sort ? "YES" : "NO",NULL); break; - case MENU_SETTINGS_CONFIG: menu_cell_draw_other(ctx, cell_layer, check_phone_message ? "Check phone..." : "Config/Donate", NULL , bitmap_settings); break; + case MENU_SETTINGS_CONFIG: menu_cell_draw_other(ctx, cell_layer, check_phone_message ? "Check phone..." : "Config/Donate", NULL , bitmaps[BITMAP_SETTINGS]); break; #ifdef PBL_SDK_3 case MENU_SETTINGS_TIMELINE: menu_cell_draw_setting(ctx, cell_layer, "Timeline", timeline_settings&TIMELINE_FLAG_ON ? "ON" : "OFF",NULL); break; case MENU_SETTINGS_TL_NOTIFICATIONS: menu_cell_draw_setting(ctx, cell_layer, "..Notifications", timeline_settings&TIMELINE_FLAG_NOTIFICATIONS ? "ON" : "OFF",NULL); break; diff --git a/src/main_menu.h b/src/main_menu.h index 5a3474e..c13c437 100644 --- a/src/main_menu.h +++ b/src/main_menu.h @@ -1,7 +1,7 @@ #pragma once void menu_cell_draw_job(GContext* ctx, const Layer *cell_layer, const uint8_t index); -void menu_cell_draw_other(GContext* ctx, const Layer *cell_layer, const char *title, const char *sub_title, GBitmap * icon); +void menu_cell_draw_other(GContext* ctx, const Layer *cell_layer, const char *title, const char *sub_title, GBitmap ** icon); void handle_ticktimer_tick(struct tm *tick_time, TimeUnits units_changed); void main_menu_show(void); void main_menu_hide(void); diff --git a/src/pebble-js-app.js b/src/pebble-js-app.js index 7e91fdb..0977d61 100644 --- a/src/pebble-js-app.js +++ b/src/pebble-js-app.js @@ -1,18 +1,20 @@ -// https://github.com/pebble-examples/slate-config-example/blob/master/src/js/pebble-js-app.js - var TIMELINE_FLAG_ON = 1; var TIMELINE_FLAG_NOTIFICATIONS = 2; Pebble.addEventListener('ready', function() { console.log('PebbleKit JS ready!'); var settings=localStorage.getItem("settings"); - //settings='{"101":"Tremadol|1454364000|8|1","102":"Paracetamol|1454378453|6|1","103":"Omeprazole|1454351412|24|1","KEY_APP_VERSION":"1.4","KEY_SORT":1,"KEY_MEDICATIONS":"Ibuprofen|1454367649|6|1","KEY_VERSION":3,"KEY_MODE":2,"KEY_TIMESTAMP":1454380831,"KEY_ALARM":1}'; - var dict=settings ? JSON.parse(settings) : {}; - if (!dict.KEY_TIMESTAMP) { + //settings='{"101":"Ibuprofen|1454731249|6|1","102":"Tremadol|1454738400|8|1","103":"Omeprazole|1454697012|24|1","KEY_TIMELINE":0,"KEY_APP_VERSION":"1.5","KEY_SORT":1,"KEY_MEDICATIONS":"Paracetamol|1454720453|6|1","KEY_VERSION":4,"KEY_MODE":2,"KEY_TIMESTAMP":1454739389,"KEY_ALARM":0}'; + settings=settings ? JSON.parse(settings) : {}; + if (!settings.KEY_TIMESTAMP) { var d=new Date(); - dict.KEY_TIMESTAMP = Math.floor(d.getTime()/1000 - d.getTimezoneOffset()*60); + settings.KEY_TIMESTAMP = Math.floor(d.getTime()/1000 - d.getTimezoneOffset()*60); + } + sendDict(settings); + if (localStorage.getItem("old_pins")) { + deleteAllPins(); + if (settings.KEY_TIMELINE & TIMELINE_FLAG_ON) createAllPins(settings); } - sendDict(dict); }); Pebble.addEventListener("appmessage", function(e) { @@ -27,7 +29,6 @@ Pebble.addEventListener("appmessage", function(e) { if (typeof(e.payload.KEY_TIMELINE)!="undefined") { deleteAllPins(); if (e.payload.KEY_TIMELINE & TIMELINE_FLAG_ON) createAllPins(e.payload); - if (requests_outstanding===0) sendDict({KEY_PINS_DONE:1}); } }); @@ -119,33 +120,58 @@ Pebble.addEventListener('webviewclosed', function(e) { /****************************** Custom Timeline Stuff ************************/ var pin_prefix="MedTimer-pin-"; -var requests_outstanding=0; function deleteAllPins() { // delete any old pins var pin; - var last_pins=localStorage.getItem("pins"); - var pin_old_now=localStorage.getItem("pin_now"); - var med=0; - console.log("last pins: "+pin_old_now+"-"+last_pins); - while (med -1) old_pins.splice(index, 1); + if (old_pins.length) { + localStorage.setItem("old_pins",JSON.stringify(old_pins)); + } else { + localStorage.removeItem("old_pins"); + } + console.log("remaining old pins: "+JSON.stringify(old_pins)); }); - med++; } } function createAllPins(dict) { if (!dict) return; var pin; + var med; var setting; - var pin_now=(new Date()).valueOf(); - var med=0; + var pin_now=(new Date()).valueOf()+"-"; + var pins=JSON.parse(localStorage.getItem("pins")) || []; + + // get list of med names and sort them alphabetically. + var new_pins=[]; + med=0; + while (setting=(med===0) ? dict.KEY_MEDICATIONS : dict[100+med]) { + setting=setting.split("|"); + new_pins.push(setting[0]); // med name + med++; + } + new_pins.sort(); + + // create and send pins + med=0; while (setting=(med===0) ? dict.KEY_MEDICATIONS : dict[100+med]) { // get the time setting=setting.split("|"); @@ -156,7 +182,7 @@ function createAllPins(dict) { // configure the pin pin = { - "id": pin_prefix+pin_now+"-"+med,//pin_prefix+med, + "id": pin_prefix+pin_now+med,//pin_prefix+med, "time": d.toISOString(), "layout": { "type": "genericPin", @@ -167,7 +193,7 @@ function createAllPins(dict) { { "title": "Med Taken", "type": "openWatchApp", - "launchCode": 10+med + "launchCode": 10+new_pins.indexOf(setting[0]) }, { "title": "Open Meds Timer", @@ -188,19 +214,17 @@ function createAllPins(dict) { } ]; } - + // remember pin, to be deleted later + pins.push(pin_now+med); // Push the pin console.log('Inserting pin in the future: ' + JSON.stringify(pin)); - requests_outstanding++; - insertUserPin(pin, function(responseText) { - console.log('insertUserPin Result: ' + responseText); - if (--requests_outstanding===0) sendDict({KEY_PINS_DONE:1}); + insertUserPin(pin, function(responseText, id) { + //console.log('insertUserPin Result: ' + responseText+" "+id); }); med++; } - console.log("remembering pins: "+pin_now+"-"+med); - localStorage.setItem("pins",med); - localStorage.setItem("pin_now",pin_now); + console.log("remembering pins: "+JSON.stringify(pins)); + localStorage.setItem("pins",JSON.stringify(pins)); } @@ -227,7 +251,7 @@ function timelineRequest(pin, type, topics, apiKey, callback) { var xhr = new XMLHttpRequest(); xhr.onload = function () { //console.log('timeline: response received: ' + this.responseText); - callback(this.responseText); + callback(this.responseText, pin.id); }; xhr.onerror=function(error) { console.log('timeline: error: ' +JSON.stringify(error)); diff --git a/src/update.c b/src/update.c index d734949..2d48d8b 100644 --- a/src/update.c +++ b/src/update.c @@ -36,7 +36,7 @@ static void initialise_ui(void) { // s_textlayer_features s_textlayer_features = text_layer_create(GRect(2+MARGIN, HEIGHT+MARGIN, bounds.size.w-2*(2+MARGIN), bounds.size.h-HEIGHT-MARGIN)); - text_layer_set_text(s_textlayer_features, "* Medications now appear on the timeline\n\n* Optimised for Pebble Time Round"); + text_layer_set_text(s_textlayer_features, "* Medications now appear on the timeline\n\n* Improved for Pebble Time Round"); text_layer_set_font(s_textlayer_features, FONT_GOTHIC_18); #ifdef PBL_ROUND text_layer_set_text_alignment(s_textlayer_features, GTextAlignmentCenter);