-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Move PMSA003I to separate class and update AQ telemetry #7190
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
Move PMSA003I to separate class and update AQ telemetry #7190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR decouples the PMSA003I sensor from the AirQualityTelemetryModule into its own class and brings the telemetry code up to date with master.
- Extracted PMSA003I logic into
PMSA003ISensor - Refactored
AirQualityTelemetryModuleto delegate sensor operations and add deep‐sleep support - Cleaned up legacy fields and removed direct sensor handling from environmental telemetry
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/Telemetry/Sensor/PMSA003ISensor.h | New sensor class declaration and warmup constant |
| src/modules/Telemetry/Sensor/PMSA003ISensor.cpp | New sensor class implementation and I2C scanning logic |
| src/modules/Telemetry/EnvironmentTelemetry.h | Removed unused sensor_read_error_count field |
| src/modules/Telemetry/EnvironmentTelemetry.cpp | Removed reset of sensor_read_error_count |
| src/modules/Telemetry/AirQualityTelemetry.h | Updated module to use PMSA003ISensor, UI stubs, and config |
| src/modules/Telemetry/AirQualityTelemetry.cpp | Refactored run/send logic, deep‐sleep integration, UI drawing |
| src/modules/Modules.cpp | Always register AirQualityTelemetryModule |
Comments suppressed due to low confidence (7)
src/modules/Telemetry/Sensor/PMSA003ISensor.h:41
- The call to pinMode is placed at class scope, which is invalid C++; move it into the constructor or setup() method.
pinMode(PMSA003I_ENABLE_PIN, OUTPUT);
src/modules/Telemetry/Sensor/PMSA003ISensor.cpp:54
- Definition of sleep() is missing the class scope qualifier; it should be defined as
void PMSA003ISensor::sleep().
void sleep() {
src/modules/Telemetry/Sensor/PMSA003ISensor.cpp:59
- Definition of wakeUp() is missing the class scope qualifier and lacks a return statement; it should be
uint32_t PMSA003ISensor::wakeUp()and return the warmup delay.
uint32_t wakeUp() {
src/modules/Telemetry/Sensor/PMSA003ISensor.cpp:68
- Typo in the log message: "AQIn" should be "AQI".
LOG_WARN("Skip send measurements. Could not read AQIn");
src/modules/Telemetry/AirQualityTelemetry.cpp:29
sleepOnNextExecutionis used but not declared inAirQualityTelemetryModule; add abool sleepOnNextExecutionmember.
if (sleepOnNextExecution == true) {
src/modules/Telemetry/AirQualityTelemetry.cpp:77
stateis a private member ofPMSA003ISensorandpmsa003iSensor::State::IDLEis invalid syntax; either expose a getter or usePMSA003ISensor::State::IDLEand adjust access.
if (pmsa003iSensor.hasSensor() && pmsa003iSensor.state == pmsa003iSensor::State::IDLE)
src/modules/Modules.cpp:218
- [nitpick] Instantiating
AirQualityTelemetryModuleunconditionally may start the module without a sensor; consider guarding this with a sensor‐presence check.
new AirQualityTelemetryModule();
|
@thebentern I have fixed (I think) comments by |
660242e to
b9ab6ef
Compare
|
Rebased on to master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw your PR and checked out, while compiling for different targets I came across some issues.
0d60d0e to
c545a9f
Compare
|
Merged master and resolved @hafu comments. |
b0436b3 to
1f8b510
Compare
|
|
854a562 to
7686d46
Compare
f11f60c to
1b28fc1
Compare
* Reworks AQ telemetry to match new dynamic allocation method * Adds VBLE_I2C_CLOCK_SPEED build flag for sensors with different I2C speed requirements * Reworks PMSA003I
|
Reworked based on https://github.com/meshtastic/firmware/pull/8054/changes and tested with seeed-xiao-s3. Also adds It needs meshtastic/protobufs#840 |
* Added to Seeed Xiao S3 as demo
* Add reclock function in TelemetrySensor.cpp * Add flag in ESP32 common
|
Not sure where this part should go. Maybe in |
Sounds good to me |
* Add exclude AQ sensor to builds that have environmental sensor excludes * Add includes to AddI2CSensorTemplate.h
|
All builds pass? Is this real life? 👀 |
This Pull request aims to have a clean
AirQualityTelemetrymodule, decoupled from the PMSA003I sensor integration, and update to the latest changes inmaster.It already contains the work by @fifieldt on #7187. Other efforts have been done as part of other sensor integrations such as this #4601 for the CO2 sensor SCD4X (in this commit 318da22) or in this other https://github.com/hafu/meshtastic-firmware/tree/add-scd30 to add a SCD30 (in this commit 735b428).
I open a separate one to be able to test this features separately, and create other branches separate to integrate those sensors (and others as part of the hackathon). The features to test are:
rescanlogic originally implemented as part of theAirQualityTelemetryclass, I assume for those sensors that have a long boot timeSadly, I don't have a PMSA003I sensor with me at the moment (I have ordered one), but if anyone has one, it'd be great if you can check and/or give feedback. I think the original implementer @thebentern and @fifieldt would have a lot to say. I'll try to be responsive to be able to fix.
NOTE: Since I am making a PR from a separate org github doesn't allow for edits (see this issue).