Skip to content

Commit

Permalink
added support for LMS_ESP32_V2
Browse files Browse the repository at this point in the history
  • Loading branch information
ste7anste7an committed Jun 23, 2024
1 parent 5e57c79 commit d2fd7f6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions MicroPython/uartremote.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class UartRemote:
command_formats={}
version="Nightly"

def __init__(self,port=0,baudrate=115200,timeout=1500,debug=False,rx_pin=18,tx_pin=19):
def __init__(self,port=0,baudrate=115200,timeout=1500,debug=False,rx_pin=None,tx_pin=None):
# Baud rates of up to 230400 work. 115200 is the default for REPL.
# Timeout is the time the lib waits in a receive_comand() after placing a call().
self.local_repl_enabled = False
Expand All @@ -124,6 +124,22 @@ def __init__(self,port=0,baudrate=115200,timeout=1500,debug=False,rx_pin=18,tx_p
# self.uart = UART(port,baudrate=baudrate,timeout=timeout,timeout_char=timeout,rxbuf=100)
elif _platform==_ESP32:
if not self.port: self.port = 1
try:
import lms_esp32
ESP32_V2 = (lms_esp32.version() == 2)
except:
import gc
ESP32_V2 = gc.mem_free() < 3000000
if rx_pin == None:
if ESP32_V2:
rx_pin=8
else:
rx_pin=18
if tx_pin == None:
if ESP32_V2:
tx_pin=7
else:
tx_pin=19
# self.enable_repl_locally()
self.uart = UART(self.port,baudrate=baudrate,rx=rx_pin,tx=tx_pin,timeout=1)
elif _platform==_ESP32_S2:
Expand Down Expand Up @@ -574,6 +590,8 @@ def get_remote_commands(self):
return cmds

def get_version(self):
version='2022021900' # version=<date>+<version>, with <date>=<YYYYMMDD> and <version>=00..99
version='2024062300' # version=<date>+<version>, with <date>=<YYYYMMDD> and <version>=00..99
if self.DEBUG:print(version)
return version


0 comments on commit d2fd7f6

Please sign in to comment.