From 6d9bd8709fc9b3d747f3649c38eaf91b3e955b54 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 26 Oct 2018 13:08:37 +0200 Subject: [PATCH 1/2] sys/auto_init: Fixed initialization of sht1x - the driver for sht1x is initialized two times - the second initialization is done only when SAUL is used, but sht1x needs to be initialized in any case. (SAUL registration is also done there, but only when SAUL is actually being used.) This commit fixes both. --- sys/auto_init/auto_init.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index a15179735a..6e5d9f27eb 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -428,10 +428,6 @@ void auto_init(void) extern void auto_init_pulse_counter(void); auto_init_pulse_counter(); #endif -#ifdef MODULE_SHT1X - extern void auto_init_sht1x(void); - auto_init_sht1x(); -#endif #ifdef MODULE_SI114X extern void auto_init_si114x(void); auto_init_si114x(); From da84d10cbf95fdf75cc61933baf65382897d7d5e Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Mon, 29 Oct 2018 13:20:06 +0100 Subject: [PATCH 2/2] sys/auto_init: Improved doc on sht1x auto init The auto initialization of the sht1x module differs from the initialization of other sensors, but previously no documentation pointed that out. This lack of documentation led to a bug being introduced. This commit provides the previously missing documentation. --- sys/auto_init/auto_init.c | 4 ++++ sys/auto_init/saul/auto_init_sht1x.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 6e5d9f27eb..61e6f16ae8 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -296,6 +296,10 @@ void auto_init(void) /* initialize sensors and actuators */ #ifdef MODULE_SHT1X + /* The sht1x module needs to be initialized regardless of SAUL being used, + * as the shell commands rely on auto-initialization. auto_init_sht1x also + * performs SAUL registration, but only if module auto_init_saul is used. + */ DEBUG("Auto init SHT1X module (SHT10/SHT11/SHT15 sensor driver).\n"); extern void auto_init_sht1x(void); auto_init_sht1x(); diff --git a/sys/auto_init/saul/auto_init_sht1x.c b/sys/auto_init/saul/auto_init_sht1x.c index 3264ab9b45..4f49db3275 100644 --- a/sys/auto_init/saul/auto_init_sht1x.c +++ b/sys/auto_init/saul/auto_init_sht1x.c @@ -16,6 +16,11 @@ * * @author Marian Buschsieweke * + * Please note that the sht1x differs from other sensor modules, as + * initialization is performed regardless of the use of SAUL. However, when + * the module `auto_init_saul` is *not* used, the SAUL registration is skipped + * and the initialization does *not* depend on SAUL in this case. + * * @} */