From 9f8e63a7c84aa8cc5ef6c953bc40fa6f78d39432 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 6 Aug 2019 23:19:59 +0200 Subject: [PATCH] print errors only if dbg level allows errors --- armsrc/ticks.c | 2 +- armsrc/util.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/armsrc/ticks.c b/armsrc/ticks.c index 1a726975f..18bca7f5a 100644 --- a/armsrc/ticks.c +++ b/armsrc/ticks.c @@ -38,7 +38,7 @@ void SpinDelayUs(int us) { // WARNING: timer can't measure more than 1.39s (21.3us * 0xffff) void SpinDelay(int ms) { if (ms > 1390) { - Dbprintf(_RED_("Error, SpinDelay called with %i > 1390"), ms); + if (DBGLEVEL >= DBG_ERROR) Dbprintf(_RED_("Error, SpinDelay called with %i > 1390"), ms); ms = 1390; } // convert to us and call microsecond delay function diff --git a/armsrc/util.c b/armsrc/util.c index 2fe449942..cb8668783 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -179,7 +179,7 @@ int BUTTON_CLICKED(int ms) { // timer counts in 21.3us increments (1024/48MHz) // WARNING: timer can't measure more than 1.39s (21.3us * 0xffff) if (ms > 1390) { - Dbprintf(_RED_("Error, BUTTON_CLICKED called with %i > 1390"), ms); + if (DBGLEVEL >= DBG_ERROR) Dbprintf(_RED_("Error, BUTTON_CLICKED called with %i > 1390"), ms); ms = 1390; } int ticks = ((MCK / 1000) * (ms ? ms : 1000)) >> 10; @@ -243,7 +243,7 @@ int BUTTON_HELD(int ms) { // timer counts in 21.3us increments (1024/48MHz) // WARNING: timer can't measure more than 1.39s (21.3us * 0xffff) if (ms > 1390) { - Dbprintf(_RED_("Error, BUTTON_HELD called with %i > 1390"), ms); + if (DBGLEVEL >= DBG_ERROR) Dbprintf(_RED_("Error, BUTTON_HELD called with %i > 1390"), ms); ms = 1390; } // If button is held for one second