mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
Merge branch 'development' of https://github.com/arendst/Sonoff-Tasmota into development
This commit is contained in:
commit
9ea3e7d80e
@ -1,4 +1,6 @@
|
|||||||
/* 6.1.1c
|
/* 6.1.1c
|
||||||
|
* Fix possible WDT due to long MQTT publish handling (#3313)
|
||||||
|
* Fix CCS811 temperature and humidity compensation
|
||||||
* Add support for CCS811 sensor (#3309)
|
* Add support for CCS811 sensor (#3309)
|
||||||
* Add command Timers 0/1 to globally disable or enable armed timers (#3270)
|
* Add command Timers 0/1 to globally disable or enable armed timers (#3270)
|
||||||
*
|
*
|
||||||
|
@ -68,6 +68,7 @@ typedef unsigned long power_t; // Power (Relay) type
|
|||||||
#define HLW_IREF_PULSE 3500 // was 1666us = 600Hz = 4.545A
|
#define HLW_IREF_PULSE 3500 // was 1666us = 600Hz = 4.545A
|
||||||
|
|
||||||
#define MQTT_RETRY_SECS 10 // Minimum seconds to retry MQTT connection
|
#define MQTT_RETRY_SECS 10 // Minimum seconds to retry MQTT connection
|
||||||
|
#define GLOBAL_VALUES_VALID 300 // Max number of seconds to keep last received values
|
||||||
#define APP_POWER 0 // Default saved power state Off
|
#define APP_POWER 0 // Default saved power state Off
|
||||||
#define WS2812_MAX_LEDS 512 // Max number of LEDs
|
#define WS2812_MAX_LEDS 512 // Max number of LEDs
|
||||||
|
|
||||||
|
@ -188,8 +188,9 @@ uint8_t ntp_force_sync = 0; // Force NTP sync
|
|||||||
StateBitfield global_state;
|
StateBitfield global_state;
|
||||||
RulesBitfield rules_flag;
|
RulesBitfield rules_flag;
|
||||||
|
|
||||||
uint8_t glob_humidity = 0;
|
uint32_t global_update = 0;
|
||||||
sint16_t glob_temperature = -9999;
|
float global_temperature = 0;
|
||||||
|
float global_humidity = 0;
|
||||||
|
|
||||||
char my_version[33]; // Composed version string
|
char my_version[33]; // Composed version string
|
||||||
char my_hostname[33]; // Composed Wifi hostname
|
char my_hostname[33]; // Composed Wifi hostname
|
||||||
@ -1544,6 +1545,8 @@ void PerformEverySecond()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResetGlobalValues();
|
||||||
|
|
||||||
if (Settings.tele_period) {
|
if (Settings.tele_period) {
|
||||||
tele_period++;
|
tele_period++;
|
||||||
if (tele_period == Settings.tele_period -1) {
|
if (tele_period == Settings.tele_period -1) {
|
||||||
|
@ -414,6 +414,22 @@ char TempUnit()
|
|||||||
return (Settings.flag.temperature_conversion) ? 'F' : 'C';
|
return (Settings.flag.temperature_conversion) ? 'F' : 'C';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetGlobalValues(float temperature, float humidity)
|
||||||
|
{
|
||||||
|
global_update = uptime;
|
||||||
|
global_temperature = temperature;
|
||||||
|
global_humidity = humidity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetGlobalValues()
|
||||||
|
{
|
||||||
|
if ((uptime - global_update) > GLOBAL_VALUES_VALID) { // Reset after 5 minutes
|
||||||
|
global_update = 0;
|
||||||
|
global_temperature = 0;
|
||||||
|
global_humidity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double FastPrecisePow(double a, double b)
|
double FastPrecisePow(double a, double b)
|
||||||
{
|
{
|
||||||
// https://martin.ankerl.com/2012/01/25/optimized-approximative-pow-in-c-and-cpp/
|
// https://martin.ankerl.com/2012/01/25/optimized-approximative-pow-in-c-and-cpp/
|
||||||
|
@ -231,6 +231,8 @@ void MqttPublishDirect(const char* topic, boolean retained)
|
|||||||
if (Settings.ledstate &0x04) {
|
if (Settings.ledstate &0x04) {
|
||||||
blinks++;
|
blinks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yield(); // #3313
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttPublish(const char* topic, boolean retained)
|
void MqttPublish(const char* topic, boolean retained)
|
||||||
|
@ -147,6 +147,8 @@ boolean ShtRead()
|
|||||||
sht_humidity = (sht_temperature - 25) * (t1 + t2 * humRaw) + rhLinear;
|
sht_humidity = (sht_temperature - 25) * (t1 + t2 * humRaw) + rhLinear;
|
||||||
sht_temperature = ConvertTemp(sht_temperature);
|
sht_temperature = ConvertTemp(sht_temperature);
|
||||||
|
|
||||||
|
SetGlobalValues(sht_temperature, sht_humidity);
|
||||||
|
|
||||||
sht_valid = SENSOR_MAX_MISS;
|
sht_valid = SENSOR_MAX_MISS;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -185,6 +185,8 @@ boolean HtuRead()
|
|||||||
htu_humidity = (-0.15) * (25 - htu_temperature) + htu_humidity;
|
htu_humidity = (-0.15) * (25 - htu_temperature) + htu_humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetGlobalValues(htu_temperature, htu_humidity);
|
||||||
|
|
||||||
htu_valid = SENSOR_MAX_MISS;
|
htu_valid = SENSOR_MAX_MISS;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -460,8 +460,7 @@ void BmpRead()
|
|||||||
}
|
}
|
||||||
if (bmp_temperature != 0.0) { bmp_temperature = ConvertTemp(bmp_temperature); }
|
if (bmp_temperature != 0.0) { bmp_temperature = ConvertTemp(bmp_temperature); }
|
||||||
|
|
||||||
glob_humidity = bmp_humidity;
|
SetGlobalValues(bmp_temperature, bmp_humidity);
|
||||||
glob_temperature = bmp_temperature;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BmpEverySecond()
|
void BmpEverySecond()
|
||||||
|
@ -102,10 +102,7 @@ void Sht3xShow(boolean json)
|
|||||||
for (byte i = 0; i < sht3x_count; i++) {
|
for (byte i = 0; i < sht3x_count; i++) {
|
||||||
if (Sht3xRead(t, h, sht3x_sensors[i].address)) {
|
if (Sht3xRead(t, h, sht3x_sensors[i].address)) {
|
||||||
|
|
||||||
if (0 == i) {
|
if (0 == i) { SetGlobalValues(t, h); }
|
||||||
glob_humidity = h;
|
|
||||||
glob_temperature = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
dtostrfd(t, Settings.flag2.temperature_resolution, temperature);
|
dtostrfd(t, Settings.flag2.temperature_resolution, temperature);
|
||||||
dtostrfd(h, Settings.flag2.humidity_resolution, humidity);
|
dtostrfd(h, Settings.flag2.humidity_resolution, humidity);
|
||||||
|
@ -62,10 +62,7 @@ void CCS811Update() // Perform every n second
|
|||||||
TVOC = ccs.getTVOC();
|
TVOC = ccs.getTVOC();
|
||||||
eCO2 = ccs.geteCO2();
|
eCO2 = ccs.geteCO2();
|
||||||
CCS811_ready = 1;
|
CCS811_ready = 1;
|
||||||
if ((glob_humidity != 0) && (glob_temperature != -9999)) {
|
if (global_update) { ccs.setEnvironmentalData((uint8_t)global_humidity, global_temperature); }
|
||||||
double gtmp = glob_temperature * 4;
|
|
||||||
ccs.setEnvironmentalData(glob_humidity, gtmp / 4);
|
|
||||||
}
|
|
||||||
ecnt = 0;
|
ecnt = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user