2022-01-12 18:02:43 +03:00
|
|
|
#ifdef EnableSensorTM1637
|
|
|
|
|
#pragma once
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include <OneWire.h>
|
|
|
|
|
#include "Global.h"
|
2022-01-12 19:01:15 +03:00
|
|
|
#include <TM1637Display.h>
|
2022-01-12 18:02:43 +03:00
|
|
|
|
2022-01-13 21:32:29 +03:00
|
|
|
struct DisplayObj {
|
|
|
|
|
TM1637Display* disp;
|
|
|
|
|
int curIndex;
|
|
|
|
|
};
|
2022-01-12 18:02:43 +03:00
|
|
|
|
|
|
|
|
class SensorTM1637;
|
|
|
|
|
|
|
|
|
|
typedef std::vector<SensorTM1637> MySensorTM1637Vector;
|
|
|
|
|
|
|
|
|
|
class SensorTM1637 {
|
|
|
|
|
public:
|
2022-01-13 21:32:29 +03:00
|
|
|
SensorTM1637(String key, int pin1, int pin2, unsigned long interval, unsigned int c, unsigned int k, String val, String descr);
|
2022-01-12 18:02:43 +03:00
|
|
|
~SensorTM1637();
|
|
|
|
|
|
|
|
|
|
void loop();
|
|
|
|
|
void writeTM1637();
|
|
|
|
|
void execute(String command);
|
|
|
|
|
String _key;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
unsigned long currentMillis;
|
|
|
|
|
unsigned long prevMillis;
|
|
|
|
|
unsigned long difference;
|
2022-01-13 21:32:29 +03:00
|
|
|
|
|
|
|
|
String _descr;
|
2022-01-12 18:02:43 +03:00
|
|
|
unsigned long _interval;
|
2022-01-13 21:32:29 +03:00
|
|
|
unsigned int _c;
|
|
|
|
|
unsigned int _k;
|
2022-01-12 18:02:43 +03:00
|
|
|
String _val;
|
2022-01-13 21:32:29 +03:00
|
|
|
|
|
|
|
|
TM1637Display* _disp;
|
2022-01-12 18:02:43 +03:00
|
|
|
};
|
|
|
|
|
|
2022-01-12 19:01:15 +03:00
|
|
|
extern MySensorTM1637Vector* mySensorTM1637;
|
2022-01-12 18:02:43 +03:00
|
|
|
|
|
|
|
|
extern void TM1637();
|
|
|
|
|
#endif
|