From 7ec39536dd4d8e59aa06c34c3112257b3f30bc0e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 25 Feb 2022 15:15:07 +0100 Subject: [PATCH] Extent number of pulsetimers Extent number of pulsetimers from 8 to 32 (#8266) --- CHANGELOG.md | 8 ++++++-- RELEASENOTES.md | 3 ++- tasmota/settings.h | 7 ++++--- tasmota/settings.ino | 3 +++ tasmota/support_command.ino | 22 ++++++++++++++++++++++ tasmota/tasmota.h | 2 +- tasmota/tasmota_version.h | 2 +- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5232de0ba..6456f2e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,14 +3,18 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Development -## [11.0.0.2] +## [11.0.0.3] ### Added ### Changed -- Enabled ethernet and Sonoff SPM in ``tasmota32.bin`` +- Extent number of pulsetimers from 8 to 32 (#8266) ### Fixed +## [11.0.0.2] 20220225 +### Changed +- Enabled ethernet and Sonoff SPM in ``tasmota32.bin`` + ## [11.0.0.1] 20220220 ### Added - Command ``SspmMap 0`` to reset Sonoff SPM default mapping diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d6120ddc3..ebea640be 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -103,7 +103,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo [Complete list](BUILDS.md) of available feature and sensors. -## Changelog v11.0.0.2 +## Changelog v11.0.0.3 ### Added - Command ``SspmMap 0`` to reset Sonoff SPM default mapping - Command ``TcpConnect `` to add client connection mode [#14874](https://github.com/arendst/Tasmota/issues/14874) @@ -118,6 +118,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo ### Changed - Adafruit BusIO library from v1.0.10 to v1.11.0 - Sonoff SPM increase max number of relays supported to 32 (8 SPM-4Relay modules) +- Extent number of pulsetimers from 8 to 32 [#8266](https://github.com/arendst/Tasmota/issues/8266) - ESP32 LVGL library from v8.1.0 to v8.2.0 - ESP32 NimBLE library from v1.3.3 to v1.3.6 - ESP32 update the internal Berry type system to sync with Skiars Berry repository. No expected impact on code, but .bec files need to be generated again [#14811](https://github.com/arendst/Tasmota/issues/14811) diff --git a/tasmota/settings.h b/tasmota/settings.h index 95c8667c1..acc48638d 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -640,15 +640,16 @@ typedef struct { uint16_t mqtt_socket_timeout; // 52E uint8_t mqtt_wifi_timeout; // 530 uint8_t ina219_mode; // 531 - uint16_t pulse_timer[MAX_PULSETIMERS]; // 532 + uint16_t ex_pulse_timer[8]; // 532 Free since 11.0.0.3 uint16_t button_debounce; // 542 uint32_t ipv4_address[5]; // 544 uint32_t ipv4_rgx_address; // 558 uint32_t ipv4_rgx_subnetmask; // 55C - uint16_t pwm_value_ext[16-5]; // 560 Extension to pwm_value to store up to 16 PWM for ESP32. This array stores values 5..15 - uint8_t free_576[70]; // 576 + uint8_t free_576[6]; // 576 + + uint16_t pulse_timer[MAX_PULSETIMERS]; // 57C SysMBitfield1 flag2; // 5BC uint32_t pulse_counter[MAX_COUNTERS]; // 5C0 uint16_t pulse_counter_type; // 5D0 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 0880721af..6897f21d3 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -1505,6 +1505,9 @@ void SettingsDelta(void) { Settings->web_time_start = 0; Settings->web_time_end = 0; } + if (Settings->version < 0x0B000003) { // 11.0.0.3 + memcpy(Settings->pulse_timer, Settings->ex_pulse_timer, 16); + } Settings->version = VERSION; SettingsSave(1); diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 881e50660..eab65bbbd 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -912,6 +912,7 @@ void CmndPowerOnState(void) void CmndPulsetime(void) { if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_PULSETIMERS)) { +/* uint32_t items = 1; if (!XdrvMailbox.usridx && !XdrvMailbox.data_len) { items = MAX_PULSETIMERS; @@ -930,6 +931,27 @@ void CmndPulsetime(void) Settings->pulse_timer[index -1], GetPulseTimer(index -1)); } ResponseJsonEnd(); +*/ + if (!XdrvMailbox.usridx && !XdrvMailbox.data_len) { + Response_P(PSTR("{\"" D_CMND_PULSETIME "\":{\"" D_JSON_SET "\":[")); + for (uint32_t i = 0; i < MAX_PULSETIMERS; i++) { + ResponseAppend_P(PSTR("%s%d"), (i)?",":"", Settings->pulse_timer[i]); + } + ResponseAppend_P(PSTR("],\"" D_JSON_REMAINING "\":[")); + for (uint32_t i = 0; i < MAX_PULSETIMERS; i++) { + ResponseAppend_P(PSTR("%s%d"), (i)?",":"", GetPulseTimer(i)); + } + ResponseAppend_P(PSTR("]}}")); + } else { + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 65536)) { + Settings->pulse_timer[XdrvMailbox.index -1] = XdrvMailbox.payload; // 0 - 65535 + SetPulseTimer(XdrvMailbox.index -1, XdrvMailbox.payload); + } + uint32_t index = XdrvMailbox.index; + Response_P(PSTR("{\"%s%d\":{\"" D_JSON_SET "\":%d,\"" D_JSON_REMAINING "\":%d}}"), + XdrvMailbox.command, index, + Settings->pulse_timer[index -1], GetPulseTimer(index -1)); + } } } diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index f5d4c2af4..c7e7939e8 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -80,7 +80,7 @@ const uint8_t MAX_PWMS_LEGACY = 5; // Max number of PWM channels in fir #endif const uint8_t MAX_COUNTERS = 4; // Max number of counter sensors const uint8_t MAX_TIMERS = 16; // Max number of Timers -const uint8_t MAX_PULSETIMERS = 8; // Max number of supported pulse timers +const uint8_t MAX_PULSETIMERS = 32; // Max number of supported pulse timers const uint8_t MAX_DOMOTICZ_IDX = 4; // Max number of Domoticz device, key and switch indices const uint8_t MAX_DOMOTICZ_SNS_IDX = 12; // Max number of Domoticz sensors indices const uint8_t MAX_KNX_GA = 10; // Max number of KNX Group Addresses to read that can be set diff --git a/tasmota/tasmota_version.h b/tasmota/tasmota_version.h index 9c994a57e..4539021bf 100644 --- a/tasmota/tasmota_version.h +++ b/tasmota/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x0B000002; // 11.0.0.2 +const uint32_t VERSION = 0x0B000003; // 11.0.0.3 #endif // _TASMOTA_VERSION_H_