Closed amotl closed 4 years ago
I prefer another method for start_conversion, which I have implemented:
Code Snippet:
if (rom is None) and (len(self.roms) == 1):
rom = self.roms[0]
assert rom is not None, "ROM address missing or ambiguous"
ow = self.ow
ow.reset()
if rom is self.roms:
ow.write_byte(ow.CMD_SKIPROM)
else:
ow.select_rom(rom)
ow.write_byte(0x44) # Convert Temp
Dear Robert,
we feel the procedure regarding "if there is exactly one device on the bus" is very ambiguous and will not be compatible with Genuine MicroPython anyway, so I proposed to get rid of this within #2. However, I recognize you prefer it that way, so feel free to combine this.
Another way could be to provide the same functionality using a different method like start_conversion_smart
which has less of a code smell.
With kind regards, Andreas.
I'm going to drop that Pycom specific version anyhow and make onewire.py/ds18x20.py mostly compatible to the micryopthon.org version.
Thanks a bunch! Then let's just close this in favor of #10.
The idea is coming from the respective driver within Genuine MicroPython: https://github.com/micropython/micropython/blob/v1.11/drivers/onewire/ds18x20.py#L18-L21