-
Notifications
You must be signed in to change notification settings - Fork 3.1k
ESP8266 ESP32 Compatibility
Rene K. Mueller edited this page Feb 19, 2018
·
18 revisions
This document reflects conflicts between NodeMCU/ESP8266 and NodeMCU/ESP32 and requirements to achieve larger degree of compatibility:
The object mode of file operations isn't implemented yet (file.read() vs src = file.open() src:read()) according dev-esp32 documentation.
ESP8266:
-
file.obj:close()Closes the open file, if any. -
file.obj:flush()Flushes any pending writes to the file system, ensuring no data is lost on a restart. -
file.obj:read()Read content from the open file. -
file.obj:readline()Read the next line from the open file. -
file.obj:seek()Sets and gets the file position, measured from the beginning of the file, to the position given by offset plus a base specified by the string whence. -
file.obj:write()Write a string to the open file. -
file.obj:writeline()Write a string to the open file and append '\n' at the end.
ESP32:
- all above listed are missing according documentation
ESP8266:
-
gpio.mode(pin,type,pullup)-
type:gpio.INPUTgpio.OUTPUTgpio.OPENDRAINgpio.INT
-
pullup:-
gpio.FLOAT(default) -
gpio.PULLUPenables the weak pull-up resistor
-
-
-
gpio.trig(pin,type,callback(level,when))-
type:"up", "down", "both", "low", "high"
-
ESP32:
-
gpio.config({gpio=..,dir=..,pull=..,opendrain=..})-
dir:gpio.INgpio.OUTgpio.IN_OUT
-
pull:-
gpio.FLOATINGdisables both pull-up and -down -
gpio.PULL_UPenables pull-up and disables pull-down -
gpio.PULL_DOWNenables pull-down and disables pull-up -
gpio.PULL_UP_DOWNenables both pull-up and -down
-
-
-
gpio.trig(pin,types,callback(pin,level))-
type:-
gpio.INTR_UPfor trigger on rising edge -
gpio.INTR_DOWNfor trigger on falling edge -
gpio.INTR_UP_DOWNfor trigger on both edges -
gpio.INTR_LOWfor trigger on low level -
gpio.INTR_HIGHfor trigger on high level
-
-
ESP8266:
-
node.info()return 8 elements:- majorVer (number)
- minorVer (number)
- devVer (number)
- chipid (number)
- flashid (number)
- flashsize (number)
- flashmode (number)
- flashspeed (number)
-
node.chipid()returns an integer (last 3 bytes of the station MAC address)
ESP32:
-
node.info()missing -
node.chipid()returns string with '0x' as prefix and 7 bytes whereas the last byte of the MAC address is dropped (risk of 256 identical chipids)
ESP8266:
-
tmr.now()returns microseconds -
tmr.time()time in seconds since boot (uptime)
ESP32:
-
tmr.now()missing -
tmr.time()missing
ESP8266 and ESP32 differ a lot:
ESP8266
- events are captured via
wifi.eventmon.*:-
wifi.eventmon.register(event[, function(T)])wifi.eventmon.STA_CONNECTEDwifi.eventmon.STA_DISCONNECTEDwifi.eventmon.STA_AUTHMODE_CHANGEwifi.eventmon.STA_GOT_IPwifi.eventmon.STA_DHCP_TIMEOUTwifi.eventmon.AP_STACONNECTEDwifi.eventmon.AP_STADISCONNECTEDwifi.eventmon.AP_PROBEREQRECVED
-
ESP32:
- events are captured via
wifi.on()-
wifi.ap.on(event, callback)-
event:-
start: no additional info -
stop: no additional info -
sta_connected: information about the client that connected: -
mac: the MAC address -
id: assigned station id (AID) -
disconnected: information about disconnecting client -
mac: the MAC address -
probe_req: information about the probing client -
from: MAC address of the probing client -
rssi: Received Signal Strength Indicator value
-
-
-