Skip to content

Commit

Permalink
Merge pull request #283 from nneul/add-delay-on-reconnect
Browse files Browse the repository at this point in the history
Add small delay on reconnect
  • Loading branch information
mathoudebine authored Jul 11, 2023
2 parents 1ee548f + 15b1320 commit 1b10e09
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/lcd/lcd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import queue
import sys
import threading
import time
from abc import ABC, abstractmethod
from enum import IntEnum
from typing import Tuple
Expand Down Expand Up @@ -124,6 +125,7 @@ def WriteLine(self, line: bytes):
logger.error(
"SerialException: Failed to send serial data to device. Closing and reopening COM port before retrying once.")
self.closeSerial()
time.sleep(1)
self.openSerial()
self.lcd_serial.write(line)

Expand All @@ -140,6 +142,7 @@ def ReadData(self, readSize: int):
logger.error(
"SerialException: Failed to read serial data from device. Closing and reopening COM port before retrying once.")
self.closeSerial()
time.sleep(1)
self.openSerial()
return self.lcd_serial.read(readSize)

Expand Down

0 comments on commit 1b10e09

Please sign in to comment.