mirror of https://github.com/arendst/Tasmota.git
Merge branch 'arendst:development' into rgx-port-forward-for-esp8266-too
This commit is contained in:
commit
ffac19855b
|
@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## [12.2.0.5]
|
||||
### Added
|
||||
- ESP32 DS18x20 parasitic power usage when defining W1_PARASITE_POWER (#17112)
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||
- Berry ``bytes().reverse()`` method [#16977](https://github.com/arendst/Tasmota/issues/16977)
|
||||
- Zigbee router firmware for Sonoff ZBBridgePro [#16900](https://github.com/arendst/Tasmota/issues/16900)
|
||||
- ESP32 Support for DMX ArtNet Led matrix animations [#16984](https://github.com/arendst/Tasmota/issues/16984)
|
||||
- ESP32 DS18x20 parasitic power usage when defining W1_PARASITE_POWER [#17112](https://github.com/arendst/Tasmota/issues/17112)
|
||||
|
||||
### Breaking Changed
|
||||
- Redesign distance sensors VL53LXX, TOF10120, HRXL and DYP to use cm instead of mm [#17021](https://github.com/arendst/Tasmota/issues/17021)
|
||||
|
|
|
@ -365,6 +365,8 @@ void Energy200ms(void)
|
|||
Energy.kWhtoday[i] = 0;
|
||||
Energy.kWhtoday_offset[i] = 0;
|
||||
RtcSettings.energy_kWhtoday_ph[i] = 0;
|
||||
Settings->energy_kWhtoday_ph[i] = 0;
|
||||
|
||||
Energy.start_energy[i] = 0;
|
||||
// Energy.kWhtoday_delta = 0; // dont zero this, we need to carry the remainder over to tomorrow
|
||||
Energy.daily_sum_import_balanced = 0.0;
|
||||
|
|
|
@ -750,18 +750,19 @@ void EnergyModbusShow(bool json) {
|
|||
values[j] = NrgMbsUser[i].data[j];
|
||||
}
|
||||
uint32_t resolution = EnergyModbusResolution(NrgMbsUser[i].resolution);
|
||||
uint32_t single = (!isnan(NrgMbsUser[i].data[1]) && !isnan(NrgMbsUser[i].data[2])) ? 0 : 1;
|
||||
|
||||
#ifdef ENERGY_MODBUS_DEBUG_SHOW
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: resolution %d -> %d"), NrgMbsUser[i].resolution, resolution);
|
||||
#endif
|
||||
|
||||
if (json) {
|
||||
ResponseAppend_P(PSTR(",\"%s\":%s"), NrgMbsUser[i].json_name, EnergyFormat(value_chr, values, resolution));
|
||||
ResponseAppend_P(PSTR(",\"%s\":%s"), NrgMbsUser[i].json_name, EnergyFormat(value_chr, values, resolution, single));
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(PSTR("{s}%s{m}%s %s{e}"),
|
||||
NrgMbsUser[i].gui_name,
|
||||
WebEnergyFormat(value_chr, values, resolution),
|
||||
WebEnergyFormat(value_chr, values, resolution, single),
|
||||
NrgMbsUser[i].gui_unit);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
|
|
|
@ -51,6 +51,9 @@ const char kDs18x20Types[] PROGMEM = "DS18x20|DS18S20|DS1822|DS18B20|MAX31850";
|
|||
uint8_t ds18x20_chipids[] = { 0, DS18S20_CHIPID, DS1822_CHIPID, DS18B20_CHIPID, MAX31850_CHIPID };
|
||||
|
||||
struct {
|
||||
#ifdef W1_PARASITE_POWER
|
||||
float temperature;
|
||||
#endif
|
||||
float temp_sum;
|
||||
uint16_t numread;
|
||||
uint8_t address[8];
|
||||
|
@ -130,9 +133,15 @@ void Ds18x20Convert(void) {
|
|||
for (uint32_t i = 0; i < DS18X20Data.gpios; i++) {
|
||||
ds = ds18x20_gpios[i];
|
||||
ds->reset();
|
||||
#ifdef W1_PARASITE_POWER
|
||||
// With parasite power held wire high at the end for parasitically powered devices
|
||||
ds->write(W1_SKIP_ROM, 1); // Address all Sensors on Bus
|
||||
ds->write(W1_CONVERT_TEMP, 1); // start conversion, no parasite power on at the end
|
||||
#else
|
||||
ds->write(W1_SKIP_ROM); // Address all Sensors on Bus
|
||||
ds->write(W1_CONVERT_TEMP); // start conversion, no parasite power on at the end
|
||||
// delay(750); // 750ms should be enough for 12bit conv
|
||||
#endif
|
||||
// delay(750); // 750ms should be enough for 12bit conv
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +156,12 @@ bool Ds18x20Read(uint8_t sensor, float &t) {
|
|||
ds = ds18x20_gpios[ds18x20_sensor[index].pins_id];
|
||||
ds->reset();
|
||||
ds->select(ds18x20_sensor[index].address);
|
||||
#ifdef W1_PARASITE_POWER
|
||||
// With parasite power held wire high at the end for parasitically powered devices
|
||||
ds->write(W1_READ_SCRATCHPAD, 1); // Read Scratchpad
|
||||
#else
|
||||
ds->write(W1_READ_SCRATCHPAD); // Read Scratchpad
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i < 9; i++) {
|
||||
data[i] = ds->read();
|
||||
|
@ -157,6 +171,9 @@ bool Ds18x20Read(uint8_t sensor, float &t) {
|
|||
case DS18S20_CHIPID: {
|
||||
int16_t tempS = (((data[1] << 8) | (data[0] & 0xFE)) << 3) | ((0x10 - data[6]) & 0x0F);
|
||||
t = ConvertTemp(tempS * 0.0625f - 0.250f);
|
||||
#ifdef W1_PARASITE_POWER
|
||||
ds18x20_sensor[index].temperature = t;
|
||||
#endif
|
||||
ds18x20_sensor[index].valid = SENSOR_MAX_MISS;
|
||||
return true;
|
||||
}
|
||||
|
@ -168,12 +185,18 @@ bool Ds18x20Read(uint8_t sensor, float &t) {
|
|||
sign = -1;
|
||||
}
|
||||
t = ConvertTemp(sign * temp12 * 0.0625f); // Divide by 16
|
||||
#ifdef W1_PARASITE_POWER
|
||||
ds18x20_sensor[index].temperature = t;
|
||||
#endif
|
||||
ds18x20_sensor[index].valid = SENSOR_MAX_MISS;
|
||||
return true;
|
||||
}
|
||||
case MAX31850_CHIPID: {
|
||||
int16_t temp14 = (data[1] << 8) + (data[0] & 0xFC);
|
||||
t = ConvertTemp(temp14 * 0.0625f); // Divide by 16
|
||||
#ifdef W1_PARASITE_POWER
|
||||
ds18x20_sensor[index].temperature = t;
|
||||
#endif
|
||||
ds18x20_sensor[index].valid = SENSOR_MAX_MISS;
|
||||
return true;
|
||||
}
|
||||
|
@ -244,7 +267,13 @@ void Ds18x20Show(bool json) {
|
|||
|
||||
uint8_t dsxflg = 0;
|
||||
for (uint32_t i = 0; i < DS18X20Data.sensors; i++) {
|
||||
#ifdef W1_PARASITE_POWER
|
||||
// With parasite power read one sensor at a time
|
||||
if (ds18x20_sensor[i].valid) {
|
||||
t = ds18x20_sensor[i].temperature;
|
||||
#else
|
||||
if (Ds18x20Read(i, t)) { // Check if read failed
|
||||
#endif
|
||||
Ds18x20Name(i);
|
||||
|
||||
if (json) {
|
||||
|
|
Loading…
Reference in New Issue