From 0af3b0c28de936d03468f13d3f26a89d85c5cc98 Mon Sep 17 00:00:00 2001 From: Yonsm Date: Mon, 28 Jan 2019 11:56:11 +0800 Subject: [PATCH] Support PMS5003S --- code/espurna/sensors/PMSX003Sensor.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/espurna/sensors/PMSX003Sensor.h b/code/espurna/sensors/PMSX003Sensor.h index 2cfaf3f9..2374347b 100644 --- a/code/espurna/sensors/PMSX003Sensor.h +++ b/code/espurna/sensors/PMSX003Sensor.h @@ -24,6 +24,7 @@ #define PMS_TYPE_X003_9 1 #define PMS_TYPE_5003T 2 #define PMS_TYPE_5003ST 3 +#define PMS_TYPE_5003S 4 // Sensor type specified data #define PMS_SLOT_MAX 4 @@ -37,7 +38,8 @@ const static struct { {"PMSX003", 13, 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}}, - {"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] @@ -308,6 +310,10 @@ class PMSX003Sensor : public BaseSensor, PMSX003 { _slot_values[1] = (double)data[13] / 10; _slot_values[2] = (double)data[14] / 10; _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) { _slot_values[0] = data[4]; _slot_values[1] = (double)data[10] / 10;