Code Monkey home page Code Monkey logo

Comments (16)

savageautomate avatar savageautomate commented on July 19, 2024 1

Unit test code merged. This W1 impl is now available in the latest 1.1-SNAPSHOT build. Thanks!

from pi4j-v1.

marcandreuf avatar marcandreuf commented on July 19, 2024

I implemented an example in JAVA using the modprobe driver and reading from the file. Just like the article. At least I could read temperature values in a Raspberry pi :-)

https://github.com/marcandreuf/sunfounder-sensors-raspi-4j/blob/master/src/main/java/org/mandfer/sunfunpi4j/Ex16_Ds18b20.java

I hope it helps.

from pi4j-v1.

ademcaliskan avatar ademcaliskan commented on July 19, 2024

I would suggest an static function for listing all available wired devices as an Array or List.

Adem

from pi4j-v1.

DataWorm avatar DataWorm commented on July 19, 2024

Schups code looks fine, but it is a few months old. Until now there has been no reaction on his merge request... Is there a chance, that it will get merged soon or got this issue postponed for a specific reason?

from pi4j-v1.

natdan avatar natdan commented on July 19, 2024

I've only got active now (someone was of impression that he's following this project while he wasn't). I'll go through the code over weekend and do the necessary. Sorry for the delay...

from pi4j-v1.

savageautomate avatar savageautomate commented on July 19, 2024

BTW, it will get merged into the 'develop' branch which means that it will be available in the 1.1-SNAPSHOT builds.

from pi4j-v1.

DataWorm avatar DataWorm commented on July 19, 2024

Seems to take some more weekends? ;-)
Could we help in some way? Is there something that needs to be improved (apart from some javadoc comments) before it could be merged?

from pi4j-v1.

natdan avatar natdan commented on July 19, 2024

All help appreciated. Do you know how to lay laminate? Or at least remove existing tiles from kitchen floor? I think I got confused by Robert's message thinking he has already done it. Will start looking into it tonight. Sorry about it.

from pi4j-v1.

DataWorm avatar DataWorm commented on July 19, 2024

I think I could learn it on-the-fly. But free support for such tasks is limited to Berlin! ;-)

from pi4j-v1.

natdan avatar natdan commented on July 19, 2024

OK. I've skimmed through Schups's code and I am not 100% sure what to do. Code itself is fine and I'll pull b76d065 and f16c54c - it will, at least buy us some time. Only thing is that it, probably, will be just WIP or initial (working) starting point for One Wire interface.
My only problem is that it doesn't (at this moment) capture 'idea' of 1-wire interface and in this format I cannot see it being implemented with simple bit banging through GPIO. TmpDS18B20 class, for instance, must be tied to a file (direct, one of, implementations of 1-wire protocol through kernel driver). I would be more interested seeing something closer to the low level driver which, then can be implemented through /sys file system (as here) or bit banging or ... whatever is there. Implementation for test it third one I can envisage here. Still good place to start all with! Thanks Schups :)
BTW 9f59171 doesn't go under 1-wire protocol. Maybe it should be pulled after reviewed by Robert...

from pi4j-v1.

schup avatar schup commented on July 19, 2024

I agree - native implemenation of the 1-wire protocol would be nice.
Unfortunately I don't know the interals of the 1-wire protocol.

I've sumitted the merge request to get some feedback on the implementation and if the general approach would be good enough for now.
It is WIP :-)
The code is not really documented and well tested. Since the DS18B20 sensor is the only 1-wire device I have ever used there may be some specifics that wouldn't work well with other devices.

9f59171 - I merged the development branch back in to make sure it isn't breaking anything.
I would suggest to not merge the feature branch until has stabilized a bit more :-)

Cheers,
Peter

from pi4j-v1.

natdan avatar natdan commented on July 19, 2024

I've made implementation of one wire protocol some 20 years ago for 8031 (8051) µControllers and there are some resources on the internet (oh, what a understatement), so I don't mind looking more into it when time allows... And I hope it is going to be soon as I would like to use RPi + 2x1820 (or newer equivalent) soon as replacement for my hot water/heating controller.
Anyway - you've tested your code with real device and it works - that's really good start! :)
Will merge it as soon as return from the business trip.

from pi4j-v1.

DataWorm avatar DataWorm commented on July 19, 2024

Of course a bit-banging implementation might be nice but kernel support on the other side might be more efficient?!
The DHT11 or DHT22 sensors for example (which would be my next feature requests) uses a single dataline but with another manchester-like protocol. I saw multiple implementations for it without kernel support. The python implementations have a lot of read fails due to the timing. C implementations perform much better but still can have read fails. W1 might have the same issue?! Therefore a kernel support would be a better working solution, wouldn't it?!

from pi4j-v1.

natdan avatar natdan commented on July 19, 2024

There's nothing wrong relying on kernel support and I see implementation of one wire protocol that users that particular kernel module as a primary implementation. But API (java interfaces) shouldn't really be kernel module specific (i.e. talking about exposed files) but to expose higher (lower?!) level functions one wire protocol itself defines. They will nicely translate to kernel module implementation, but at the same time allow other implementations and ability to move to other platforms(), too.
DHT11/22 protocol API should be specification agnostic, too. Maybe we can start with C implementation (and JNI bridge to it) and see if anyone comes up with a kernel module, too. That would allow us to move from one implementation (which might not be ideal) to better one later without breaking compatibility of systems using it.
(
) Server API defined pi4j works perfectly on Lejos and Haiku - not as a fully fledged pi4j port but more like cut down hacked version... Still code that works on pi4j (and uses Server API) works perfectly without any changes on those platforms because API is implementation agnostic...

from pi4j-v1.

natdan avatar natdan commented on July 19, 2024

Done. Again, apologies for not have done it sooner. Your code is now in develop branch. See pull request comments for failing tests..

from pi4j-v1.

giampiero7 avatar giampiero7 commented on July 19, 2024

Hi @savageautomate,
I'd just like to point out that WiringPi includes the driver for the MaxDetect series 1-wire sensors:

https://github.com/WiringPi/WiringPi/blob/master/devLib/maxdetect.c

It might be nice including it in Pi4J too :)
I'll let you decide if it is worth having it as an enhancement...

Cheers,
Giampiero

from pi4j-v1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.