- Replace readline() with read(32) to avoid truncation at 0x0A bytes - Add reset_input_buffer() to clear stale data before each read - Add initial read to consume echo/acknowledgment from sensor - Add frame header validation (0xFF 0x02) to reject invalid data - Add delays to allow sensor response time Fixes issue where NO2/H2S sensors showed random spikes due to binary data containing newline characters being misinterpreted. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7.7 KiB
Executable File
7.7 KiB
Executable File