From 70a4fbd800ddc6bca5784a8e5229d7d9009395cf Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:22:41 +0100 Subject: [PATCH] Add command ``SetOption159 1`` to enable counting on both rising and falling edge (#20712) --- CHANGELOG.md | 3 ++- RELEASENOTES.md | 3 ++- tasmota/include/tasmota_types.h | 4 ++-- tasmota/tasmota_xsns_sensor/xsns_01_counter.ino | 8 ++++++-- tools/decode-status.py | 5 +++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e792c4df..b8d70f9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,10 @@ All notable changes to this project will be documented in this file. ## [13.3.0.5] 20240214 ### Added - Internal support for persistent JSON settings using single file -- Command ``SetOption158`` to publish or suppress ModbusReceived MQTT messages (#20678) +- Command ``SetOption158 1`` to disable publish of ModbusReceived MQTT messages (#20678) - ESP32 Core3 support for SPI ethernet on DM9051, W5500 and KSZ8851 - Berry option to invert serial +- Command ``SetOption159 1`` to enable counting on both rising and falling edge (#20712) ### Breaking Changed - ESP32 LVGL library from v8.3.11 to v9.0.0, some small breaking changes in C, none in HASPmota (#20659) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 6fab9db0f..f8c5492bf 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -119,7 +119,8 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ## Changelog v13.3.0.5 ### Added - Command ``TimedPower [,ON|OFF|TOGGLE|BLINK]`` executes ``Power [ON|OFF|TOGGLE|BLINK] `` and after executes ``Power [OFF|ON|TOGGLE|OFF]`` -- Command ``SetOption158`` to publish or suppress ModbusReceived MQTT messages [#20678](https://github.com/arendst/Tasmota/issues/20678) +- Command ``SetOption158 1`` to disable publish of ModbusReceived MQTT messages [#20678](https://github.com/arendst/Tasmota/issues/20678) +- Command ``SetOption159 1`` to enable counting on both rising and falling edge [#20712](https://github.com/arendst/Tasmota/issues/20712) - Display of active drivers using command ``status 4`` - GPIO Viewer to see realtime GPIO states using assets from `https://ota.tasmota.com/tasmota/gpioviewer/gpio_viewer_13_4_0/` v2.0.8 - Support for CST816S touch interface [#20213](https://github.com/arendst/Tasmota/issues/20213) diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index 1a37f6033..a415c847a 100755 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -191,8 +191,8 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t zcfallingedge : 1; // bit 9 (v13.0.0.1) - SetOption155 - (ZCDimmer) Enable rare falling Edge dimmer instead of leading edge uint32_t sen5x_passive_mode : 1; // bit 10 (v13.1.0.1) - SetOption156 - (Sen5x) Run in passive mode when there is another I2C master (e.g. Ikea Vindstyrka), i.e. do not set up Sen5x sensor, higher polling interval uint32_t neopool_outputsensitive : 1; // bit 11 (v13.2.0.1) - SetOption157 - (NeoPool) Output sensitive data (1) - uint32_t mqtt_disable_modbus : 1; // bit 12 (v13.3.0.5) - SetOption158 - (MQTT) Disable publish ModbusReceived MQTT messages, you must use event trigger rules instead - uint32_t spare13 : 1; // bit 13 + uint32_t mqtt_disable_modbus : 1; // bit 12 (v13.3.0.5) - SetOption158 - (MQTT) Disable publish ModbusReceived MQTT messages (1), you must use event trigger rules instead + uint32_t counter_both_edges : 1; // bit 13 (v13.3.0.5) - SetOption159 - (Counter) Enable counting on both rising and falling edge (1) uint32_t spare14 : 1; // bit 14 uint32_t spare15 : 1; // bit 15 uint32_t spare16 : 1; // bit 16 diff --git a/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino b/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino index 245055c60..1483dd788 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino @@ -77,9 +77,13 @@ void CounterIsrArg(void *arg) { // restart PWM each second (german 50Hz has to up to 0.01% deviation) // restart initiated by setting Counter.startReSync = true; #ifdef USE_AC_ZERO_CROSS_DIMMER - if (index == 3) ACDimmerZeroCross(time); -#endif //USE_AC_ZERO_CROSS_DIMMER + if (index == 3) { ACDimmerZeroCross(time); } return; +#else + if (!Settings->flag6.counter_both_edges) { // SetOption159 - (Counter) Enable counting on both rising and falling edge (1) + return; + } +#endif //USE_AC_ZERO_CROSS_DIMMER } } diff --git a/tools/decode-status.py b/tools/decode-status.py index c6de2333d..980c00e64 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -213,8 +213,9 @@ a_setoption = [[ "(ZCDimmer) Enable rare falling Edge dimmer instead of leading edge", "(Sen5x) Run in passive mode when there is another I2C master (e.g. Ikea Vindstyrka), i.e. do not set up Sen5x sensor, higher polling interval", "(NeoPool) Output sensitive data (1)", - "(MQTT) Disable publish ModbusReceived MQTT messages, you must use event trigger rules instead", - "","","", + "(MQTT) Disable publish ModbusReceived MQTT messages (1), you must use event trigger rules instead", + "(Counter) Enable counting on both rising and falling edge (1)", + "","", "","","","", "","","","", "","","","",