Page 2 of 4

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 8:22 am
by deshipu

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 9:26 am
by mattyt
Reading PR3025 was enlightening...

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 9:41 am
by devnull
I am only stating the obvious here, but doesn't this break every bit of code not included in the official 1.9 release files that does any form of digital I/O ?

Maintaining 2 sets of code, one for devices already deployed (< 1.9) and another for new ones is going to be a major headache.

SPI and Pin methods

Posted: Mon May 29, 2017 10:01 am
by pythoncoder
@deshipu I had seen those changes. I was looking for changes relating to SPI as I thought you were reporting a problem with that. But I get it now - changes to Pin have the potential to affect drivers using SPI.

Re Pin as I understand it the Pin high and low methods are deprecated, not unsupported. This is confirmed with the obvious tests below. I've tried a range of my own applications and I've yet to find one that fails under today's build.

Can anyone post actual code which runs under old builds and fails under 1.9?

Code: Select all

>>> from machine import Pin
>>> p = Pin('X1', Pin.OUT)
>>> p.low()
>>> p()
0
>>> p.high()
>>> p()
1
>>> p.low()
>>> p()
0
>>> 

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 10:22 am
by devnull
Fails for me on version 1.9 - 8266 ??

Code: Select all

>>> from machine import Pin
>>> p = Pin(5, Pin.OUT)
>>> p.low()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'low'
>>> p.on()
>>> p.off()
>>> 


Confirmed on ESP8266

Posted: Mon May 29, 2017 3:03 pm
by pythoncoder
OK, confirmed on ESP8266. So the behaviour of platforms differs. I'll raise an issue.

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 4:07 pm
by pfalcon
.high() and .low() methods were never part of the MicroPython hardware API nor were documented. So, why were you using undocumented methods and why are you now surprised they don't work?
So the behaviour of platforms differs.
No, the behavior of the platforms is consistent: there're only .on()/.off()/.value() methods, both for Pin and Signal. If .on/.off doesn't work for you, no problem, use .value(). Want something else - no problem, it's Python, so everything is easy. Subclass Pin or wrap it and add whatever you want. Of course, that will cost you memory. When you add too much stuff that you will run out of it and will have to remove useless boilerplate methods to make your app do something useful, you'll exactly understand the course of action which led MicroPython in the same direction over last 1.5 or so years, in public, very bikesheddy, if not say it worse, discussions.

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 5:15 pm
by deshipu

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 8:20 pm
by marfis
I guess he meant it was never part of the machine module (pyb still supports high/low)

To me, high/low refers to an electrical state, and that is what a pin's state is. It is somewhat confusing that on/off is now used for both signal and pins... but maybe it's just me...

Re: micropython R1.9 ETA @@ released @@

Posted: Mon May 29, 2017 10:05 pm
by deshipu
The second link talks about the machine module.