|
@@ -57,6 +57,12 @@ if TX_interface_prefer is None: # compatibility with old ini file structure
|
|
|
|
|
|
repeat_received_commands = False
|
|
|
|
|
|
+dataReceiveTimeout = config['main'].getint('dataReceiveTimeout')
|
|
|
+
|
|
|
+lastReceivedStatusFile = config['main'].get('lastReceivedStatusFile')
|
|
|
+lastReceivedStatusFileUpdateTime = 0
|
|
|
+
|
|
|
+
|
|
|
if len(sys.argv) >= 2:
|
|
|
if sys.argv[1] == "-q":
|
|
|
verbose = False
|
|
@@ -580,11 +586,28 @@ def encodeInterTechnoRX(itname, cmd):
|
|
|
if debug: log_write(" unknown or invalid IT code '" + rx_code + "'")
|
|
|
|
|
|
def cul_received(payload, source_cul):
|
|
|
- global lastReceivedTime, lastReceivedMaxAge, lastDataReceiveTime
|
|
|
+ global lastReceivedTime, lastReceivedMaxAge, lastDataReceiveTime, lastReceivedStatusFile, lastReceivedStatusFileUpdateTime
|
|
|
|
|
|
lastDataReceiveTime = time.time()
|
|
|
if debug:
|
|
|
- print("lastDataReceiveTime=" + str(lastDataReceiveTime))
|
|
|
+ print("DEBUG: lastDataReceiveTime=" + str(lastDataReceiveTime))
|
|
|
+
|
|
|
+
|
|
|
+ if lastReceivedStatusFile is not None:
|
|
|
+ if (time.time() - lastReceivedStatusFileUpdateTime) >= 60:
|
|
|
+
|
|
|
+ lastReceivedStatusFileUpdateTime = time.time()
|
|
|
+ try:
|
|
|
+ touch(lastReceivedStatusFile)
|
|
|
+ if debug:
|
|
|
+ print("DEBUG: lastReceivedStatusFile updated")
|
|
|
+ except:
|
|
|
+ if debug:
|
|
|
+ print("ERROR: could not update lastReceivedStatusFile")
|
|
|
+ else:
|
|
|
+ if debug:
|
|
|
+ print("DEBUG: lastReceivedStatusFile not defined")
|
|
|
+
|
|
|
|
|
|
if payload[:2] == 'is':
|
|
|
pass
|
|
@@ -882,12 +905,12 @@ try:
|
|
|
|
|
|
|
|
|
|
|
|
- if config['main'].get('dataReceiveTimeout') is not None:
|
|
|
- if (time.time() - lastDataReceiveTime) >= float(config['main'].get('dataReceiveTimeout')):
|
|
|
- print("WARNING: received no data from CUL for >" + str(config['main'].get('dataReceiveTimeout')) + "s -> something has gone wrong -> quitting program.")
|
|
|
+ if dataReceiveTimeout is not None:
|
|
|
+ if (time.time() - lastDataReceiveTime) >= dataReceiveTimeout:
|
|
|
+ print("WARNING: received no data from CUL for >" + str(dataReceiveTimeout) + "s -> something has gone wrong -> quitting program.")
|
|
|
quit()
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
sleep(0.05)
|