pythoncoder wrote: ↑Sat Jun 16, 2018 6:52 am
provides a list of compiled-in modules. This list does not include modules you might have put in the device's filesystem.
Interesting, I compared my ESP01s
Code: Select all
MicroPython v1.9.4-272-g46091b8a on 2018-07-18; ESP module with ESP8266
and ESP32
Code: Select all
MicroPython v1.9.4-623-g34af10d2e on 2018-10-03; ESP32 module with ESP32
Micropython modules (by "$ cat | for w in `cat`; do echo $w; done | sort > esp__.txt" and copy&paste).
There are 3 modules that only exist on ESP8266, and 10 modules that only exists on ESP32:
Code: Select all
$ diff --side-by-side -W 35 esp8266.txt esp32.txt
apa102 | apa106
array array
binascii binascii
_boot _boot
btree btree
builtins builtins
> cmath
collections collections
dht dht
ds18x20 ds18x20
errno errno
esp esp
> esp32
flashbdev flashbdev
framebuf framebuf
gc gc
hashlib hashlib
> heapq
inisetup inisetup
io io
json json
lwip <
machine machine
__main__ __main__
math math
micropython micropython
neopixel neopixel
network network
ntptime ntptime
onewire onewire
_onewire _onewire
os os
port_diag <
random random
re re
select select
socket socket
ssl ssl
struct struct
sys sys
> _thread
time time
ubinascii ubinascii
ucollections ucollections
ucryptolib ucryptolib
uctypes uctypes
uerrno uerrno
uhashlib uhashlib
> uhashlib
uheapq uheapq
uio uio
ujson ujson
> umqtt/robust
> umqtt/simple
uos uos
upip upip
upip_utarfile upip_utarfile
> upysh
urandom urandom
ure ure
> urequests
uselect uselect
usocket usocket
ussl ussl
ustruct ustruct
utime utime
utimeq utimeq
uzlib uzlib
webrepl webrepl
_webrepl _webrepl
webrepl_setup webrepl_setup
websocket websocket
websocket_hel websocket_hel
zlib zlib
$
I went a step further and wanted to compare the common module features between both MicroPythons:
Code: Select all
$ comm -12 esp8266.txt esp32.txt > common.mod
$
With webrepl_client.py "-r" option and input redirect this was easy to do (I did reconnect to esp8266 Wlan after the first command was executed while connected to ESP32 Wlan):
Code: Select all
$ webrepl_client.py -p abcd -r 192.168.4.1 < <(sleep 1 && for m in `cat common.mod`; do echo -e "help(\"$m\")"; done; echo "exit") > esp32.detail
$ webrepl_client.py -p abcd -r 192.168.4.1 < <(sleep 1 && for m in `cat common.mod`; do echo -e "help(\"$m\")"; done; echo "exit") > esp8266.detail
$
First I converted to Unix format. The diffs.txt file is attached:
Code: Select all
$ dos2unix esp32.detail esp8266.detail
dos2unix: converting file esp32.detail to Unix format ...
dos2unix: converting file esp8266.detail to Unix format ...
$
$ diff --side-by-side -W 60 esp8266.detail esp32.detail > diffs.txt
There is no feature that does exist on esp8266 Micorpython only, but there are 248 in the 62 common modules that exist on esp32 only:
Code: Select all
$ diff --side-by-side esp8266.detail esp32.detail | grep " <"
$ diff --side-by-side esp8266.detail esp32.detail | grep " >" | wc --lines
248
$
But there are only 4 different features:
Code: Select all
$ grep " >" diffs.txt | sort -u
> center -- <function>
> partition -- <function>
> rpartition -- <function>
> splitlines -- <function>
$
P.S:
Ooops -- I will redo the evaluation, eg. for module utime I did
which is wrong, instead this is needed: