From 586b272e1c0328b9a93b339c9e0d9cfe144ec299 Mon Sep 17 00:00:00 2001 From: Jihoon Lee Date: Tue, 6 Oct 2020 20:47:42 +0900 Subject: [PATCH] [CS] Add color to the label and fix status **Changes proposed in this PR:** - Add color to the result label - Fix retun status for void functions **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Jihoon Lee --- Applications/Tizen_native/CustomShortcut/src/data.c | 2 +- Applications/Tizen_native/CustomShortcut/src/view.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Applications/Tizen_native/CustomShortcut/src/data.c b/Applications/Tizen_native/CustomShortcut/src/data.c index 6236914..8f0d4af 100644 --- a/Applications/Tizen_native/CustomShortcut/src/data.c +++ b/Applications/Tizen_native/CustomShortcut/src/data.c @@ -605,7 +605,7 @@ static void on_inference_end_(ml_tensors_data_h data, /// SMILE: 0 1 /// FROWN: 1 0 - LOG_D("label: %lf %lf", raw_data[0], raw_data[1]); + LOG_D("\033[33mlabel: %lf %lf\033[36m", raw_data[0], raw_data[1]); ad->label = raw_data[0] < raw_data[1] ? LABEL_SMILE : LABEL_FROWN; RESUME: diff --git a/Applications/Tizen_native/CustomShortcut/src/view.c b/Applications/Tizen_native/CustomShortcut/src/view.c index cf1598d..098edcd 100644 --- a/Applications/Tizen_native/CustomShortcut/src/view.c +++ b/Applications/Tizen_native/CustomShortcut/src/view.c @@ -242,10 +242,14 @@ void view_set_canvas_clean(appdata_s *ad) { int status = util_get_emoji(ad->label, &emoji); if (status != APP_ERROR_NONE) { LOG_E("getting emoji failed %d", status); - return status; + return; } - sprintf(buf, "draw for %s [%d/%d]", emoji, ad->tries + 1, MAX_TRIES); + if (ad->mode == MODE_INFER) { + sprintf(buf, "draw for %s", emoji); + } else if (ad->mode == MODE_TRAIN) { + sprintf(buf, "draw for %s [%d/%d]", emoji, ad->tries + 1, MAX_TRIES); + } elm_object_part_text_set(ad->layout, "draw/title", buf); elm_object_part_text_set(ad->layout, "draw/label", emoji); @@ -387,14 +391,14 @@ void view_update_guess(void *data) { int status = util_get_emoji(ad->label, &emoji); if (status != APP_ERROR_NONE) { LOG_E("error getting emoji, reason: %d", status); - return status; + return; } - LOG_E("%s", emoji); + LOG_I("\033[33m%s\033[36m", emoji); elm_object_part_text_set(ad->layout, "test_result/title", "guess successfully done"); elm_object_part_text_set(ad->layout, "test_result/label", emoji); free(emoji); - return status; + return; } -- 2.7.4