mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-08 10:57:51 +00:00
PMSA003I: add support for driving SET pin low while not actively taking a telemetry reading (#6569)
* support manually shutting off power to the PMSA003I sensor when we aren't doing a telemetry reading * add comment about PMSA003I_WARMUP_MS to AirQualityTelemetry.cpp * fix typos, use arduino gpio defines instead of magic numbers * support manually shutting off power to the PMSA003I sensor when we aren't doing a telemetry reading * add comment about PMSA003I_WARMUP_MS to AirQualityTelemetry.cpp * fix typos, use arduino gpio defines instead of magic numbers * RAK4631: add PMSA003I_ENABLE_PIN define * fix indentation --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -23,6 +23,14 @@ class AirQualityTelemetryModule : private concurrency::OSThread, public Protobuf
|
||||
setIntervalFromNow(10 * 1000);
|
||||
aqi = Adafruit_PM25AQI();
|
||||
nodeStatusObserver.observe(&nodeStatus->onNewStatus);
|
||||
|
||||
#ifdef PMSA003I_ENABLE_PIN
|
||||
// the PMSA003I sensor uses about 300mW on its own; support powering it off when it's not actively taking
|
||||
// a reading
|
||||
state = State::IDLE;
|
||||
#else
|
||||
state = State::ACTIVE;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -42,6 +50,12 @@ class AirQualityTelemetryModule : private concurrency::OSThread, public Protobuf
|
||||
bool sendTelemetry(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
||||
|
||||
private:
|
||||
enum State {
|
||||
IDLE = 0,
|
||||
ACTIVE = 1,
|
||||
};
|
||||
|
||||
State state;
|
||||
Adafruit_PM25AQI aqi;
|
||||
PM25_AQI_Data data = {0};
|
||||
bool firstTime = true;
|
||||
|
||||
Reference in New Issue
Block a user