fix(envea): remove double read that consumed sensor response
The CAIRSENS sensor sends response in a single block, not two parts. The initial read was consuming all 25 bytes leaving nothing for the actual data read. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,12 +118,6 @@ try:
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
# Read fixed number of bytes (not readline which stops at 0x0A)
|
# Read fixed number of bytes (not readline which stops at 0x0A)
|
||||||
# First read to consume any echo/acknowledgment
|
|
||||||
initial_data = serial_connection.read(serial_connection.in_waiting or 1)
|
|
||||||
debug_print(f" ← Initial read: {len(initial_data)} bytes")
|
|
||||||
|
|
||||||
# Small delay then read the actual response
|
|
||||||
time.sleep(0.1)
|
|
||||||
data_envea = serial_connection.read(32) # Read fixed 32 bytes
|
data_envea = serial_connection.read(32) # Read fixed 32 bytes
|
||||||
debug_print(f" ← Received {len(data_envea)} bytes: {data_envea.hex() if data_envea else 'empty'}")
|
debug_print(f" ← Received {len(data_envea)} bytes: {data_envea.hex() if data_envea else 'empty'}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user