Skip to content
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

Closed
wants to merge 1 commit into from
Closed

fixes for the ESP32 port #29

wants to merge 1 commit into from

Conversation

poesel
Copy link
Collaborator

@poesel poesel commented Nov 9, 2019

The DS18X20 needs some further care.
HX711 works and telemetry is being sent (although I can't find it currently).

@amotl
Copy link
Member

amotl commented Nov 9, 2019

Thanks!

This came in at almost the same time as 7330d65. Unfortunately, I have not been quicker to push these improvements.

The DS18X20 needs some further care.

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.

Copy link
Member

@amotl amotl left a 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.

Comment on lines -246 to +247
if self.platform_info.vendor == self.platform_info.MICROPYTHON.Pycom:
frequency = machine.freq() / 1000000
else:
frequency = machine.freq()[0] / 1000000
frequency = machine.freq() / 1000000

Copy link
Member

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.

Copy link
Collaborator Author

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
Copy link
Member

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?

Comment on lines -23 to +34
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')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines -205 to +216
self.pSCK.hold(False)
if platform_info.vendor == platform_info.MICROPYTHON.Pycom:
self.pSCK.hold(False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

Comment on lines -278 to +286
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')
Copy link
Member

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.

Comment on lines -331 to +345
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')
Copy link
Member

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!

@poesel
Copy link
Collaborator Author

poesel commented Nov 10, 2019

closing this as I accidentally worked in the wrong branch

@poesel poesel closed this Nov 10, 2019
@poesel poesel deleted the esp32_1 branch December 24, 2019 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants