SuperHouse / AirQualitySensorD1Mini

Particulate Matter Sensor firmware for a Plantower PMS5003 connected to a Wemos D1 Mini
32 stars 10 forks source link

Reset Read Data Flags #2

Open Hobohome opened 4 years ago

Hobohome commented 4 years ago

The two data flags _g_pms_ae_readingstaken AND _g_pms_ppd_readingstaken are never reset to false. Thus after the first reading, these are always true, even if the data read failed. Is this intended?

jonoxer commented 4 years ago

This was intentional, because the purpose of those flags was to determine if any reading had been received from the sensor since startup, and clear the holding screen after the first data has been received. The screen should always display the last received data, so that if the sensor gives one bad reading the display will continue showing the most recently received good data.

This behaviour is up for debate, of course. It may be preferable to blank the values if a bad reading is taken from the sensor, instead of showing the last known good values. Or perhaps there needs to be an indication on the screen that the displayed values are stale.

Perhaps the flags need to have better names, to show that they indicate whether any data has been received at any point.