forked from airgradienthq/arduino
Optimize PMS sensor read data on active mode send each second
This commit is contained in:
+10
-10
@@ -73,7 +73,7 @@ bool PMS5003::begin(void) {
|
||||
}
|
||||
#else
|
||||
this->_serial->begin(9600);
|
||||
if (pms.begin(this->_serial) == false) {
|
||||
if (pms.begin(*this->_serial) == false) {
|
||||
AgLog("PMS failed");
|
||||
return false;
|
||||
}
|
||||
@@ -148,6 +148,14 @@ int PMS5003::getFirmwareVersion(void) { return _ver; }
|
||||
*/
|
||||
uint8_t PMS5003::getErrorCode(void) { return pms.getErrorCode(); }
|
||||
|
||||
/**
|
||||
* @brief Is sensor connect with device
|
||||
*
|
||||
* @return true Connected
|
||||
* @return false Removed
|
||||
*/
|
||||
bool PMS5003::connected(void) { return pms.connected(); }
|
||||
|
||||
/**
|
||||
* @brief Check device initialized or not
|
||||
*
|
||||
@@ -182,15 +190,7 @@ void PMS5003::end(void) {
|
||||
* @brief Check and read PMS sensor data. This method should be callack from
|
||||
* loop process to continoue check sensor data if it's available
|
||||
*/
|
||||
void PMS5003::handle(void) { pms.handle(); }
|
||||
|
||||
/**
|
||||
* @brief Get sensor status
|
||||
*
|
||||
* @return true No problem
|
||||
* @return false Communication timeout or sensor has removed
|
||||
*/
|
||||
bool PMS5003::isFailed(void) { return pms.isFailed(); }
|
||||
void PMS5003::handle(void) { pms.readPackage(*this->_serial); }
|
||||
|
||||
void PMS5003::updateFailCount(void) {
|
||||
pms.updateFailCount();
|
||||
|
||||
Reference in New Issue
Block a user