WaiveCar / WaiveScreen

WaiveScreen related stuff.
0 stars 0 forks source link

Arduino resets when SensorDaemon shuts down #264

Closed nthobe closed 4 years ago

nthobe commented 4 years ago

When the SensorDaemon is restarted, the arduino resets causing the screen's backlight to go off for a second or so.

jlandau10 commented 4 years ago
    try:
      _arduino = serial.Serial(com_port, 115200, timeout=0.1)
      _arduino.dtr = False  #New line to add, /ScreenDaemon/lib/arduino.py:88
nthobe commented 4 years ago

setting _arduino.dtr to False will stop the arduino from resetting when SensorDaemon shuts down. However, when it starts back up, it still resets. This ended up being a "Linux thing" with how it handles tty ports by default. When opening the port, a DTR command is sent by default. After opening the port for the first time, we can disable the interface's HUPCL flag with termios to prevent further resets.

nthobe commented 4 years ago

Further investigation revealed the initial reset would be fixable with changes to the kernel's usb-serial driver. However we are going to leave this as is because we don't need to be maintaining kernel patches and the initial reset on boot isn't that big of a deal.

Partial fix implemented and merged into master.