Skip to content

Commit

Permalink
Reopen serial port if all slaves drop
Browse files Browse the repository at this point in the history
Signed-off-by: Alastair D'Silva <[email protected]>
  • Loading branch information
deece committed Nov 2, 2019
1 parent 2be59b8 commit 81a7b26
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TWCManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
import json
from datetime import datetime
import threading
from serial.threaded import ser


##########################
Expand Down Expand Up @@ -2566,6 +2567,8 @@ def set_last_amps_offered(self, desiredAmpsOffered):
# If we have no slaves, try to re-establish the connection
if (numInitMsgsToSend == 0 and slave_count() == 0):
numInitMsgsToSend = 10
ser.close()
ser.open()

# A real master sends 5 copies of linkready1 and linkready2 whenever
# it starts up, which we do here.
Expand Down

0 comments on commit 81a7b26

Please sign in to comment.