Omega2 Dash ADC EXP (Python) not connecting.
-
Even though the online docs provide examples based on python2, there are corresponding python3 packages available.
root@Omega-745F:~# opkg list | grep -i omega | grep -i exp
pyOmegaExpansion - 0.9-1 - Setup for OmegaExpansion Python Package (I guess this is python2)
python3-omega-expansion - 0.9-1 - Setup for OmegaExpansion Python3 Package (python3)root@Omega-745F:~# opkg list | grep -i py | grep -i relay
pyRelayExp - 0.9-1 - Python module to control the Onion Relay Expansion (this is python2)
python3-relay-exp - 0.9-1 - Python3 module to control the Onion Relay Expansion (python3)As the docs say, the programs make use of the underlying i2c C libs. Onion programmers have created the python2/3 libs for both ADC/Relay Exp that can interact with the "base" C libs. Those are the above packages.
I do not see any equivalent micropython packages in the repo. My best guess is that micropython Relay Exp is not an option, unless you create your own python packages using the C source of i2c.
https://github.com/OnionIoT/i2c-exp-driverHere the basic howto:
https://docs.micropython.org/en/latest/develop/cmodules.html#
to create a C lib that can be called from micropython.Since you already have the required h/w docks, you can give it a try.. or stay with the python3 packages that Onion repos provide.
Or request the Onion team to provide micropython packages for Relay Exp. The micropython port is not of much use unless Onion team extends the py lib support to the entire range of Docks as they have done in the case of py2 and py3.
Is the ADC Exp working fine from micropython ? I can only import; but won't be able to create objects since I do not have ADC Exp.
Thanks..
-
@tjoseph1 @LightSwitch Not sure if Onion will update this libraries since the relay expansion is discontinued:
-
Yes. The chances of supporting a "discontinued" h/w is almost nil.
If we consider py2, py3 and micropython are 3 different streams of py the libs have to be made available in all three. Many developers are using python, all 3 variants of it. May be there is a reason Onion didn't release the libs that work with micropython ?
It can still be ordered, say from mouser.com (sparkfun make)
https://www.mouser.com/ProductDetail/SparkFun/DEV-14444?qs=wd5RIQLrsJgP0vNuuZBr2Q%3D%3DA "HOWTO" to build the micropython modules would be helpful and appreciated very much. People do not have to spend hours/days knitting pieces of information scattered all over the Internet into a working procedure-set. And the sad part is, it not sure if if is ever going to work, until we see it working...
While running the time.sleep(10) py script, py3 takes 2MB straight, and micropython takes about 100kB+.
root@Omega-745F:~# free
total used free shared buffers cached
Mem: 124808 56120 68688 92 15988 18588root@Omega-745F:~# python3 sleep.py &
root@Omega-745F:~# free
total used free shared buffers cached
Mem: 124808 58172 66636 92 15988 18588root@Omega-745F:~# python3 sleep.py &
root@Omega-745F:~# free
total used free shared buffers cached
Mem: 124808 60280 64528 92 15988 18588root@Omega-745F:~# ps
1989 root 5512 S python3 sleep.py
1991 root 5512 S python3 sleep.pyroot@Omega-745F:~# free
total used free shared buffers cached
Mem: 124808 56536 68272 92 15988 18952root@Omega-745F:~# micropython sleep.py &
root@Omega-745F:~# free
total used free shared buffers cached
Mem: 124808 56660 68148 92 15988 18952root@Omega-745F:~# ps
1995 root 2600 S micropython sleep.pyThanks..
-
@tjoseph1 Why not just call the c library functions directly.
-
Why not just call the c library functions directly.
From python3/micropython, how to do that ?
Thanks..
-
@tjoseph1 There are some docs/discussions for calling musl libc using micropython, just google it. Another approach would be to write a micropython specific c function that calls libc functionality.
Just another reason to dislike python
-
Thanks ..
The solutions I found were using ffilib, ctypes or mpy.
mpy is not implemented in 1.9.2 ?
>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 9, 2))but could find it 1.13.0, the latest.
>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 13, 0), mpy=9733)Don't you think, those are much of an overhead for py programmer ?
The approaches are different.
py programmer: how do I get this done?
c programmer: how do I get the system to do this?Just another reason to dislike python people who do not tell other py programmers-that python is NOT for everything
-
@tjoseph1 yes a 4GL in fancy clothing
-
@crispyoz :
May be they (the py lib people - they must be hardcore c programmers as well) are constrained, and are going by the 80/20 rule.. 80% of the time, the implemented 20% feature works..Agian, on a non-constrained platform python works well.. to make all happy.
-
@tjoseph1 You don't want to start me on this
-
@crispyoz :
I am here to listen.. and I am sure that it will broaden my outlook..
As an eg., you got me search that gave me 3 options today..I genaralize, based on what I know..
So, please..go ahead