-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite of the Lua DS18B20 module #1883
Comments
@devsaurus @pjsg @jmattsson I've added a gist copy here. I'd be interested in your views. I am rewriting a few of these for my own use anyway, and I'd like your views on whether it is worth replacing the existing libraries as we do so. What I've done here is to make the code a lot more runtime efficient as well as address a few functional holes. |
Gist link needs to be fixed. Github is improperly prepending |
Sorry Jonathan. Done 😃 |
Haven't used any DS18B20s with NodeMCU, so have nothing to compare against, but this seems good? |
Why the ? 😃 |
Because I don't feel like I'm an authoritative source on such matters? :) |
try test your code. But get
I use nodencu pin3(GPIO0) |
@TerryE I have upgraded my module using your suggestions. It should fix majority of flaws discussed in #1820. Please have a look here: https://github.com/vsky279/nodemcu-firmware/tree/DS18B20/lua_modules/ds18b20 Enhancements:
Possible enhancements:
If there is no opposition I would submit a PR as this implementation is better than the existing module. I still think the module should support both parasit and non-parasit powered sensors (which is not supported by your module). |
@vsky279 Lukáš, I thimk that it would be a good thing to converge on a single implementation that we both support. If we can do that, then it will be a good solution. Things that I would prefer to add:
Give me a few days. I am up to my neck in my core ro TSring stuff. :) |
@TerryE I've started to implement your suggestion (except the integer stuff :-) ) so don't spend your time on it. I will come with a proposal that you can review afterwards. |
@TerryE I need to restart. What I miss is the optional storing and retrieval of address to flash. |
@TerryE Please have a look at the latest version of updated module: https://github.com/vsky279/nodemcu-firmware/blob/DS18B20/lua_modules/ds18b20/ds18b20.lua It has all the functionalities discussed. The documentation is not yet updated. Please see the example in the same directory. Please let me know your thoughts about it. |
Done. I need to update documentation and will submit a PR. |
I am not sure at this stage whether this is a bugrep or a missing feature. I am using DS18B20s in anger and decided that I'd rewrite the ds18b20 lua module. My reasons were as follows:
convert_T()
call which issues the convert command and a separateread()
which collects the response from a single thermometer which and be collected on a ALARM_SEMI callback.convert_(true)
does anow.skip()
instead of anow.select()
and starts all DS18B20s converting in parallel.ds18b20_save.lc
and reloads this subsequently on first use so that you don't need to do the search each waking after deep sleep.Here is my test harness which shows the difference at an application level:
You can happily crank this up to collect half a dozen probe temperatures each second.
The text was updated successfully, but these errors were encountered: