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

Raising timeouts for operation over LAN. #181

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
10 changes: 5 additions & 5 deletions cc2538-bsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def open(self, aport=None, abaudrate=DEFAULT_BAUD):
# this stage: We need to set its attributes up depending on what object
# we get.
try:
self.sp = serial.serial_for_url(aport, do_not_open=True, timeout=10, write_timeout=10)
self.sp = serial.serial_for_url(aport, do_not_open=True, timeout=20, write_timeout=20)
except AttributeError:
self.sp = serial.Serial(port=None, timeout=10, write_timeout=10)
self.sp = serial.Serial(port=None, timeout=20, write_timeout=20)
self.sp.port = aport

if ((os.name == 'nt' and isinstance(self.sp, serial.serialwin32.Serial)) or \
Expand All @@ -206,7 +206,7 @@ def open(self, aport=None, abaudrate=DEFAULT_BAUD):
self.sp.stopbits=1 # stop bits
self.sp.xonxoff=0 # s/w (XON/XOFF) flow control
self.sp.rtscts=0 # h/w (RTS/CTS) flow control
self.sp.timeout=0.5 # set the timeout value
self.sp.timeout=1.0 # set the timeout value

self.sp.open()

Expand Down Expand Up @@ -266,7 +266,7 @@ def invoke_bootloader(self, dtr_active_high=False, inverted=False, sonoff_usb=Fa
def close(self):
self.sp.close()

def _wait_for_ack(self, info="", timeout=1):
def _wait_for_ack(self, info="", timeout=4):
stop = time.time() + timeout
got = bytearray(2)
while got[-2] != 00 or got[-1] not in (CommandInterface.ACK_BYTE,
Expand Down Expand Up @@ -380,7 +380,7 @@ def sendSynch(self):
mdebug(10, "*** sending synch sequence")
self._write(cmd) # send U
self._write(cmd) # send U
return self._wait_for_ack("Synch (0x55 0x55)", 2)
return self._wait_for_ack("Synch (0x55 0x55)", 8)

def checkLastCmd(self):
stat = self.cmdGetStatus()
Expand Down