mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 18:54:28 +05:00
fix: reset onewire before begin (fix DS18B20)
This commit is contained in:
@@ -32,11 +32,13 @@ protected:
|
|||||||
DallasTemperature* indoorSensor = nullptr;
|
DallasTemperature* indoorSensor = nullptr;
|
||||||
|
|
||||||
bool initOutdoorSensor = false;
|
bool initOutdoorSensor = false;
|
||||||
|
unsigned long initOutdoorSensorTime = 0;
|
||||||
unsigned long startOutdoorConversionTime = 0;
|
unsigned long startOutdoorConversionTime = 0;
|
||||||
float filteredOutdoorTemp = 0;
|
float filteredOutdoorTemp = 0;
|
||||||
bool emptyOutdoorTemp = true;
|
bool emptyOutdoorTemp = true;
|
||||||
|
|
||||||
bool initIndoorSensor = false;
|
bool initIndoorSensor = false;
|
||||||
|
unsigned long initIndoorSensorTime = 0;
|
||||||
unsigned long startIndoorConversionTime = 0;
|
unsigned long startIndoorConversionTime = 0;
|
||||||
float filteredIndoorTemp = 0;
|
float filteredIndoorTemp = 0;
|
||||||
bool emptyIndoorTemp = true;
|
bool emptyIndoorTemp = true;
|
||||||
@@ -229,10 +231,16 @@ protected:
|
|||||||
|
|
||||||
void outdoorTemperatureSensor() {
|
void outdoorTemperatureSensor() {
|
||||||
if (!this->initOutdoorSensor) {
|
if (!this->initOutdoorSensor) {
|
||||||
|
if (this->initOutdoorSensorTime && millis() - this->initOutdoorSensorTime < EXT_SENSORS_INTERVAL * 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_OUTDOOR), F("Starting on gpio %hhu..."), settings.sensors.outdoor.gpio);
|
Log.sinfoln(FPSTR(L_SENSORS_OUTDOOR), F("Starting on gpio %hhu..."), settings.sensors.outdoor.gpio);
|
||||||
|
|
||||||
this->oneWireOutdoorSensor->begin(settings.sensors.outdoor.gpio);
|
this->oneWireOutdoorSensor->begin(settings.sensors.outdoor.gpio);
|
||||||
|
this->oneWireOutdoorSensor->reset();
|
||||||
this->outdoorSensor->begin();
|
this->outdoorSensor->begin();
|
||||||
|
this->initOutdoorSensorTime = millis();
|
||||||
|
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_OUTDOOR),
|
FPSTR(L_SENSORS_OUTDOOR),
|
||||||
@@ -295,10 +303,16 @@ protected:
|
|||||||
|
|
||||||
void indoorTemperatureSensor() {
|
void indoorTemperatureSensor() {
|
||||||
if (!this->initIndoorSensor) {
|
if (!this->initIndoorSensor) {
|
||||||
|
if (this->initIndoorSensorTime && millis() - this->initIndoorSensorTime < EXT_SENSORS_INTERVAL * 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_INDOOR), F("Starting on gpio %hhu..."), settings.sensors.indoor.gpio);
|
Log.sinfoln(FPSTR(L_SENSORS_INDOOR), F("Starting on gpio %hhu..."), settings.sensors.indoor.gpio);
|
||||||
|
|
||||||
this->oneWireIndoorSensor->begin(settings.sensors.indoor.gpio);
|
this->oneWireIndoorSensor->begin(settings.sensors.indoor.gpio);
|
||||||
|
this->oneWireIndoorSensor->reset();
|
||||||
this->indoorSensor->begin();
|
this->indoorSensor->begin();
|
||||||
|
this->initIndoorSensorTime = millis();
|
||||||
|
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_INDOOR),
|
FPSTR(L_SENSORS_INDOOR),
|
||||||
|
|||||||
Reference in New Issue
Block a user