sensoresp/include/sensor_anemometer.h

44 lines
876 B
C
Raw Normal View History

2021-11-08 18:49:25 +00:00
#ifndef SENSOR_Anemometer_H
#define SENSOR_Anemometer_H
#include "sensordata.h"
#include <Homie.h>
2021-11-08 19:09:59 +00:00
2021-11-08 18:49:25 +00:00
class Sensor_Anemometer
{
private:
HomieNode *sensorNode; //reference to HomieNode
int pin;
struct sensordata data; //struct values are changed in setup()
//value in [m/s]
bool init_ok;
unsigned long anemometer_lasttimereset=0;
#define ANEMOMETER_DEBOUNCETIME 15 //15ms between pulses is approx 85m/s windspeed
public:
Sensor_Anemometer(int p);
void init();
void setSettings(float minchange, unsigned long senddelaymax, unsigned long readdelay);
void advertise(HomieNode& p_sensorNode);
void sensorloop();
//void ICACHE_RAM_ATTR interrupt_anemometer();
uint16_t anemometer_pulsecounter=0; //counted pulses since last reset
unsigned long anemometer_lastpulse_fordebounce=0;
};
#endif