From 93e59512c3b7871d32503afeef54f5f72603beb9 Mon Sep 17 00:00:00 2001 From: George Gekov Date: Tue, 3 Aug 2021 11:18:41 +0100 Subject: MLECO-2138: Fix line feeding with GCC Signed-off-by: George Gekov Change-Id: I32c05897085554f469bedc55e4e2800788121c55 --- source/use_case/ad/src/MainLoop.cc | 1 + source/use_case/ad/src/UseCaseHandler.cc | 16 +++++++++------- source/use_case/asr/src/MainLoop.cc | 1 + source/use_case/img_class/src/MainLoop.cc | 1 + source/use_case/kws/src/MainLoop.cc | 1 + source/use_case/kws_asr/src/MainLoop.cc | 1 + 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/use_case/ad/src/MainLoop.cc b/source/use_case/ad/src/MainLoop.cc index 6431509..3c2f9cc 100644 --- a/source/use_case/ad/src/MainLoop.cc +++ b/source/use_case/ad/src/MainLoop.cc @@ -40,6 +40,7 @@ static void DisplayMenu() printf(" %u. Show NN model info\n", MENU_OPT_SHOW_MODEL_INFO); printf(" %u. List audio signals\n\n", MENU_OPT_LIST_AUDIO_CLIPS); printf(" Choice: "); + fflush(stdout); } diff --git a/source/use_case/ad/src/UseCaseHandler.cc b/source/use_case/ad/src/UseCaseHandler.cc index ec35156..0c78179 100644 --- a/source/use_case/ad/src/UseCaseHandler.cc +++ b/source/use_case/ad/src/UseCaseHandler.cc @@ -266,21 +266,23 @@ namespace app { /* Display each result */ uint32_t rowIdx1 = dataPsnTxtStartY1 + 2 * dataPsnTxtYIncr; - std::string resultStr = std::string{"Average anomaly score is: "} + std::to_string(result) + - std::string("\n") + std::string("Anomaly threshold is: ") + std::to_string(threshold) + - std::string("\n"); + std::string anomalyScore = std::string{"Average anomaly score is: "} + std::to_string(result); + std::string anomalyThreshold = std::string("Anomaly threshold is: ") + std::to_string(threshold); + std::string anomalyResult; if (result > threshold) { - resultStr += std::string("Anomaly detected!"); + anomalyResult += std::string("Anomaly detected!"); } else { - resultStr += std::string("Everything fine, no anomaly detected!"); + anomalyResult += std::string("Everything fine, no anomaly detected!"); } platform.data_psn->present_data_text( - resultStr.c_str(), resultStr.size(), + anomalyScore.c_str(), anomalyScore.size(), dataPsnTxtStartX1, rowIdx1, false); - info("%s\n", resultStr.c_str()); + info("%s\n", anomalyScore.c_str()); + info("%s\n", anomalyThreshold.c_str()); + info("%s\n", anomalyResult.c_str()); return true; } diff --git a/source/use_case/asr/src/MainLoop.cc b/source/use_case/asr/src/MainLoop.cc index 24b6fcd..42bb08e 100644 --- a/source/use_case/asr/src/MainLoop.cc +++ b/source/use_case/asr/src/MainLoop.cc @@ -44,6 +44,7 @@ static void DisplayMenu() printf(" %u. Show NN model info\n", MENU_OPT_SHOW_MODEL_INFO); printf(" %u. List audio clips\n\n", MENU_OPT_LIST_AUDIO_CLIPS); printf(" Choice: "); + fflush(stdout); } /** @brief Verify input and output tensor are of certain min dimensions. */ diff --git a/source/use_case/img_class/src/MainLoop.cc b/source/use_case/img_class/src/MainLoop.cc index 255f8e0..61a09dd 100644 --- a/source/use_case/img_class/src/MainLoop.cc +++ b/source/use_case/img_class/src/MainLoop.cc @@ -44,6 +44,7 @@ static void DisplayMenu() printf(" %u. Show NN model info\n", MENU_OPT_SHOW_MODEL_INFO); printf(" %u. List images\n\n", MENU_OPT_LIST_IMAGES); printf(" Choice: "); + fflush(stdout); } void main_loop(hal_platform& platform) diff --git a/source/use_case/kws/src/MainLoop.cc b/source/use_case/kws/src/MainLoop.cc index 48cdad4..80254d0 100644 --- a/source/use_case/kws/src/MainLoop.cc +++ b/source/use_case/kws/src/MainLoop.cc @@ -44,6 +44,7 @@ static void DisplayMenu() printf(" %u. Show NN model info\n", MENU_OPT_SHOW_MODEL_INFO); printf(" %u. List audio clips\n\n", MENU_OPT_LIST_AUDIO_CLIPS); printf(" Choice: "); + fflush(stdout); } void main_loop(hal_platform& platform) diff --git a/source/use_case/kws_asr/src/MainLoop.cc b/source/use_case/kws_asr/src/MainLoop.cc index 3a69315..ed9034f 100644 --- a/source/use_case/kws_asr/src/MainLoop.cc +++ b/source/use_case/kws_asr/src/MainLoop.cc @@ -49,6 +49,7 @@ static void DisplayMenu() printf(" %u. Show NN model info\n", MENU_OPT_SHOW_MODEL_INFO); printf(" %u. List audio clips\n\n", MENU_OPT_LIST_AUDIO_CLIPS); printf(" Choice: "); + fflush(stdout); } /** @brief Gets the number of MFCC features for a single window. */ -- cgit v1.2.1