Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some filtering to Air Quality Sensor data #5

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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