Support for Sonoff iFan04-H using template (#16402)

- Bump version v14.1.0.4
This commit is contained in:
Theo Arends 2024-07-22 15:35:20 +02:00
parent 58485dec2a
commit f42e44a69d
5 changed files with 32 additions and 14 deletions

View File

@ -3,7 +3,20 @@ All notable changes to this project will be documented in this file.
## [Unreleased] - Development ## [Unreleased] - Development
## [14.1.0.3] ## [14.1.0.4]
### Added
- Support for Sonoff iFan04-H using template (#16402)
### Breaking Changed
### Changed
### Fixed
### Removed
## [14.1.0.3] 20240722
### Added ### Added
- ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase (#21695) - ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase (#21695)
- Berry `tasmota.rtc("config_time")` (#21698) - Berry `tasmota.rtc("config_time")` (#21698)
@ -20,21 +33,18 @@ All notable changes to this project will be documented in this file.
- Skip MQTT response if commands are executed prefixed with ``Backlog2`` (no delay) or ``Backlog3`` (#21740) - Skip MQTT response if commands are executed prefixed with ``Backlog2`` (no delay) or ``Backlog3`` (#21740)
- Support for Wooliis Hall Effect Coulometer or Battery capacity monitor (#21732) - Support for Wooliis Hall Effect Coulometer or Battery capacity monitor (#21732)
### Breaking Changed
### Changed ### Changed
- ESP32 support for energy margin checks, like ``MaxPower2`` per phase (#21695) - ESP32 support for energy margin checks, like ``MaxPower2`` per phase (#21695)
- ESP32 TM1621 number overflow from "9999" to "12E3" (#21131) - ESP32 TM1621 number overflow from "9999" to "12E3" (#21131)
- ESP32 platform update from 2024.06.11 to 2024.07.10 (#21745) - ESP32 platform update from 2024.06.11 to 2024.07.10 (#21745)
- ESP32 platform update from 2024.07.10 to 2024.07.11 (#21765) - ESP32 platform update from 2024.07.10 to 2024.07.11 (#21765)
- Berry simplified `module persist` - Berry simplified `module persist` (#21812)
### Fixed ### Fixed
- Berry `bytes.resize()` for large sizes (#21716) - Berry `bytes.resize()` for large sizes (#21716)
- On universal display remove default backlight power if a single PWM channel is used for backlight. Regression from 14.0.0.1 (#21726) - On universal display remove default backlight power if a single PWM channel is used for backlight. Regression from 14.0.0.1 (#21726)
- ESP32 I2S fixes (#21770) - ESP32 I2S fixes (#21770)
- ESP32 Resistive Touch xpt for 2 spi busses (#21814)
### Removed
## [14.1.0.2] 20240627 ## [14.1.0.2] 20240627
### Added ### Added

View File

@ -119,10 +119,11 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
[Complete list](BUILDS.md) of available feature and sensors. [Complete list](BUILDS.md) of available feature and sensors.
## Changelog v14.1.0.3 ## Changelog v14.1.0.4
### Added ### Added
- Support for QMP6988 temperature and pressure sensor - Support for QMP6988 temperature and pressure sensor
- Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3`` - Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3``
- Support for Sonoff iFan04-H using template [#16402](https://github.com/arendst/Tasmota/issues/16402)
- Support for Sonoff POWCT Ring [#21131](https://github.com/arendst/Tasmota/issues/21131) - Support for Sonoff POWCT Ring [#21131](https://github.com/arendst/Tasmota/issues/21131)
- Support for Wooliis Hall Effect Coulometer or Battery capacity monitor [#21732](https://github.com/arendst/Tasmota/issues/21732) - Support for Wooliis Hall Effect Coulometer or Battery capacity monitor [#21732](https://github.com/arendst/Tasmota/issues/21732)
- Skip MQTT response if command is prefixed with underscore [#21740](https://github.com/arendst/Tasmota/issues/21740) - Skip MQTT response if command is prefixed with underscore [#21740](https://github.com/arendst/Tasmota/issues/21740)
@ -165,6 +166,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- ESP32 MI32 refactoring, bugfixes, generic device scanning [#21603](https://github.com/arendst/Tasmota/issues/21603) - ESP32 MI32 refactoring, bugfixes, generic device scanning [#21603](https://github.com/arendst/Tasmota/issues/21603)
- ESP32 MI32 improve parser [#21648](https://github.com/arendst/Tasmota/issues/21648) - ESP32 MI32 improve parser [#21648](https://github.com/arendst/Tasmota/issues/21648)
- ESP32 TM1621 number overflow from "9999" to "12E3" [#21131](https://github.com/arendst/Tasmota/issues/21131) - ESP32 TM1621 number overflow from "9999" to "12E3" [#21131](https://github.com/arendst/Tasmota/issues/21131)
- Berry simplified `module persist` [#21812](https://github.com/arendst/Tasmota/issues/21812)
- Matter refactoring of bridged devices [#21575](https://github.com/arendst/Tasmota/issues/21575) - Matter refactoring of bridged devices [#21575](https://github.com/arendst/Tasmota/issues/21575)
- Matter filter suffix automatically added for sensors [#21589](https://github.com/arendst/Tasmota/issues/21589) - Matter filter suffix automatically added for sensors [#21589](https://github.com/arendst/Tasmota/issues/21589)
- Matter support for Rain sensor [#21633](https://github.com/arendst/Tasmota/issues/21633) - Matter support for Rain sensor [#21633](https://github.com/arendst/Tasmota/issues/21633)
@ -176,6 +178,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Scripter TCP server [#21660](https://github.com/arendst/Tasmota/issues/21660) - Scripter TCP server [#21660](https://github.com/arendst/Tasmota/issues/21660)
- ESP32 allow use of UART0 with enabled USB_CDC_CONSOLE [#21496](https://github.com/arendst/Tasmota/issues/21496) - ESP32 allow use of UART0 with enabled USB_CDC_CONSOLE [#21496](https://github.com/arendst/Tasmota/issues/21496)
- ESP32 I2S fixes [#21770](https://github.com/arendst/Tasmota/issues/21770) - ESP32 I2S fixes [#21770](https://github.com/arendst/Tasmota/issues/21770)
- ESP32 Resistive Touch xpt for 2 spi busses [#21814](https://github.com/arendst/Tasmota/issues/21814)
- Berry `input()` returns empty string and does not crash [#21565](https://github.com/arendst/Tasmota/issues/21565) - Berry `input()` returns empty string and does not crash [#21565](https://github.com/arendst/Tasmota/issues/21565)
- Berry `bytes.resize()` for large sizes [#21716](https://github.com/arendst/Tasmota/issues/21716) - Berry `bytes.resize()` for large sizes [#21716](https://github.com/arendst/Tasmota/issues/21716)
- Matter interverted attributes 0xFFF9 and 0xFFFB [#21636](https://github.com/arendst/Tasmota/issues/21636) - Matter interverted attributes 0xFFF9 and 0xFFFB [#21636](https://github.com/arendst/Tasmota/issues/21636)

View File

@ -232,7 +232,7 @@ enum ProgramSelectablePins {
GPIO_USER, // User configurable needs to be 2047 GPIO_USER, // User configurable needs to be 2047
GPIO_MAX }; GPIO_MAX };
#define MAX_OPTIONS_A 7 // Increase if more bits are used from GpioOptionABits #define MAX_OPTIONS_A 8 // Increase if more bits are used from GpioOptionABits
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful... typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
uint32_t data; // Allow bit manipulation using SetOption uint32_t data; // Allow bit manipulation using SetOption
@ -244,7 +244,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t rotary_mi_desk : 1; // bit 4 (v9.5.0.5) - Option_A5 - (Rotary) Enable Mi Desk emulation uint32_t rotary_mi_desk : 1; // bit 4 (v9.5.0.5) - Option_A5 - (Rotary) Enable Mi Desk emulation
uint32_t linkind_support : 1; // bit 5 (v10.1.0.4) - Option_A6 - (Light) LinkInd support uint32_t linkind_support : 1; // bit 5 (v10.1.0.4) - Option_A6 - (Light) LinkInd support
uint32_t shelly_pro : 1; // bit 6 (v12.2.0.1) - Option_A7 - (Device) Shelly Pro uint32_t shelly_pro : 1; // bit 6 (v12.2.0.1) - Option_A7 - (Device) Shelly Pro
uint32_t spare07 : 1; // bit 7 uint32_t ifan04_h : 1; // bit 7 (v14.1.0.4) - Option_A8 - (Device) Sonoff ifan04-H
uint32_t spare08 : 1; // bit 8 uint32_t spare08 : 1; // bit 8
uint32_t spare09 : 1; // bit 9 uint32_t spare09 : 1; // bit 9
uint32_t spare10 : 1; // bit 10 uint32_t spare10 : 1; // bit 10

View File

@ -22,6 +22,6 @@
#define TASMOTA_SHA_SHORT // Filled by Github sed #define TASMOTA_SHA_SHORT // Filled by Github sed
const uint32_t TASMOTA_VERSION = 0x0E010003; // 14.1.0.3 const uint32_t TASMOTA_VERSION = 0x0E010004; // 14.1.0.4
#endif // _TASMOTA_VERSION_H_ #endif // _TASMOTA_VERSION_H_

View File

@ -1,5 +1,5 @@
/* /*
xdrv_22_sonoff_ifan.ino - sonoff iFan02 and iFan03 support for Tasmota xdrv_22_sonoff_ifan.ino - sonoff iFan02, iFan03 and iFan04 support for Tasmota
Copyright (C) 2021 Theo Arends Copyright (C) 2021 Theo Arends
@ -19,7 +19,10 @@
#ifdef USE_SONOFF_IFAN #ifdef USE_SONOFF_IFAN
/*********************************************************************************************\ /*********************************************************************************************\
Sonoff iFan02 and iFan03 * Sonoff iFan02, iFan03 and iFan04
*
* For iFan04 activate below template
* {"NAME":"Sonoff iFan04-H","GPIO":[32,3200,5735,3232,0,0,256,512,226,320,225,227,0,0],"FLAG":0,"BASE":71}
\*********************************************************************************************/ \*********************************************************************************************/
#define XDRV_22 22 #define XDRV_22 22
@ -28,7 +31,9 @@ const uint8_t MAX_FAN_SPEED = 4; // Max number of iFan02 fan speeds (
const uint8_t kIFan02Speed[MAX_FAN_SPEED] = { 0x00, 0x01, 0x03, 0x05 }; const uint8_t kIFan02Speed[MAX_FAN_SPEED] = { 0x00, 0x01, 0x03, 0x05 };
const uint8_t kIFan03Speed[MAX_FAN_SPEED +2] = { 0x00, 0x01, 0x03, 0x04, 0x05, 0x06 }; const uint8_t kIFan03Speed[MAX_FAN_SPEED +2] = { 0x00, 0x01, 0x03, 0x04, 0x05, 0x06 };
const uint8_t kIFan04Speed[MAX_FAN_SPEED +2] = { 0x00, 0x01, 0x02, 0x04, 0x05, 0x06 };
const uint8_t kIFan03Sequence[MAX_FAN_SPEED][MAX_FAN_SPEED] = {{0, 2, 2, 2}, {0, 1, 2, 4}, {1, 1, 2, 5}, {4, 4, 5, 3}}; const uint8_t kIFan03Sequence[MAX_FAN_SPEED][MAX_FAN_SPEED] = {{0, 2, 2, 2}, {0, 1, 2, 4}, {1, 1, 2, 5}, {4, 4, 5, 3}};
const uint8_t kIFan04Sequence[MAX_FAN_SPEED][MAX_FAN_SPEED] = {{0, 4, 5, 3}, {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 4, 5, 3}};
const char kSonoffIfanCommands[] PROGMEM = "|" // No prefix const char kSonoffIfanCommands[] PROGMEM = "|" // No prefix
D_CMND_FANSPEED; D_CMND_FANSPEED;
@ -84,7 +89,7 @@ void SonoffIFanSetFanspeed(uint8_t fanspeed, bool sequence)
uint8_t fans = kIFan02Speed[fanspeed]; uint8_t fans = kIFan02Speed[fanspeed];
if (SONOFF_IFAN03 == TasmotaGlobal.module_type) { if (SONOFF_IFAN03 == TasmotaGlobal.module_type) {
if (sequence) { if (sequence) {
fanspeed = kIFan03Sequence[fanspeed_now][ifan_fanspeed_goal]; fanspeed = (TasmotaGlobal.gpio_optiona.ifan04_h) ? kIFan04Sequence[fanspeed_now][ifan_fanspeed_goal] : kIFan03Sequence[fanspeed_now][ifan_fanspeed_goal];
if (fanspeed != ifan_fanspeed_goal) { if (fanspeed != ifan_fanspeed_goal) {
if (0 == fanspeed_now) { if (0 == fanspeed_now) {
ifan_fanspeed_timer = 20; // Need extra time to power up fan ifan_fanspeed_timer = 20; // Need extra time to power up fan
@ -93,7 +98,7 @@ void SonoffIFanSetFanspeed(uint8_t fanspeed, bool sequence)
} }
} }
} }
fans = kIFan03Speed[fanspeed]; fans = (TasmotaGlobal.gpio_optiona.ifan04_h) ? kIFan04Speed[fanspeed] : kIFan03Speed[fanspeed];
} }
for (uint32_t i = 2; i < 5; i++) { for (uint32_t i = 2; i < 5; i++) {
uint8_t state = (fans &1) + POWER_OFF_NO_STATE; // Add no publishPowerState uint8_t state = (fans &1) + POWER_OFF_NO_STATE; // Add no publishPowerState