mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-17 18:52:07 +02:00
Restart device after PMS sensor read failed 10 times
This commit is contained in:
@ -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);
|
||||
@ -36,6 +42,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);
|
||||
|
Reference in New Issue
Block a user