airgradienthq / arduino

Firmware of open-source hardware air quality monitors AirGradient ONE (indoor) and AirGradient Open Air (outdoor).
https://www.airgradient.com/documentation/
Other
220 stars 114 forks source link

Restructure Measurements class #256

Closed samuelbles07 closed 1 month ago

samuelbles07 commented 1 month ago

Changes

Main changes is restructuring Measurement class on AgValue files. Each measurements has average value that are always calculated based on max period length (calculateMaxPeriod()) set for moving average calculation.

Other includes

  1. Every measurements data from each sensor have an average value which are sent to AirGradient server, MQTT and Local Server fetch. On oled display and led bar indication still using last reading value.
  2. Relative humidity now is in float 2 decimals precision (except showing on oled display)
  3. Remove ESP restart when PM sensor read failed on X times
  4. Interval for SHT sensor reading now set to 6s
  5. Optional debug every reading interval to serial monitor. Sensor debug to serial monitor is the moving average value
  6. PMSBase::compensate using float data type for arguments and return (previously int).
    • Directly return 0 when PM value is 0
  7. Send indication when consecutively update invalid value