Merge pull request #192 from biveraxe/ver4dev

Исправляем ошибки компиляции при переходе на новое ядро
This commit is contained in:
2022-09-14 20:37:22 +03:00
committed by GitHub
5 changed files with 83 additions and 83 deletions

View File

@@ -74,23 +74,23 @@ class Bme280p : public IoTItem {
};
void* getAPI_Bme280(String subtype, String param) {
// if (subtype == F("Bme280t") || subtype == F("Bme280h") || subtype == F("Bme280p")) {
// String addr;
// jsonRead(param, "addr", addr);
//
// if (bmes.find(addr) == bmes.end()) {
// bmes[addr] = new Adafruit_BME280();
// bmes[addr]->begin(hexStringToUint8(addr));
// }
//
// if (subtype == F("Bme280t")) {
// return new Bme280t(bmes[addr], param);
// } else if (subtype == F("Bme280h")) {
// return new Bme280h(bmes[addr], param);
// } else if (subtype == F("Bme280p")) {
// return new Bme280p(bmes[addr], param);
// }
//} else {
if (subtype == F("Bme280t") || subtype == F("Bme280h") || subtype == F("Bme280p")) {
String addr;
jsonRead(param, "addr", addr);
if (bmes.find(addr) == bmes.end()) {
bmes[addr] = new Adafruit_BME280();
bmes[addr]->begin(hexStringToUint8(addr));
}
if (subtype == F("Bme280t")) {
return new Bme280t(bmes[addr], param);
} else if (subtype == F("Bme280h")) {
return new Bme280h(bmes[addr], param);
} else if (subtype == F("Bme280p")) {
return new Bme280p(bmes[addr], param);
}
}
return nullptr;
//}
}

View File

@@ -54,21 +54,21 @@ class Bmp280p : public IoTItem {
};
void* getAPI_Bmp280(String subtype, String param) {
// if (subtype == F("Bmp280t") || subtype == F("Bmp280p")) {
// String addr;
// jsonRead(param, "addr", addr);
//
// if (bmps.find(addr) == bmps.end()) {
// bmps[addr] = new Adafruit_BMP280();
// bmps[addr]->begin(hexStringToUint8(addr));
// }
//
// if (subtype == F("Bmp280t")) {
// return new Bmp280t(bmps[addr], param);
// } else if (subtype == F("Bmp280p")) {
// return new Bmp280p(bmps[addr], param);
// }
//} else {
if (subtype == F("Bmp280t") || subtype == F("Bmp280p")) {
String addr;
jsonRead(param, "addr", addr);
if (bmps.find(addr) == bmps.end()) {
bmps[addr] = new Adafruit_BMP280();
bmps[addr]->begin(hexStringToUint8(addr));
}
if (subtype == F("Bmp280t")) {
return new Bmp280t(bmps[addr], param);
} else if (subtype == F("Bmp280p")) {
return new Bmp280p(bmps[addr], param);
}
}
return nullptr;
//}
}

View File

@@ -53,28 +53,28 @@ class Dht1122h : public IoTItem {
};
void* getAPI_Dht1122(String subtype, String param) {
// if (subtype == F("Dht1122t") || subtype == F("Dht1122h")) {
// int pin;
// String senstype;
// jsonRead(param, "pin", pin);
// jsonRead(param, "senstype", senstype);
//
// if (dhts.find(pin) == dhts.end()) {
// dhts[pin] = new DHTesp();
//
// if (senstype == "dht11") {
// dhts[pin]->setup(pin, DHTesp::DHT11);
// } else if (senstype == "dht22") {
// dhts[pin]->setup(pin, DHTesp::DHT22);
// }
// }
//
// if (subtype == F("Dht1122t")) {
// return new Dht1122t(dhts[pin], param);
// } else if (subtype == F("Dht1122h")) {
// return new Dht1122h(dhts[pin], param);
// }
//} else {
if (subtype == F("Dht1122t") || subtype == F("Dht1122h")) {
int pin;
String senstype;
jsonRead(param, "pin", pin);
jsonRead(param, "senstype", senstype);
if (dhts.find(pin) == dhts.end()) {
dhts[pin] = new DHTesp();
if (senstype == "dht11") {
dhts[pin]->setup(pin, DHTesp::DHT11);
} else if (senstype == "dht22") {
dhts[pin]->setup(pin, DHTesp::DHT22);
}
}
if (subtype == F("Dht1122t")) {
return new Dht1122t(dhts[pin], param);
} else if (subtype == F("Dht1122h")) {
return new Dht1122h(dhts[pin], param);
}
}
return nullptr;
//}
}

View File

@@ -46,18 +46,18 @@ class GY21h : public IoTItem {
};
void* getAPI_GY21(String subtype, String param) {
// if (subtype == F("GY21t") || subtype == F("GY21h")) {
// if (!sensor) {
// sensor = new GY21;
// if (sensor) Wire.begin(SDA, SCL);
// }
//
// if (subtype == F("GY21t")) {
// return new GY21t(param);
// } else if (subtype == F("GY21h")) {
// return new GY21h(param);
// }
//} else {
if (subtype == F("GY21t") || subtype == F("GY21h")) {
if (!sensor) {
sensor = new GY21;
if (sensor) Wire.begin(SDA, SCL);
}
if (subtype == F("GY21t")) {
return new GY21t(param);
} else if (subtype == F("GY21h")) {
return new GY21h(param);
}
}
return nullptr;
//}
}

View File

@@ -39,18 +39,18 @@ class Sht20h : public IoTItem {
};
void* getAPI_Sht20(String subtype, String param) {
// if (subtype == F("Sht20t") || subtype == F("Sht20h")) {
// if (!sht) {
// sht = new SHT2x;
// if (sht) sht->begin();
// }
//
// if (subtype == F("Sht20t")) {
// return new Sht20t(param);
// } else if (subtype == F("Sht20h")) {
// return new Sht20h(param);
// }
//} else {
if (subtype == F("Sht20t") || subtype == F("Sht20h")) {
if (!sht) {
sht = new SHT2x;
if (sht) sht->begin();
}
if (subtype == F("Sht20t")) {
return new Sht20t(param);
} else if (subtype == F("Sht20h")) {
return new Sht20h(param);
}
}
return nullptr;
//}
}