Commit 7d89645a authored by Ivan Tyagov's avatar Ivan Tyagov

Update only if it makes sense.

parent f23927cb
...@@ -161,6 +161,7 @@ async def main(): ...@@ -161,6 +161,7 @@ async def main():
print("\tDetected area (px)=%.2f, result=%d, shape changes=%d" %(area, result, shape_change_counter)) print("\tDetected area (px)=%.2f, result=%d, shape changes=%d" %(area, result, shape_change_counter))
# update list for last X results (FILO) # update list for last X results (FILO)
if current_shape != result:
result_stack.append(result) result_stack.append(result)
current_shape = result current_shape = result
shape_change_counter += 1 shape_change_counter += 1
...@@ -173,6 +174,7 @@ async def main(): ...@@ -173,6 +174,7 @@ async def main():
if not contour_detected: if not contour_detected:
# no countours actually detected thus update OPC UA server's node attribute # no countours actually detected thus update OPC UA server's node attribute
result = 0.0 result = 0.0
if current_shape != result:
result_stack.append(result) result_stack.append(result)
shape_change_counter += 1 shape_change_counter += 1
await myvar.write_value(result) await myvar.write_value(result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment