-
Notifications
You must be signed in to change notification settings - Fork 15
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
There is no I2C devices found when running from headed app #2
Comments
I am having a similar issue:
Even though this line succeeds
so it finds the controller, but fails to communicate with the sensor. fails on this line
The connection is pretty straitforward |
Where do you have the DS2482-100 I2C to OneWire bridge in that connection? It is required for this library to work as there is no hardware OneWire support in the Raspberry Pi. I use this one, http://www.modmypi.com/raspberry-pi/breakout-boards/owfs-1-wire/r-pi-i2c-1-wire-owfs-expansion-module- |
I overlooked that. Thought the library does something like https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/ds18b20 So to make it work on Windows IoT I need a bridge you referes to. |
For, at least, this code to work you need a bride like the one I linked there unfortunately. One way to do it if you don´t want to buy a bridge like that is to use a Arduino as a bridge instead but my code here will not help you with that. |
I tried to connect a DS18B20 sensor with my r-pi3. I'm using the same i2c-1-wire expansion module from modmypi.com. Sensor is connected like this: My questions: is the wiring correct? Thank you for any hint. |
Hi @fabianandres! Have you made sure that you are disposing the OneWireDeviceHandler in a using block? Or reuse the same instance over and over again. The I2C bus that is used to communicate with DS2482-100 is a very limited resource that needs to be disposed every time if you let go of the instance.
I have been running a device for months without any issues. |
Hi, Thank you for your fast response. Yes, I enclosed OneWireDeviceHandler in a using block. Tried also to reuse same instance. This works until I restart application. I tried to dispose instance after every reading. if (this.oneWireDeviceHandler == null)
But the same result here. After restarting application, it fails on this line: new OneWireDeviceHandler(true, true); Do you any other idea, whats wrong? Thank you, Fabian Von: Fredrik Rinsén [mailto:notifications@github.com] Hi! Have you made sure that you are disposing the OneWireDeviceHandler in a using block? Or reuse the same instance over and over again. The I2C bus that is used to communicate with DS2482-100 is a very limited resource that needs to be disposed every time if you let go of the instance. using(var oneWireDeviceHandler = new OneWireDeviceHandler()) I have been running a device for months without any issues. — |
Could you create a as small as possible repro project in a github repository that I can try with the same problem? It probably has to do with the project type in some way I think, but it´s strange... And I would like to investigate and try to fix this issue :) |
Hello, I created a repository at https://github.com/fabianandres/BrewSentinel Thank you for your help! Von: Fredrik Rinsén [mailto:notifications@github.com] Could you create a as small as possible repro project in a github repository that I can try with the same problem? It probably has to do with the project type in some way I think, but it´s strange... And I would like to investigate and try to fix this issue :) — |
I think I have found the issue here, I will try to implement it and release a new version with some sample code but I have a lot of other things going on so I cant promise when it will be done but within some days at least. But the problem is related to how Task<> and IAsyncOperation<> is working in headed and headless apps. For some reason that I can´t understand they differ. The solution in headed apps is to run an IAsyncOperation<> with a method call to .AsTask() to get a "normal" Task<> and things start to work as they do in headless mode. while waiting for a Task<> to complete. I will post here as soon as it is done so you can test it @fabianandres |
@fabianandres And in the Headed sample you will see that I never dispose the OneWireHandler as this is for some reason not supported with my current implementation in headed mode. But it still works as it should in headless and there you can dispose it and create a new one if you like to. I have not updated my nuget package right now but will do some more tests before I do that. I will also close down this issue when that package is out as the main issue is resolved. |
I have published a new version to nuget now and will close this issue |
For details #1
The text was updated successfully, but these errors were encountered: