sys/auto_init: Fixed initialization of sht1x#10267
Conversation
|
@PeterKietzmann, @MichelRottleuthner: As you have an MSB-A2 board, does one of you mind to test this PR? |
- 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.
|
After thinking about it I realized that the bug was introduced because adequate documentation of differences between the initialization of the sht1x and other sensors is missing. I will update this PR tomorrow to provide this documentation. |
|
@jia200x do you want this to be backported to the release branch? |
|
@PeterKietzmann yes, let's backport it ;). I will add the label |
|
@maribu could you provide a backport PR to |
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.
|
@jia200x: Sure. Both the added documentation and the bugfix, or only the bugfix? (I see little potential of breaking things by adding documentation, so I personally would go for both.) |
|
@maribu thanks for the documentation. To be honest, I don't understand what makes this driver so different from others. SAUL is one feature, but each driver should be auto-initialized if included via Makefile, no matter about SAUL. |
Sure, I take it-
I think in this case it's not necessary. If the commits are the same and doesn't break master, then there are really low chances that breaks the Release. If something gets broken, it should be fixed in the So, I would just backport this whole PR :) |
I do agree with that. Providing known-to-work auto initialization will make life easier for application developers and using the There is one drawback with the approach in the sht1x: The API is a bit clumsy. It asks for a pointer to an This code snipped shows the clumsy-ness quite well: RIOT/sys/shell/commands/sc_sht1x.c Lines 32 to 56 in 289e635 The shell command expects the user to give the number of the SHT1X device (e.g. 0 when only one is present) and has to get to the correct device "by hand". I was thinking about suggesting:
or
Once the cc110x rewrite is done I will create an PR that converts the sht1x API to suggestion b) to receive feedback on it. |
|
@jia200x: The backport is done :-) |
|
ok, the documentation makes sense. |
Contribution description
Commit cef81a1 introduced two bugs:
to be initialized in any case. (SAUL registration is also done there, but
only when SAUL is actually being used.)
This commit fixes both.
Testing procedure
E.g. use
examples/defaulton a board that features an SHT1x sensor, e.g. the MSB-A2. Prior to this PR RIOT will not boot due to the double initialization, with this PR applied RIOT will boot again.