Skip to content

Commit 2724bd4

Browse files
Ivoahpfalcon
authored andcommitted
esp8266/scripts/webrepl: Add optional password argument to webrepl.start()
This commit fixes issue adafruit#2045
1 parent cea1c62 commit 2724bd4

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

esp8266/scripts/webrepl.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,19 @@ def stop():
4949
listen_s.close()
5050

5151

52-
def start(port=8266):
52+
def start(port=8266, password=None):
5353
stop()
54-
try:
55-
import port_config
56-
_webrepl.password(port_config.WEBREPL_PASS)
54+
if password is None:
55+
try:
56+
import port_config
57+
_webrepl.password(port_config.WEBREPL_PASS)
58+
setup_conn(port, accept_conn)
59+
print("Started webrepl in normal mode")
60+
except:
61+
import webrepl_setup
62+
setup_conn(port, webrepl_setup.handle_conn)
63+
print("Started webrepl in setup mode")
64+
else:
65+
_webrepl.password(password)
5766
setup_conn(port, accept_conn)
5867
print("Started webrepl in normal mode")
59-
except:
60-
import webrepl_setup
61-
setup_conn(port, webrepl_setup.handle_conn)
62-
print("Started webrepl in setup mode")

0 commit comments

Comments
 (0)