Merge branch 'develop' into hotfix/pms25-compensated-show-on-display

This commit is contained in:
Phat Nguyen
2024-08-30 19:02:50 +07:00
18 changed files with 316 additions and 70 deletions

View File

@ -3,11 +3,17 @@
#include <Arduino.h>
#define PMS_FAIL_COUNT_SET_INVALID 3
class PMSBase {
public:
bool begin(Stream *stream);
void handle();
bool isFailed(void);
void updateFailCount(void);
void resetFailCount(void);
int getFailCount(void);
int getFailCountMax(void);
uint16_t getRaw0_1(void);
uint16_t getRaw2_5(void);
uint16_t getRaw10(void);
@ -26,6 +32,8 @@ public:
/** For PMS5003T*/
int16_t getTemp(void);
uint16_t getHum(void);
uint8_t getFirmwareVersion(void);
uint8_t getErrorCode(void);
int pm25ToAQI(int pm02);
int compensate(int pm25, float humidity);
@ -36,6 +44,8 @@ private:
int packageIndex;
bool failed = false;
uint32_t lastRead;
const int failCountMax = 10;
int failCount = 0;
int16_t toI16(char *buf);
uint16_t toU16(char* buf);