-
Notifications
You must be signed in to change notification settings - Fork 639
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
Add support for number of particles on PMSX003 devices #1120
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,16 +24,31 @@ | |
#define PMS_TYPE_5003ST 3 | ||
|
||
// Sensor type specified data | ||
#define PMS_SLOT_MAX 4 | ||
#define PMS_SLOT_MAX 9 | ||
#define PMS_DATA_MAX 17 | ||
const static struct { | ||
const char *name; | ||
unsigned char data_count; | ||
unsigned char slot_count; | ||
unsigned char slot_types[PMS_SLOT_MAX]; | ||
} pms_specs[] = { | ||
{"PMSX003", 13, 3, {MAGNITUDE_PM1dot0, MAGNITUDE_PM2dot5, MAGNITUDE_PM10}}, | ||
{"PMSX003_9", 9, 3, {MAGNITUDE_PM1dot0, MAGNITUDE_PM2dot5, MAGNITUDE_PM10}}, | ||
{"PMSX003", 13, 9, { | ||
MAGNITUDE_PM1dot0, | ||
MAGNITUDE_PM2dot5, | ||
MAGNITUDE_PM10, | ||
MAGNITUDE_PARTICLES_0dot3, | ||
MAGNITUDE_PARTICLES_0dot5, | ||
MAGNITUDE_PARTICLES_1, | ||
MAGNITUDE_PARTICLES_2dot5, | ||
MAGNITUDE_PARTICLES_5, | ||
MAGNITUDE_PARTICLES_10 | ||
} | ||
}, | ||
{"PMSX003_9", 9, 3, { | ||
MAGNITUDE_PM1dot0, | ||
MAGNITUDE_PM2dot5, | ||
MAGNITUDE_PM10 | ||
}}, | ||
{"PMS5003T", 13, 3, {MAGNITUDE_PM2dot5, MAGNITUDE_TEMPERATURE, MAGNITUDE_HUMIDITY}}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Yonsm could you check if these devices also support same readings? |
||
{"PMS5003ST", 17, 4, {MAGNITUDE_PM2dot5, MAGNITUDE_TEMPERATURE, MAGNITUDE_HUMIDITY, MAGNITUDE_HCHO}} | ||
}; | ||
|
@@ -314,6 +329,12 @@ class PMSX003Sensor : public BaseSensor, PMSX003 { | |
_slot_values[0] = data[3]; | ||
_slot_values[1] = data[4]; | ||
_slot_values[2] = data[5]; | ||
_slot_values[3] = data[6] * 10; // convert particles per 0.1L of air to 1L | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I understand the same, but you have defined the units per square meter of air when it should me per liter, so |
||
_slot_values[4] = data[7] * 10; // convert particles per 0.1L of air to 1L | ||
_slot_values[5] = data[8] * 10; // convert particles per 0.1L of air to 1L | ||
_slot_values[6] = data[9] * 10; // convert particles per 0.1L of air to 1L | ||
_slot_values[7] = data[10] * 10; // convert particles per 0.1L of air to 1L | ||
_slot_values[8] = data[11] * 10; // convert particles per 0.1L of air to 1L | ||
} | ||
} | ||
|
||
|
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.
Unsure what this device is @Yonsm.