Skip to content

Commit

Permalink
Merge pull request #5 from oleksiikutuzov/dev
Browse files Browse the repository at this point in the history
Apply some filtering to Air Quality Sensor data
  • Loading branch information
oleksiikutuzov authored Jun 9, 2022
2 parents ab467b6 + 842b4f5 commit 93a1d9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion air_quality/DEV_Sensors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ int tick = 0;
bool airQualityAct = false;
particleSensorState_t state;
Smoothed<float> mySensor;
Smoothed<float> mySensor_air;

// Declare functions
void detect_mhz();
Expand Down Expand Up @@ -191,6 +192,8 @@ struct DEV_AirQualitySensor : Service::AirQualitySensor { // A standalone Air Qu

SerialCom::setup();

mySensor_air.begin(SMOOTHED_AVERAGE, 4); // SMOOTHED_AVERAGE, SMOOTHED_EXPONENTIAL options

} // end constructor

void loop() {
Expand All @@ -206,7 +209,9 @@ struct DEV_AirQualitySensor : Service::AirQualitySensor { // A standalone Air Qu
airQualityAct = true;
}

pm25->setVal(state.avgPM25);
mySensor_air.add(state.avgPM25);

pm25->setVal(mySensor_air.get());

int airQualityVal = 0;

Expand Down
2 changes: 1 addition & 1 deletion air_quality/air_quality.ino
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void setup() {
new SpanAccessory();
new Service::AccessoryInformation();
new Characteristic::Identify();
new Characteristic::FirmwareRevision("1.1");
new Characteristic::FirmwareRevision("1.2");

new SpanAccessory();
new Service::AccessoryInformation();
Expand Down

0 comments on commit 93a1d9d

Please sign in to comment.