Skip to content

Commit 15839ef

Browse files
committed
deneyap kart reseting upon serial startup
setting DTR and RTS pins to low solved the issue
1 parent 5a91909 commit 15839ef

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

SerialMonitorWebsocket.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import asyncio
22
import json
33
import traceback
4-
4+
from utils import Data
55
import serial
66
import logging
7+
import config
78

89
class aobject(object):
910
"""Inheriting this class allows you to define an async __init__.
@@ -84,13 +85,24 @@ def openSerialMontor(self, port, baudRate):
8485
logging.info(f"Opening serial monitor")
8586
if not self.serialOpen:
8687
self.serialOpen = True
87-
self.ser = serial.Serial(
88-
port=port,
89-
baudrate=baudRate,
90-
parity=serial.PARITY_NONE,
91-
stopbits=serial.STOPBITS_ONE,
92-
bytesize=serial.EIGHTBITS,
93-
timeout=0)
88+
89+
self.ser = serial.Serial()
90+
self.ser.baudrate = baudRate
91+
self.ser.port = port
92+
93+
if Data.boards[port].fqbn == config.deneyapKart:
94+
self.ser.setDTR(False)
95+
self.ser.setRTS(False)
96+
97+
self.ser.open()
98+
99+
# self.ser = serial.Serial(
100+
# port=port,
101+
# baudrate=baudRate,
102+
# parity=serial.PARITY_NONE,
103+
# stopbits=serial.STOPBITS_ONE,
104+
# bytesize=serial.EIGHTBITS,
105+
# timeout=0)
94106

95107
async def sendResponse(self):
96108
"""

0 commit comments

Comments
 (0)