mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 13:46:37 +00:00
Quick fixes
Quick fixes
This commit is contained in:
parent
06a068dc6b
commit
ac00e6541a
@ -508,7 +508,7 @@ void Bmp2xShow(boolean json)
|
|||||||
char pressure[10];
|
char pressure[10];
|
||||||
char sea_pressure[10];
|
char sea_pressure[10];
|
||||||
char humidity[10];
|
char humidity[10];
|
||||||
char name[14];// "BMXXXX2X-XX"
|
char name[14]; // "BMXXXX2X-XX"
|
||||||
|
|
||||||
if (bmp2x_sensors[bmp2x_idx].bmp_pressure != 0.0) {
|
if (bmp2x_sensors[bmp2x_idx].bmp_pressure != 0.0) {
|
||||||
bmp_sealevel = (bmp2x_sensors[bmp2x_idx].bmp_pressure / FastPrecisePow(1.0 - ((float)Settings.altitude / 44330.0), 5.255)) - 21.6;
|
bmp_sealevel = (bmp2x_sensors[bmp2x_idx].bmp_pressure / FastPrecisePow(1.0 - ((float)Settings.altitude / 44330.0), 5.255)) - 21.6;
|
||||||
@ -520,17 +520,17 @@ void Bmp2xShow(boolean json)
|
|||||||
dtostrfd(bmp2x_sensors[bmp2x_idx].bmp_pressure, Settings.flag2.pressure_resolution, pressure);
|
dtostrfd(bmp2x_sensors[bmp2x_idx].bmp_pressure, Settings.flag2.pressure_resolution, pressure);
|
||||||
dtostrfd(bmp_sealevel, Settings.flag2.pressure_resolution, sea_pressure);
|
dtostrfd(bmp_sealevel, Settings.flag2.pressure_resolution, sea_pressure);
|
||||||
dtostrfd(bmp2x_sensors[bmp2x_idx].bmp_humidity, Settings.flag2.humidity_resolution, humidity);
|
dtostrfd(bmp2x_sensors[bmp2x_idx].bmp_humidity, Settings.flag2.humidity_resolution, humidity);
|
||||||
#ifdef USE_BME680
|
#ifdef USE_BME680
|
||||||
char gas_resistance[10];
|
char gas_resistance[10];
|
||||||
dtostrfd(bmp2x_sensors[bmp2x_idx].bmp_gas_resistance, 2, gas_resistance);
|
dtostrfd(bmp2x_sensors[bmp2x_idx].bmp_gas_resistance, 2, gas_resistance);
|
||||||
#endif // USE_BME680
|
#endif // USE_BME680
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
char json_humidity[40];
|
char json_humidity[40];
|
||||||
snprintf_P(json_humidity, sizeof(json_humidity), PSTR(",\"" D_JSON_HUMIDITY "\":%s"), humidity);
|
snprintf_P(json_humidity, sizeof(json_humidity), PSTR(",\"" D_JSON_HUMIDITY "\":%s"), humidity);
|
||||||
char json_sealevel[40];
|
char json_sealevel[40];
|
||||||
snprintf_P(json_sealevel, sizeof(json_sealevel), PSTR(",\"" D_JSON_PRESSUREATSEALEVEL "\":%s"), sea_pressure);
|
snprintf_P(json_sealevel, sizeof(json_sealevel), PSTR(",\"" D_JSON_PRESSUREATSEALEVEL "\":%s"), sea_pressure);
|
||||||
#ifdef USE_BME680
|
#ifdef USE_BME680
|
||||||
char json_gas[40];
|
char json_gas[40];
|
||||||
snprintf_P(json_gas, sizeof(json_gas), PSTR(",\"" D_JSON_GAS "\":%s"), gas_resistance);
|
snprintf_P(json_gas, sizeof(json_gas), PSTR(",\"" D_JSON_GAS "\":%s"), gas_resistance);
|
||||||
|
|
||||||
@ -541,32 +541,32 @@ void Bmp2xShow(boolean json)
|
|||||||
name,
|
name,
|
||||||
temperature,
|
temperature,
|
||||||
(bmp2x_sensors[bmp2x_idx].bmp_model >= 2) ? json_humidity : "",
|
(bmp2x_sensors[bmp2x_idx].bmp_model >= 2) ? json_humidity : "",
|
||||||
pressure, (Settings.altitude != 0) ? json_sealevel : "",
|
pressure,
|
||||||
|
(Settings.altitude != 0) ? json_sealevel : "",
|
||||||
(bmp2x_sensors[bmp2x_idx].bmp_model >= 3) ? json_gas : ""
|
(bmp2x_sensors[bmp2x_idx].bmp_model >= 3) ? json_gas : ""
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
|
||||||
#else
|
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s}"),
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s}"),
|
||||||
mqtt_data, name, temperature, (bmp2x_sensors[bmp2x_idx].bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : "");
|
mqtt_data, name, temperature, (bmp2x_sensors[bmp2x_idx].bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : "");
|
||||||
#endif // USE_BME680
|
#endif // USE_BME680
|
||||||
#ifdef USE_DOMOTICZ
|
|
||||||
if (0 == tele_period) {
|
|
||||||
DomoticzTempHumPressureSensor(temperature, humidity, pressure);
|
|
||||||
#ifdef USE_BME680
|
|
||||||
if (bmp2x_sensors[bmp2x_idx].bmp_model >= 3) { DomoticzSensor(DZ_AIRQUALITY, (uint32_t)bmp2x_sensors[bmp2x_idx].bmp_gas_resistance); }
|
|
||||||
#endif // USE_BME680
|
|
||||||
}
|
|
||||||
#endif // USE_DOMOTICZ
|
|
||||||
|
|
||||||
#ifdef USE_KNX
|
#ifdef USE_DOMOTICZ
|
||||||
|
if ((0 == tele_period) && (0 == bmp2x_idx)) { // We want the same first sensor to report to Domoticz in case a read is missed
|
||||||
|
DomoticzTempHumPressureSensor(temperature, humidity, pressure);
|
||||||
|
#ifdef USE_BME680
|
||||||
|
if (bmp2x_sensors[bmp2x_idx].bmp_model >= 3) { DomoticzSensor(DZ_AIRQUALITY, (uint32_t)bmp2x_sensors[bmp2x_idx].bmp_gas_resistance); }
|
||||||
|
#endif // USE_BME680
|
||||||
|
}
|
||||||
|
#endif // USE_DOMOTICZ
|
||||||
|
|
||||||
|
#ifdef USE_KNX
|
||||||
if (0 == tele_period) {
|
if (0 == tele_period) {
|
||||||
KnxSensor(KNX_TEMPERATURE, bmp2x_sensors[bmp2x_idx].bmp_temperature);
|
KnxSensor(KNX_TEMPERATURE, bmp2x_sensors[bmp2x_idx].bmp_temperature);
|
||||||
KnxSensor(KNX_HUMIDITY, bmp2x_sensors[bmp2x_idx].bmp_humidity);
|
KnxSensor(KNX_HUMIDITY, bmp2x_sensors[bmp2x_idx].bmp_humidity);
|
||||||
}
|
}
|
||||||
#endif // USE_KNX
|
#endif // USE_KNX
|
||||||
|
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
} else {
|
} else {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, name, temperature, TempUnit());
|
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, name, temperature, TempUnit());
|
||||||
if (bmp2x_sensors[bmp2x_idx].bmp_model >= 2) {
|
if (bmp2x_sensors[bmp2x_idx].bmp_model >= 2) {
|
||||||
@ -576,12 +576,12 @@ void Bmp2xShow(boolean json)
|
|||||||
if (Settings.altitude != 0) {
|
if (Settings.altitude != 0) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SEAPRESSURE, mqtt_data, name, sea_pressure);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SEAPRESSURE, mqtt_data, name, sea_pressure);
|
||||||
}
|
}
|
||||||
#ifdef USE_BME680
|
#ifdef USE_BME680
|
||||||
if (bmp2x_sensors[bmp2x_idx].bmp_model >= 3) {
|
if (bmp2x_sensors[bmp2x_idx].bmp_model >= 3) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{s}%s " D_GAS "{m}%s " D_UNIT_KILOOHM "{e}"), mqtt_data, name, gas_resistance);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{s}%s " D_GAS "{m}%s " D_UNIT_KILOOHM "{e}"), mqtt_data, name, gas_resistance);
|
||||||
}
|
}
|
||||||
#endif // USE_BME680
|
#endif // USE_BME680
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user