# eric7.MicroPython.EspDevices

Module implementing the device interface class for ESP32 and ESP8266 based boards.

### Global Attributes

None

### Classes

EspDevice | Class implementing the device for ESP32 and ESP8266 based boards.

### Functions

createDevice | Function to instantiate a MicroPython device object.

## EspDevice

Class implementing the device for ESP32 and ESP8266 based boards.

### Derived from

MicroPythonDevice

### Class Attributes

None

### Class Methods

None

### Methods

EspDevice | Constructor
__backupFlash | Private slot to backup the currently flashed firmware.
__eraseFlash | Private slot to erase the device flash memory.
__flashAddons | Private slot to flash some additional firmware images.
__flashMicroPython | Private slot to flash a MicroPython firmware to the device.
__installEspTool | Private slot to install the esptool package via pip.
__resetDevice | Private slot to reset the connected device.
__restoreFlash | Private slot to restore a previously saved firmware.
__showChipID | Private slot to show the ID of the ESP chip.
__showFlashID | Private slot to show the ID of the ESP flash chip.
__showMACAddress | Private slot to show the MAC address of the ESP chip.
addDeviceMenuEntries | Public method to add device specific entries to the given menu.
canRunScript | Public method to determine, if a script can be executed.
canStartFileManager | Public method to determine, if a File Manager can be started.
canStartPlotter | Public method to determine, if a Plotter can be started.
canStartRepl | Public method to determine, if a REPL can be started.
deviceName | Public method to get the name of the device.
forceInterrupt | Public method to determine the need for an interrupt when opening the serial connection.
getDocumentationUrl | Public method to get the device documentation URL.
getFirmwareUrl | Public method to get the device firmware download URL.
hasFlashMenuEntry | Public method to check, if the device has its own flash menu entry.
runScript | Public method to run the given Python script.
setButtons | Public method to enable the supported action buttons.

### Static Methods

None

#### EspDevice (Constructor)

EspDevice(microPythonWidget, deviceType, parent=None)

Constructor

microPythonWidget (MicroPythonWidget)
  reference to the main MicroPython widget
deviceType (str)
  device type assigned to this device interface
parent (QObject)
  reference to the parent object

#### EspDevice.__backupFlash

__backupFlash()

Private slot to backup the currently flashed firmware.

#### EspDevice.__eraseFlash

__eraseFlash()

Private slot to erase the device flash memory.

#### EspDevice.__flashAddons

__flashAddons()

Private slot to flash some additional firmware images.

#### EspDevice.__flashMicroPython

__flashMicroPython()

Private slot to flash a MicroPython firmware to the device.

#### EspDevice.__installEspTool

__installEspTool()

Private slot to install the esptool package via pip.

#### EspDevice.__resetDevice

__resetDevice()

Private slot to reset the connected device.

#### EspDevice.__restoreFlash

__restoreFlash()

Private slot to restore a previously saved firmware.

#### EspDevice.__showChipID

__showChipID()

Private slot to show the ID of the ESP chip.

#### EspDevice.__showFlashID

__showFlashID()

Private slot to show the ID of the ESP flash chip.

#### EspDevice.__showMACAddress

__showMACAddress()

Private slot to show the MAC address of the ESP chip.

#### EspDevice.addDeviceMenuEntries

addDeviceMenuEntries(menu)

Public method to add device specific entries to the given menu.

menu (QMenu)
  reference to the context menu

#### EspDevice.canRunScript

canRunScript()

Public method to determine, if a script can be executed.

Return:
  tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### EspDevice.canStartFileManager

canStartFileManager()

Public method to determine, if a File Manager can be started.

Return:
  tuple containing a flag indicating it is safe to start a File Manager and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### EspDevice.canStartPlotter

canStartPlotter()

Public method to determine, if a Plotter can be started.

Return:
  tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### EspDevice.canStartRepl

canStartRepl()

Public method to determine, if a REPL can be started.

Return:
  tuple containing a flag indicating it is safe to start a REPL and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### EspDevice.deviceName

deviceName()

Public method to get the name of the device.

Return:
  name of the device

Return Type:
  str

#### EspDevice.forceInterrupt

forceInterrupt()

Public method to determine the need for an interrupt when opening the serial connection.

Return:
  flag indicating an interrupt is needed

Return Type:
  bool

#### EspDevice.getDocumentationUrl

getDocumentationUrl()

Public method to get the device documentation URL.

Return:
  documentation URL of the device

Return Type:
  str

#### EspDevice.getFirmwareUrl

getFirmwareUrl()

Public method to get the device firmware download URL.

Return:
  firmware download URL of the device

Return Type:
  str

#### EspDevice.hasFlashMenuEntry

hasFlashMenuEntry()

Public method to check, if the device has its own flash menu entry.

Return:
  flag indicating a specific flash menu entry

Return Type:
  bool

#### EspDevice.runScript

runScript(script)

Public method to run the given Python script.

script (str)
  script to be executed

#### EspDevice.setButtons

setButtons()

Public method to enable the supported action buttons.

Up

## createDevice

createDevice(microPythonWidget, deviceType, vid, pid)

Function to instantiate a MicroPython device object.

microPythonWidget (MicroPythonWidget)
  reference to the main MicroPython widget
deviceType (str)
  device type assigned to this device interface
vid (int)
  vendor ID
pid (int)
  product ID

Return:
  reference to the instantiated device object

Return Type:
  EspDevice

Up