Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ncp.py #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions ncp.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
SONOFF_XON_XOFF = True
SONOFF_RTS_CTS = False

# BV BV2010
BV2010_VID = '10C4'
BV2010_PID = '8B34'
BV2010_BAUD = 57600
BV2010_XON_XOFF = True
BV2010_RTS_CTS = False

def is_valid_file(parser, arg):
if not os.path.isfile(arg):
parser.error("The file %s does not exist!" % arg)
Expand Down Expand Up @@ -279,6 +286,13 @@ def putc(data, timeout=1):
XON_XOFF = WSTK_XON_XOFF
RTS_CTS = WSTK_RTS_CTS
break
# Check BV2010 stick
if vid == BV2010_VID and pid == BV2010_PID:
print('BV2010 stick')
BAUD = BV2010_BAUD
XON_XOFF = BV2010_XON_XOFF
RTS_CTS = BV2010_RTS_CTS
break

# Init serial port
ser = serial.Serial(
Expand Down Expand Up @@ -391,7 +405,7 @@ def scan():
portjson['pid'] = pid

# Check which USB NCP device
if vid == CEL_VID and pid == CEL_PID or vid == WSTK_VID and pid == WSTK_PID or vid == ETRX_VID and pid == ETRX_PID or vid == SONOFF_VID and pid == SONOFF_PID:
if vid == CEL_VID and pid == CEL_PID or vid == WSTK_VID and pid == WSTK_PID or vid == ETRX_VID and pid == ETRX_PID or vid == SONOFF_VID and pid == SONOFF_PID or vid == BV2010_VID and pid == BV2010_PID:
# Use EM3588 USB stick as default
BAUD = CEL_BAUD
XON_XOFF = CEL_XON_XOFF
Expand All @@ -406,7 +420,11 @@ def scan():
BAUD = SONOFF_BAUD
XON_XOFF = SONOFF_XON_XOFF
RTS_CTS = SONOFF_RTS_CTS

# Check if BV2010 board
if vid == BV2010_VID and pid == BV2010_PID:
BAUD = BV2010_BAUD
XON_XOFF = BV2010_XON_XOFF
RTS_CTS = BV2010_RTS_CTS
sys.stderr.write('Connecting to.. %s %s %s %s \n' % (port[0], BAUD, XON_XOFF, RTS_CTS))

# Init serial port
Expand Down