fix heuristic

This commit is contained in:
Chrys 2019-08-22 21:29:35 +02:00
parent a76aa855a3
commit 2bd9ea2ee3

View File

@ -156,13 +156,14 @@ class driver(screenDriver):
else: else:
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
vcsa[currScreen].seek(0) vcsa[currScreen].seek(0)
screenContent = vcsa[currScreen].read() dirtyContent = vcsa[currScreen].read()
dirtyContent = b'' screenContent = dirtyContent
vcsuContent = None vcsuContent = None
timeout = time.time() timeout = time.time()
# error case
if screenContent == b'': if screenContent == b'':
continue continue
if lastScreenContent == b'': elif lastScreenContent == b'':
lastScreenContent = screenContent lastScreenContent = screenContent
if abs( int(screenContent[2]) - int(lastScreenContent[2])) in [1]: if abs( int(screenContent[2]) - int(lastScreenContent[2])) in [1]:
# Skip X Movement # Skip X Movement
@ -174,7 +175,7 @@ class driver(screenDriver):
# anything else? wait for completion # anything else? wait for completion
while True: while True:
screenContent = dirtyContent screenContent = dirtyContent
r,_,_ select.select([vcsu[currScreen]],[],[],0.07) r,_,_ = select.select([vcsu[currScreen]], [], [], 0.07)
if not vcsa[currScreen] in r: if not vcsa[currScreen] in r:
break break
vcsa[currScreen].seek(0) vcsa[currScreen].seek(0)
@ -182,6 +183,7 @@ class driver(screenDriver):
if screenContent == dirtyContent: if screenContent == dirtyContent:
break break
if time.time() - timeout >= 0.3: if time.time() - timeout >= 0.3:
screenContent = dirtyContent
break break
if useVCSU: if useVCSU:
vcsu[currScreen].seek(0) vcsu[currScreen].seek(0)
@ -193,6 +195,7 @@ class driver(screenDriver):
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
time.sleep(0.2) time.sleep(0.2)
print(e)
def createScreenEventData(self, screen, vcsaContent, vcsuContent = None): def createScreenEventData(self, screen, vcsaContent, vcsuContent = None):
eventData = { eventData = {