Commit d8f5085e authored by Oleg Nikulin's avatar Oleg Nikulin

Разделение чисел на байты через int.to_bytes()

parent ed3bc523
......@@ -102,14 +102,11 @@ def poll(serial_port):
#температуры 16-битные со знаком (ну на всякий случай)
transmit_bytes = [
pc_command_codes.poll,
(temperatures[0] >> 8) & 0xff,
temperatures[0] & 0xff,
(temperatures[1] >> 8) & 0xff,
temperatures[1] & 0xff,
(temperatures[2] >> 8) & 0xff,
temperatures[2] & 0xff,
pc_command_codes.poll
]
transmit_bytes += int.to_bytes(temperatures[0], 2, 'big'),
transmit_bytes += int.to_bytes(temperatures[1], 2, 'big'),
transmit_bytes += int.to_bytes(temperatures[2], 2, 'big'),
response_length = 18
response = serial_exchange(serial_port, transmit_bytes, response_length, config['arduinoTimeoutSec'])
......
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