From 2bcad48eabb7598e4029be5894fe07b66e31fcc1 Mon Sep 17 00:00:00 2001 From: fcauwe Date: Sun, 15 Nov 2020 10:51:22 +0100 Subject: [PATCH] [P056] Fixed bug when SDS sensor is not reporting Fixed bug that makes the sensor not reporting values even when everything is well connected. The problem is that the Sensor is in "Query reporting" mode, and therefore it is not actively sending values. The fix consist of setting the Sensor in "Active reporting" (command 2,1,0), when setting the working during configuration. --- lib/SerialDevices/jkSDS011.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/SerialDevices/jkSDS011.cpp b/lib/SerialDevices/jkSDS011.cpp index cca2d322d..9d7f598a5 100644 --- a/lib/SerialDevices/jkSDS011.cpp +++ b/lib/SerialDevices/jkSDS011.cpp @@ -94,6 +94,9 @@ void CjkSDS011::SetWorkingPeriod(int minutes) { const int currentWorkingPeriod = GetWorkingPeriod(); if (minutes != currentWorkingPeriod) SendCommand(8, 1, minutes); + // In some cases the Sensor is set to "report query"-mode, this makes sure to set active reporting of values, otherwise the sensor won't work. + Process(); + SendCommand(2, 1, 0); } int CjkSDS011::GetWorkingPeriod() {