From eedaef0928b0d92df6e5d3d2ebedc75d353fb0f8 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 3 Nov 2021 10:42:30 +0100 Subject: [PATCH] Fix profiling compile time warnings --- tasmota/my_user_config.h | 9 +++++++++ tasmota/support_profiling.ino | 20 +++++++++++++------- tasmota/tasmota_globals.h | 17 +++++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 77278a658..0f3b9b979 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -1053,6 +1053,15 @@ //#define DEBUG_TASMOTA_SENSOR // Enable sensor debug messages //#define USE_DEBUG_DRIVER // Use xdrv_99_debug.ino providing commands CpuChk, CfgXor, CfgDump, CfgPeek and CfgPoke +/*********************************************************************************************\ + * Profiling features +\*********************************************************************************************/ + +//#define USE_PROFILING // Enable profiling +//#define PROFILE_THRESHOLD 70 // Minimum duration in milliseconds to start logging +//#define USE_PROFILE_DRIVER // Enable driver profiling +//#define USE_PROFILE_FUNCTION // Enable driver function profiling + /*********************************************************************************************\ * Optional firmware configurations * Select none or just one for optional features and sensors as configured in tasmota_configurations.h diff --git a/tasmota/support_profiling.ino b/tasmota/support_profiling.ino index fa2e6f764..70bb0585e 100644 --- a/tasmota/support_profiling.ino +++ b/tasmota/support_profiling.ino @@ -17,16 +17,18 @@ along with this program. If not, see . */ -//#define USE_PROFILING - -#define PROFILE_THRESHOLD 70 // Minimum duration in milliseconds to start logging -//#define USE_PROFILE_DRIVER -#define USE_PROFILE_FUNCTION - /*********************************************************************************************\ * Profiling features \*********************************************************************************************/ +// Moved to my_user_config.h (and user_config_override.h) +//#define USE_PROFILING // Enable profiling +//#define PROFILE_THRESHOLD 70 // Minimum duration in milliseconds to start logging +//#define USE_PROFILE_DRIVER // Enable driver profiling +//#define USE_PROFILE_FUNCTION // Enable driver function profiling + +/* +// Moved to tasmota_globals.h fixing compile warnings #ifndef USE_PROFILING #undef USE_PROFILE_DRIVER #undef USE_PROFILE_FUNCTION @@ -43,13 +45,17 @@ #else #define PROFILE_FUNCTION(DRIVER, INDEX, FUNCTION, START) #endif // USE_PROFILE_DRIVER - +*/ /*********************************************************************************************\ * Profiling services \*********************************************************************************************/ #ifdef USE_PROFILING +#ifndef PROFILE_THRESHOLD +#define PROFILE_THRESHOLD 70 // Minimum duration in milliseconds to start logging +#endif + // Below needs to be inline with enum XsnsFunctions const char kXSnsFunctions[] PROGMEM = "SETTINGS_OVERRIDE|PIN_STATE|MODULE_INIT|PRE_INIT|INIT|" "LOOP|EVERY_50_MSECOND|EVERY_100_MSECOND|EVERY_200_MSECOND|EVERY_250_MSECOND|EVERY_SECOND|" diff --git a/tasmota/tasmota_globals.h b/tasmota/tasmota_globals.h index 44342081b..aa9f97063 100644 --- a/tasmota/tasmota_globals.h +++ b/tasmota/tasmota_globals.h @@ -495,6 +495,23 @@ bool first_device_group_is_local = true; #define SHOW_FREE_MEM(WHERE) #endif +#ifndef USE_PROFILING +#undef USE_PROFILE_DRIVER +#undef USE_PROFILE_FUNCTION +#endif + +#ifdef USE_PROFILE_DRIVER +#define PROFILE_DRIVER(DRIVER, FUNCTION, START) AddLogDriver(DRIVER, FUNCTION, START) +#else +#define PROFILE_DRIVER(DRIVER, FUNCTION, START) +#endif // USE_PROFILE_DRIVER + +#ifdef USE_PROFILE_FUNCTION +#define PROFILE_FUNCTION(DRIVER, INDEX, FUNCTION, START) AddLogFunction(DRIVER, INDEX, FUNCTION, START) +#else +#define PROFILE_FUNCTION(DRIVER, INDEX, FUNCTION, START) +#endif // USE_PROFILE_DRIVER + /*********************************************************************************************\ * Macro for SetOption synonyms *