Skip to content

New Usermod: SHT temperature & humidity sensors - #2942

Merged
blazoncek merged 13 commits into
wled:mainfrom
ezcGman:um-sht
Dec 19, 2022
Merged

blazoncek merged 13 commits into
wled:mainfrom
ezcGman:um-sht

Conversation

@ezcGman

@ezcGman ezcGman commented Dec 11, 2022 •

Copy link
Copy Markdown
Contributor

Hey there,

I don't think we have enough temperature sensors, do we? ;) WLED already has support for the Dallas temp sensors (e.g. used on the QuinLED Dig-Uno and Dig-Quad), DHT temp sensors and now I also add support for various SHT i2c sensors, which are used on the new QuinLED Dig-Octa, as also on the An-Penta.

Some facts:

Please let me know what you think and where I can improve :)

Thanks for considering this mod and greetings,

Andy!

@blazoncek blazoncek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for excellent contribution.
I do have a few requests for change as it may benefit the usability.

As for global I2C there were a few complaints that sharing I2C may cause issues. Please test that with 4LD ALT usermod (or any other that uses I2C). Perhaps other usermods may need a rewrite to make them work (a separate PR).

Otherwise the code is clean and well structured.

Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
@ezcGman

ezcGman commented Dec 11, 2022

Copy link
Copy Markdown
Contributor Author

Thanks Blaz!! I'll try checking out tonight with other i2c mods. I think I even have a four line display laying around here, so can actually test! Will let you know!

@blazoncek

Copy link
Copy Markdown
Contributor

You may as well follow the guideline I posted on Discord #dev-general. Any function defined within class definition is automatically inline.
So try to move function definitions out of class definition.

@ezcGman

ezcGman commented Dec 15, 2022

Copy link
Copy Markdown
Contributor Author

@blazoncek Except for testing the mod with other mods using the global i2c pins (like 4LD), all feedback should have been applied. Will try to test the mod with the 4LD mod the next days and report back!

But please, if you have some time already, check if your feedback has been properly addressed / solved :)

THX!

@blazoncek blazoncek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@ezcGman

ezcGman commented Dec 16, 2022

Copy link
Copy Markdown
Contributor Author

OK, so I have been testing a bit with also compiling with the 4LD ALT mod. Sadly, I don't have an i2c 4LD, but an SPI one... So couldn't really test having two i2c devices running simultaneously :/

However, I added a bit of debugging and see what the i2cAllocCount does when en-/disabling both mods. And I really got weird results: Most of the time, the counter kept increasing with every en- or disable; super weird. Tested it happend with both mods together and also with both compiled exclusively. Something at the core must cause this. But I think this deserves its own issue and tracking; don't think this should block the mod really :/

I also saw that the i2cAllocCount is only in-/decremented if you use the allocateMultiple / deallocateMultiple methods, but not the single de-/allocate methods. Is that intentional?

However, I made a few changes to how I de-/allocate pins.

Hope this concludes that mod and is good to go :) THX!!

@blazoncek

Copy link
Copy Markdown
Contributor

I also saw that the i2cAllocCount is only in-/decremented if you use the allocateMultiple / deallocateMultiple methods, but not the single de-/allocate methods. Is that intentional?

Yes, that is intentional and mandatory.

Comment thread usermods/sht/usermod_sht.h Resolved
Comment thread usermods/sht/usermod_sht.h Resolved
@blazoncek

Copy link
Copy Markdown
Contributor

@softhack007 if everything is ok with you, I am ok merge it.

@softhack007

softhack007 commented Dec 18, 2022 •

Copy link
Copy Markdown
Member

@blazoncek Just waiting for the pin >= 0 check to be added, otherwise looks very good 👍

@ezcGman

ezcGman commented Dec 18, 2022

Copy link
Copy Markdown
Contributor Author

@blazoncek @softhack007 Should be done :)

@softhack007 softhack007 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I approve.

@blazoncek
blazoncek merged commit b241872 into wled:main Dec 19, 2022
aenertia pushed a commit to aenertia/WLED that referenced this pull request Aug 18, 2026
New Usermod: SHT temperature & humidity sensors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants