diff --git a/include/common.h b/include/common.h index 41d2119..a764d81 100644 --- a/include/common.h +++ b/include/common.h @@ -102,7 +102,7 @@ extern char* pongo_path; extern bool dfuhelper_only, pongo_exit; #ifdef DEV_BUILD -extern bool use_tui; +extern bool use_tui, tui_started; #endif extern pthread_t dfuhelper_thread, pongo_thread; diff --git a/src/log.c b/src/log.c index 231355e..acfe6e4 100644 --- a/src/log.c +++ b/src/log.c @@ -21,12 +21,12 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna char colour_bold[0x10]; va_list args; va_start(args, format); - if (verbose < (loglevel - 3) && loglevel > LOG_INFO + if (verbose < (loglevel - 3) && loglevel > LOG_INFO) { + if (verbose >= 5 #ifdef DEV_BUILD - && !use_tui + && !tui_started #endif - ) { - if (verbose >= 5) fprintf(stderr, "p1_log: hid log with high log level (%d < %d)\n", verbose, loglevel - 3); +) fprintf(stderr, "p1_log: hid log with high log level (%d < %d)\n", verbose, loglevel - 3); return 0; } switch (loglevel) { @@ -58,7 +58,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna break; } #ifdef DEV_BUILD - if (use_tui) { + if (use_tui && tui_started) { newtComponent co = get_tui_log(); if (co == NULL) { return 0; /* 0 bytes printed */ diff --git a/src/main.c b/src/main.c index d5a8318..fbe129a 100644 --- a/src/main.c +++ b/src/main.c @@ -87,7 +87,7 @@ int build_checks() { bool dfuhelper_only = false, pongo_exit = false, palerain_version = false; #ifdef DEV_BUILD -bool use_tui = false; +bool use_tui = false, tui_started = false; #endif int palera1n(int argc, char *argv[]) { diff --git a/src/tui_main.c b/src/tui_main.c index 4955ed8..3384da4 100644 --- a/src/tui_main.c +++ b/src/tui_main.c @@ -40,6 +40,7 @@ int init_window() { "checkbox=lightgray,black\n" "actcheckbox=black,lightgray\n"); + tui_started = true; newtInit(); newtCls(); newtSetColor(PI_LOG_COLOR, "yellow", "black");