|
@@ -24,6 +24,7 @@ def read_diskstats():
|
|
|
prev_stats = read_diskstats()
|
|
prev_stats = read_diskstats()
|
|
|
current_stats = read_diskstats()
|
|
current_stats = read_diskstats()
|
|
|
print(current_stats)
|
|
print(current_stats)
|
|
|
|
|
+prev_data = bytearray()
|
|
|
|
|
|
|
|
while True:
|
|
while True:
|
|
|
current_stats = read_diskstats()
|
|
current_stats = read_diskstats()
|
|
@@ -45,6 +46,8 @@ while True:
|
|
|
# print(counter+3)
|
|
# print(counter+3)
|
|
|
byte_array.append(counter+3)
|
|
byte_array.append(counter+3)
|
|
|
counter += 4
|
|
counter += 4
|
|
|
- serial_port.write(byte_array)
|
|
|
|
|
|
|
+ if byte_array != prev_data:
|
|
|
|
|
+ serial_port.write(byte_array)
|
|
|
|
|
+ prev_data = byte_array
|
|
|
time.sleep(0.1) # Adjust the frequency of checking disk activity (1 second in this example)
|
|
time.sleep(0.1) # Adjust the frequency of checking disk activity (1 second in this example)
|
|
|
prev_stats = current_stats
|
|
prev_stats = current_stats
|