mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-02-06 08:36:15 +00:00
Support multiple temperature sensors
This commit is contained in:
@@ -18,6 +18,14 @@
|
||||
#define LED_BLUE 3
|
||||
#define LED_YELLOW 4
|
||||
|
||||
struct TempSensorData {
|
||||
uint8_t address[8];
|
||||
char name[32];
|
||||
bool common;
|
||||
float lastRead;
|
||||
float lastValidRead;
|
||||
};
|
||||
|
||||
class HwTools {
|
||||
public:
|
||||
void setTempSensorPin(int tempSensorPin);
|
||||
@@ -25,7 +33,12 @@ public:
|
||||
void setVccOffset(double vccOffset);
|
||||
void setVccMultiplier(double vccMultiplier);
|
||||
double getVcc();
|
||||
void confTempSensor(uint8_t address[8], const char name[32], bool common);
|
||||
uint8_t getTempSensorCount();
|
||||
TempSensorData* getTempSensorData(uint8_t i);
|
||||
bool updateTemperatures();
|
||||
double getTemperature();
|
||||
double getTemperature(uint8_t address[8]);
|
||||
int getWifiRssi();
|
||||
void setLed(uint8_t ledPin, bool ledInverted);
|
||||
void setLedRgb(uint8_t ledPinRed, uint8_t ledPinGreen, uint8_t ledPinBlue, bool ledRgbInverted);
|
||||
@@ -41,11 +54,15 @@ private:
|
||||
bool ledInverted, ledRgbInverted;
|
||||
double vccOffset = 0.0;
|
||||
double vccMultiplier = 1.0;
|
||||
bool tempSensorInit, hasTempSensor;
|
||||
|
||||
bool tempSensorInit;
|
||||
OneWire *oneWire;
|
||||
DallasTemperature *tempSensor;
|
||||
DallasTemperature *sensorApi;
|
||||
uint8_t sensorCount = 0;
|
||||
TempSensorData *tempSensors[32];
|
||||
|
||||
bool writeLedPin(uint8_t color, uint8_t state);
|
||||
bool isSensorAddressEqual(uint8_t a[8], uint8_t b[8]);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user