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
fixes for the ESP32 port #29
Conversation
Thanks! This came in at almost the same time as 7330d65. Unfortunately, I have not been quicker to push these improvements.
Can you see if this further care now might have been done already? Saying this, I have not been able to test this code on neither a Pycom device nor a vanilla ESP32 or even a pyboard-D yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just reviewed your pull request and left some comments around the places in question. While my commit 7330d65 came in too late to be considered by you (sorry!), it might help you along the path of getting some DS18B20 sensors working within your setup.
Thanks again for your work on that, we very much appreciate it.
if self.platform_info.vendor == self.platform_info.MICROPYTHON.Pycom: | ||
frequency = machine.freq() / 1000000 | ||
else: | ||
frequency = machine.freq()[0] / 1000000 | ||
frequency = machine.freq() / 1000000 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Is it actually just the same thing on both platforms?
Maybe it will be different on the pyboard-D. We will see that when I will try to ramp up the code again on this platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, surprised me, too. Maybe I had one weird firmware version.
if platform_info.vendor == platform_info.MICROPYTHON.Vanilla: | ||
import ds18x20 | ||
#self.driver = ds18x20.DS18X20(self.ow) | ||
# TBD there is some difference between uPy & Pycom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the adaptation code from 7330d65 will already help here?
self.pSCK = Pin(pd_sck, mode=Pin.OUT) | ||
self.pOUT = Pin(dout, mode=Pin.IN, pull=Pin.PULL_UP) | ||
if platform_info.vendor == platform_info.MICROPYTHON.Vanilla: | ||
self.pSCK = Pin(int(pd_sck[1:]), mode=Pin.OUT) | ||
self.pOUT = Pin(int(dout[1:]), mode=Pin.IN, pull=Pin.PULL_UP) | ||
elif platform_info.vendor == platform_info.MICROPYTHON.Pycom: | ||
self.pSCK = Pin(pd_sck, mode=Pin.OUT) | ||
self.pOUT = Pin(dout, mode=Pin.IN, pull=Pin.PULL_UP) | ||
else: | ||
raise NotImplementedError('HX711 is ' | ||
'not implemented on this platform') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
self.pSCK.hold(False) | ||
if platform_info.vendor == platform_info.MICROPYTHON.Pycom: | ||
self.pSCK.hold(False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
self.adapter = OneWire(Pin(self.pins['data'])) | ||
if platform_info.vendor == platform_info.MICROPYTHON.Vanilla: | ||
self.adapter = OneWire(Pin(int(self.pins['data'][1:]))) | ||
elif platform_info.vendor == platform_info.MICROPYTHON.Pycom: | ||
self.adapter = OneWire(Pin(self.pins['data'])) | ||
else: | ||
raise NotImplementedError('I2C Bus is ' | ||
'not implemented on this platform') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes from 7330d65 might already account for that and even will handle the collision between both drivers. Remember to invoke make setup
again to get both drivers into dist-packages
as onewire_native.py
vs. onewire_python.py
.
self.adapter = I2C(self.number, mode=I2C.MASTER, pins=(self.pins['sda'], self.pins['scl']), baudrate=100000) | ||
if platform_info.vendor == platform_info.MICROPYTHON.Vanilla: | ||
self.adapter = I2C(self.number, sda = Pin(int(self.pins['sda'][1:])), scl = Pin(int(self.pins['scl'][1:])), freq=100000) | ||
elif platform_info.vendor == platform_info.MICROPYTHON.Pycom: | ||
self.adapter = I2C(self.number, mode=I2C.MASTER, pins=(self.pins['sda'], self.pins['scl']), baudrate=100000) | ||
else: | ||
raise NotImplementedError('I2C Bus is ' | ||
'not implemented on this platform') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, that looks good!
closing this as I accidentally worked in the wrong branch |
The DS18X20 needs some further care.
HX711 works and telemetry is being sent (although I can't find it currently).