mcsakoff / pydigitemp

Python implementation of 1-Wire protocol.
Other
16 stars 11 forks source link

Example snippet not working #10

Closed arnauddevie closed 3 years ago

arnauddevie commented 3 years ago

In the example labeled "Get temperature when there is only one 1-wire device on the bus", there is a typo and TemperatureSensor() call does not match the signature for this class and therefore fails.

Example

from digitemp.master import UART_Adapter
from digitemp.device import TemperatureSensor

sensor = TemperatureSensor(UART_Adapter('/dev/ttyS0') # <- missing ')'
sensor.info()
print(sensor.get_temperature())

Signature

def TemperatureSensor(bus, rom): # rom must be passed

Maybe you were thinking of OneWireTemperatureSensor() ?

Thank you for sharing your library btw!

mcsakoff commented 3 years ago

Nice catch! Actually not only missed a closing bracket, I've also forgot to implement ROM argument as optional. Missed it during last refactoring.

mcsakoff commented 3 years ago

Fixed in a8220ad070fc0a25f7e650e362c6b3907ca47f60.