sensoresp/include/sensor_mhz19b.h

50 lines
887 B
C++

#ifndef SENSOR_MHZ19B_H
#define SENSOR_MHZ19B_H
#include "sensordata.h"
#include <Homie.h>
#include <SoftwareSerial.h>
#include <MHZ19.h>
class Sensor_MHZ19B
{
private:
HomieNode *sensorNode; //reference to HomieNode
struct sensordata data; //struct values are changed in setup()
int pin_rx;
int pin_tx;
bool init_ok;
int mhz19_readValue_reimplemented(Stream *_streamRef, MHZ19 *_mhz19Ref);
byte mhz19_getCheckSum(byte* packet);
bool mhz19_ready;
MHZ19 *mhz19;
SoftwareSerial *mhz19_swSerial;
#define BAUD_RATE_MHZ19 9600
#define MHZ19CALIBRATIONTOPIC
public:
Sensor_MHZ19B(int prx, int ptx);
void init();
void setSettings(float minchange, unsigned long senddelaymax, unsigned long readdelay);
void advertise(HomieNode& p_sensorNode);
void sensorloop();
void calibrateZero();
};
#endif