FEEprojects / plantower

Interface for the plantower PM sensors
MIT License
14 stars 5 forks source link

Buffer not flushed correctly. #1

Closed LuckyResistor closed 5 years ago

LuckyResistor commented 5 years ago

The library uses the following code to flush the buffer before a new read is started:

self.serial.flush() #Flush any data in the buffer

IMO the correct code should be:

self.serial.reset_input_buffer()

The function flush() just makes sure everything gets written. I assume the author of the code would make sure a current reading is made and no past readings from the buffer are used.

pjb304 commented 5 years ago

Hi LuckyResistor,

Many thanks for raising this issue, you are indeed correct. Your fix and a new release will be published shortly.