# HG changeset patch # User Michiel Broek # Date 1712064556 -7200 # Node ID 780cc08df263276ed3bbe365e5ca0df9ae6b56a1 # Parent e981d01854855d0795f11e1eaa8c169f1b85a48e State machine logging only when debug is active. diff -r e981d0185485 -r 780cc08df263 thermferm/one-wire.c --- a/thermferm/one-wire.c Tue Apr 02 15:03:12 2024 +0200 +++ b/thermferm/one-wire.c Tue Apr 02 15:29:16 2024 +0200 @@ -18,6 +18,8 @@ * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +extern int debug; + #include "thermferm.h" #include "statetbl.h" #include "one-wire.h" diff -r e981d0185485 -r 780cc08df263 thermferm/statetbl.h --- a/thermferm/statetbl.h Tue Apr 02 15:03:12 2024 +0200 +++ b/thermferm/statetbl.h Tue Apr 02 15:29:16 2024 +0200 @@ -23,7 +23,8 @@ #define SM_START(x) \ sm_state=x;\ - syslog(LOG_NOTICE, "SM (%s): Start => %s", sm_name, sm_sname[sm_state]); \ + if (debug)\ + syslog(LOG_NOTICE, "SM (%s): Start => %s", sm_name, sm_sname[sm_state]); \ while (!sm_success) switch (sm_state)\ {\ default: syslog(LOG_WARNING, "Statemachine %s error: state=%d",sm_name,sm_state);\ @@ -41,13 +42,14 @@ } #define SM_PROCEED(x) \ - if (x != sm_state) {\ + if (x != sm_state && debug) {\ syslog(LOG_NOTICE, "SM (%s): %s => %s", sm_name, sm_sname[sm_state], sm_sname[x]);\ }\ sm_state=x; break; #define SM_SUCCESS \ - syslog(LOG_NOTICE, "SM (%s): %s => Success", sm_name, sm_sname[sm_state]);\ + if (debug)\ + syslog(LOG_NOTICE, "SM (%s): %s => Success", sm_name, sm_sname[sm_state]);\ sm_success=1; break; #define SM_ERROR \