Browse Source

Support PMS5003S

sensors
Yonsm 5 years ago
parent
commit
0af3b0c28d
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      code/espurna/sensors/PMSX003Sensor.h

+ 7
- 1
code/espurna/sensors/PMSX003Sensor.h View File

@ -24,6 +24,7 @@
#define PMS_TYPE_X003_9 1 #define PMS_TYPE_X003_9 1
#define PMS_TYPE_5003T 2 #define PMS_TYPE_5003T 2
#define PMS_TYPE_5003ST 3 #define PMS_TYPE_5003ST 3
#define PMS_TYPE_5003S 4
// Sensor type specified data // Sensor type specified data
#define PMS_SLOT_MAX 4 #define PMS_SLOT_MAX 4
@ -37,7 +38,8 @@ const static struct {
{"PMSX003", 13, 3, {MAGNITUDE_PM1dot0, MAGNITUDE_PM2dot5, MAGNITUDE_PM10}}, {"PMSX003", 13, 3, {MAGNITUDE_PM1dot0, MAGNITUDE_PM2dot5, MAGNITUDE_PM10}},
{"PMSX003_9", 9, 3, {MAGNITUDE_PM1dot0, MAGNITUDE_PM2dot5, MAGNITUDE_PM10}}, {"PMSX003_9", 9, 3, {MAGNITUDE_PM1dot0, MAGNITUDE_PM2dot5, MAGNITUDE_PM10}},
{"PMS5003T", 13, 3, {MAGNITUDE_PM2dot5, MAGNITUDE_TEMPERATURE, MAGNITUDE_HUMIDITY}}, {"PMS5003T", 13, 3, {MAGNITUDE_PM2dot5, MAGNITUDE_TEMPERATURE, MAGNITUDE_HUMIDITY}},
{"PMS5003ST", 17, 4, {MAGNITUDE_PM2dot5, MAGNITUDE_TEMPERATURE, MAGNITUDE_HUMIDITY, MAGNITUDE_HCHO}}
{"PMS5003ST", 17, 4, {MAGNITUDE_PM2dot5, MAGNITUDE_TEMPERATURE, MAGNITUDE_HUMIDITY, MAGNITUDE_HCHO}},
{"PMS5003S", 13, 3, {MAGNITUDE_PM2dot5, MAGNITUDE_PM10, MAGNITUDE_HCHO}},
}; };
// [MAGIC][LEN][DATA9|13|17][SUM] // [MAGIC][LEN][DATA9|13|17][SUM]
@ -308,6 +310,10 @@ class PMSX003Sensor : public BaseSensor, PMSX003 {
_slot_values[1] = (double)data[13] / 10; _slot_values[1] = (double)data[13] / 10;
_slot_values[2] = (double)data[14] / 10; _slot_values[2] = (double)data[14] / 10;
_slot_values[3] = (double)data[12] / 1000; _slot_values[3] = (double)data[12] / 1000;
} else if (_type == PMS_TYPE_5003S) {
_slot_values[0] = data[4];
_slot_values[1] = data[5];
_slot_values[2] = (double)data[12] / 1000;
} else if (_type == PMS_TYPE_5003T) { } else if (_type == PMS_TYPE_5003T) {
_slot_values[0] = data[4]; _slot_values[0] = data[4];
_slot_values[1] = (double)data[10] / 10; _slot_values[1] = (double)data[10] / 10;


Loading…
Cancel
Save