From 81a7b265047350d6b5f6c4960ac73f0ca02131ce Mon Sep 17 00:00:00 2001 From: Alastair D'Silva Date: Tue, 29 Oct 2019 11:00:12 +1100 Subject: [PATCH] Reopen serial port if all slaves drop Signed-off-by: Alastair D'Silva --- TWCManager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TWCManager.py b/TWCManager.py index feaa0a90..6e22d064 100644 --- a/TWCManager.py +++ b/TWCManager.py @@ -119,6 +119,7 @@ import json from datetime import datetime import threading +from serial.threaded import ser ########################## @@ -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.