fixed crash in EVSE. Added instance prefix in the logging.

This commit is contained in:
uhi22 2022-11-22 21:48:05 +01:00
parent 43d96f333e
commit 52538e759e
3 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ stateWaitForPowerDeliveryRequest = 8
class fsmEvse(): class fsmEvse():
def addToTrace(self, s): def addToTrace(self, s):
self.callbackAddToTrace(s) self.callbackAddToTrace("[EVSE] " + s)
def enterState(self, n): def enterState(self, n):
self.addToTrace("from " + str(self.state) + " entering " + str(n)) self.addToTrace("from " + str(self.state) + " entering " + str(n))
@ -184,7 +184,7 @@ class fsmEvse():
def __init__(self, callbackAddToTrace): def __init__(self, callbackAddToTrace):
self.callbackAddToTrace = callbackAddToTrace self.callbackAddToTrace = callbackAddToTrace
self.addToTrace("initializing fsmEvse") self.addToTrace("initializing fsmEvse")
self.Tcp = pyPlcTcpSocket.pyPlcTcpServerSocket() self.Tcp = pyPlcTcpSocket.pyPlcTcpServerSocket(self.callbackAddToTrace)
self.state = 0 self.state = 0
self.cyclesInState = 0 self.cyclesInState = 0
self.rxData = [] self.rxData = []

View file

@ -27,7 +27,7 @@ dinEVSEProcessingType_Ongoing = "1"
class fsmPev(): class fsmPev():
def addToTrace(self, s): def addToTrace(self, s):
self.callbackAddToTrace(s) self.callbackAddToTrace("[PEV] " + s)
def enterState(self, n): def enterState(self, n):
print("from " + str(self.state) + " entering " + str(n)) print("from " + str(self.state) + " entering " + str(n))

View file

@ -192,7 +192,7 @@ class pyPlcTcpServerSocket():
client_socket, address = self.ourSocket.accept() client_socket, address = self.ourSocket.accept()
# and we append this new socket to the list of sockets, which in the next loop will be handled by the select. # and we append this new socket to the list of sockets, which in the next loop will be handled by the select.
self.read_list.append(client_socket) self.read_list.append(client_socket)
self.addToTrace("Connection from", address) self.addToTrace("Connection from " + str(address))
else: else:
# It is not the "listener socket", it is an above created "client socket" for talking with a client. # It is not the "listener socket", it is an above created "client socket" for talking with a client.
# Let's take the data from it: # Let's take the data from it: