mirror of https://github.com/arendst/Tasmota.git
Fixed PCF8574 mode 1
- Fixed PCF8574 mode 1 with base relays exception 3/28 regression from v12.4.0.4 (#19408) - Bump version v13.1.0.2
This commit is contained in:
parent
2bae1f4368
commit
48cf04db3a
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -3,14 +3,24 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## [Unreleased] - Development
|
||||
|
||||
## [13.1.0.1]
|
||||
## [13.1.0.2]
|
||||
### Added
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
- PCF8574 mode 1 with base relays exception 3/28 regression from v12.4.0.4 (#19408)
|
||||
|
||||
### Removed
|
||||
|
||||
## [13.1.0.1] 20230831
|
||||
### Added
|
||||
- Commands to allow setting of timeprop parameters (#19310)
|
||||
- Variables ``%power<1..28>%`` and ``%switch<1..28>%`` to rules (#19331)
|
||||
- Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3.0
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
### Changed
|
||||
- Display invert setting after tasmota start in uDisplay driver (#19337)
|
||||
|
||||
|
@ -19,9 +29,6 @@ All notable changes to this project will be documented in this file.
|
|||
- Teleinfo power (#19381)
|
||||
- Exception 3 in IRHVAC (#19389)
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
## [Released] - Development
|
||||
|
||||
## [13.1.0] 20230815
|
||||
|
|
|
@ -110,7 +110,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
|||
|
||||
[Complete list](BUILDS.md) of available feature and sensors.
|
||||
|
||||
## Changelog v13.1.0.1
|
||||
## Changelog v13.1.0.2
|
||||
### Added
|
||||
- Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3.0
|
||||
- Commands to allow setting of timeprop parameters [#19310](https://github.com/arendst/Tasmota/issues/19310)
|
||||
|
@ -125,5 +125,6 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
|||
- Shutter invert [#19341](https://github.com/arendst/Tasmota/issues/19341) and [#19374](https://github.com/arendst/Tasmota/issues/19374)
|
||||
- Teleinfo power [#19381](https://github.com/arendst/Tasmota/issues/19381)
|
||||
- Exception 3 in IRHVAC [#19389](https://github.com/arendst/Tasmota/issues/19389)
|
||||
- PCF8574 mode 1 with base relays exception 3/28 regression from v12.4.0.4 [#19408](https://github.com/arendst/Tasmota/issues/19408)
|
||||
|
||||
### Removed
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
#ifndef _TASMOTA_VERSION_H_
|
||||
#define _TASMOTA_VERSION_H_
|
||||
|
||||
const uint32_t VERSION = 0x0D010001; // 13.1.0.1
|
||||
const uint32_t VERSION = 0x0D010002; // 13.1.0.2
|
||||
|
||||
#endif // _TASMOTA_VERSION_H_
|
||||
|
|
|
@ -425,14 +425,15 @@ bool Pcf8574AddSwitch(void) {
|
|||
\*********************************************************************************************/
|
||||
|
||||
void Pcf8574SwitchRelay(void) {
|
||||
for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) {
|
||||
uint8_t relay_state = bitRead(XdrvMailbox.index, i);
|
||||
uint32_t devices_present = TasmotaGlobal.devices_present - Pcf8574.relay_offset;
|
||||
for (uint32_t i = 0; i < devices_present; i++) {
|
||||
uint8_t relay_state = bitRead(XdrvMailbox.index, Pcf8574.relay_offset + i);
|
||||
|
||||
if (Pcf8574.max_devices > 0 && Pcf8574_pin[i] < 99) {
|
||||
uint8_t board = Pcf8574_pin[i]>>3;
|
||||
uint8_t pin = Pcf8574_pin[i]&0x7;
|
||||
uint8_t oldpinmask = Pcf8574.pin_mask[board];
|
||||
uint8_t _val = bitRead(TasmotaGlobal.rel_inverted, i) ? !relay_state : relay_state;
|
||||
uint8_t _val = bitRead(TasmotaGlobal.rel_inverted, Pcf8574.relay_offset + i) ? !relay_state : relay_state;
|
||||
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: SwitchRelay %d=%d => PCF-%d.D%d=%d"), i, relay_state, board +1, pin, _val);
|
||||
bitWrite(Pcf8574.pin_mask[board], pin, _val);
|
||||
|
@ -485,9 +486,10 @@ void Pcf8574ModuleInitMode1(void) {
|
|||
|
||||
for (uint32_t i = 0; i < 8; i++, gpio>>=1) {
|
||||
uint8_t _result = Settings->pcf8574_config[idx] >> i &1;
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: I2C shift i %d: %d. Powerstate: %d, TasmotaGlobal.devices_present: %d"), i,_result, Settings->power>>i&1, TasmotaGlobal.devices_present);
|
||||
uint32_t devices_present = TasmotaGlobal.devices_present - Pcf8574.relay_offset;
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: I2C shift i %d: %d. Powerstate: %d, devices_present: %d"), i,_result, Settings->power>>i&1, devices_present);
|
||||
if (_result > 0) {
|
||||
Pcf8574_pin[TasmotaGlobal.devices_present] = i + 8 * idx;
|
||||
Pcf8574_pin[devices_present] = i + 8 * idx;
|
||||
bitWrite(TasmotaGlobal.rel_inverted, TasmotaGlobal.devices_present, Settings->flag3.pcf8574_ports_inverted); // SetOption81 - Invert all ports on PCF8574 devices
|
||||
if (!Settings->flag.save_state && !Settings->flag3.no_power_feedback) { // SetOption63 - Don't scan relay power state at restart - #5594 and #5663
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("PCF: Set power from from chip state"));
|
||||
|
@ -575,7 +577,8 @@ void Pcf8574SaveSettings(void) {
|
|||
n = n&(n-1);
|
||||
count++;
|
||||
}
|
||||
if (count <= TasmotaGlobal.devices_present) {
|
||||
uint32_t devices_present = TasmotaGlobal.devices_present - Pcf8574.relay_offset;
|
||||
if (count <= devices_present) {
|
||||
UpdateDevicesPresent(-count);
|
||||
}
|
||||
for (byte i = 0; i < 8; i++) {
|
||||
|
@ -662,12 +665,12 @@ void Pcf8574ModuleInit(void) {
|
|||
if (Pcf8574.mode) {
|
||||
Pcf8574_pin = (uint16_t*)malloc(Pcf8574.max_connected_ports * sizeof(uint16_t));
|
||||
if (Pcf8574_pin) {
|
||||
Pcf8574.relay_offset = TasmotaGlobal.devices_present;
|
||||
#ifdef USE_PCF8574_MODE2
|
||||
if (Pcf8574LoadTemplate()) {
|
||||
Pcf8574.mode = 2;
|
||||
Pcf8574.button_offset = -1;
|
||||
Pcf8574.switch_offset = -1;
|
||||
Pcf8574.relay_offset = TasmotaGlobal.devices_present;
|
||||
Pcf8574.relay_max -= UpdateDevicesPresent(Pcf8574.relay_max);
|
||||
} else
|
||||
#endif // USE_PCF8574_MODE2
|
||||
|
|
Loading…
Reference in New Issue