ESP32 increase number of relay GPIOs from 8 to 28

This commit is contained in:
Theo Arends 2021-02-04 17:06:45 +01:00
parent bfde36e954
commit d5542b1a66
6 changed files with 25 additions and 13 deletions

View File

@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file.
## [Unreleased] - Development ## [Unreleased] - Development
## [9.2.0.4] ## [9.2.0.5]
### Changed
- ESP32 increase number of relay GPIOs from 8 to 28
## [9.2.0.4] 20210204
### Added ### Added
- Function ``AddLog`` to provide logging for up to 128 (LOGSZ) characters to save stack space - Function ``AddLog`` to provide logging for up to 128 (LOGSZ) characters to save stack space
- Commands ``ChannelRemap``, ``MultiPWM``, ``AlexaCTRange``, ``PowerOnFade``, ``PWMCT``, ``WhiteBlend`` and ``VirtualCT`` as synonyms for ``SetOption37, 68, 82, 91, 92, 105`` and ``106`` - Commands ``ChannelRemap``, ``MultiPWM``, ``AlexaCTRange``, ``PowerOnFade``, ``PWMCT``, ``WhiteBlend`` and ``VirtualCT`` as synonyms for ``SetOption37, 68, 82, 91, 92, 105`` and ``106``

View File

@ -56,7 +56,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
[Complete list](BUILDS.md) of available feature and sensors. [Complete list](BUILDS.md) of available feature and sensors.
## Changelog v9.2.0.4 ## Changelog v9.2.0.5
### Added ### Added
- Command ``CTRange`` to specify the visible CT range the bulb is capable of [#10311](https://github.com/arendst/Tasmota/issues/10311) - Command ``CTRange`` to specify the visible CT range the bulb is capable of [#10311](https://github.com/arendst/Tasmota/issues/10311)
- Command ``L1MusicSync <0|Off>|<1|On>|<2|Toggle>, 1..10, 1..100>`` to control Sonoff L1 Music Sync mode sensitivity and speed [#10722](https://github.com/arendst/Tasmota/issues/10722) - Command ``L1MusicSync <0|Off>|<1|On>|<2|Toggle>, 1..10, 1..100>`` to control Sonoff L1 Music Sync mode sensitivity and speed [#10722](https://github.com/arendst/Tasmota/issues/10722)
@ -120,6 +120,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Force initial default state ``SetOption57 1`` to scan wifi network every 44 minutes for strongest signal [#10395](https://github.com/arendst/Tasmota/issues/10395) - Force initial default state ``SetOption57 1`` to scan wifi network every 44 minutes for strongest signal [#10395](https://github.com/arendst/Tasmota/issues/10395)
- PubSubClient MQTT_SOCKET_TIMEOUT from 15 to 4 seconds - PubSubClient MQTT_SOCKET_TIMEOUT from 15 to 4 seconds
- Domoticz fixed 2 decimals resolution by user selectable ``TempRes``, ``HumRes`` and ``PressRes`` resolutions - Domoticz fixed 2 decimals resolution by user selectable ``TempRes``, ``HumRes`` and ``PressRes`` resolutions
- ESP32 increase number of relay GPIOs from 8 to 28
### Fixed ### Fixed
- Redesign syslog and mqttlog using log buffer [#10164](https://github.com/arendst/Tasmota/issues/10164) - Redesign syslog and mqttlog using log buffer [#10164](https://github.com/arendst/Tasmota/issues/10164)

View File

@ -48,9 +48,16 @@ const uint32_t POWER_MASK = 0xffffffffUL; // Power (Relay) full mask
* Constants * Constants
\*********************************************************************************************/ \*********************************************************************************************/
#ifdef ESP8266
const uint8_t MAX_RELAYS = 8; // Max number of relays
#endif // ESP8266
#ifdef ESP32
const uint8_t MAX_RELAYS = 28; // Max number of relays
#endif // ESP32
// Changes to the following MAX_ defines will impact settings layout // Changes to the following MAX_ defines will impact settings layout
const uint8_t MAX_SWITCHES = 8; // Max number of switches const uint8_t MAX_SWITCHES = 8; // Max number of switches
const uint8_t MAX_RELAYS = 8; // Max number of relays const uint8_t MAX_SHUTTER_RELAYS = 8; // Max number of shutter relays
const uint8_t MAX_INTERLOCKS = 4; // Max number of interlock groups (MAX_RELAYS / 2) const uint8_t MAX_INTERLOCKS = 4; // Max number of interlock groups (MAX_RELAYS / 2)
const uint8_t MAX_LEDS = 4; // Max number of leds const uint8_t MAX_LEDS = 4; // Max number of leds
const uint8_t MAX_KEYS = 4; // Max number of keys or buttons const uint8_t MAX_KEYS = 4; // Max number of keys or buttons

View File

@ -20,6 +20,6 @@
#ifndef _TASMOTA_VERSION_H_ #ifndef _TASMOTA_VERSION_H_
#define _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_
const uint32_t VERSION = 0x09020004; const uint32_t VERSION = 0x09020005;
#endif // _TASMOTA_VERSION_H_ #endif // _TASMOTA_VERSION_H_

View File

@ -1447,8 +1447,8 @@ void HandleTemplateConfiguration(void)
for (uint32_t i = 0; i < MAX_GPIO_PIN; i++) { for (uint32_t i = 0; i < MAX_GPIO_PIN; i++) {
if (!FlashPin(i)) { if (!FlashPin(i)) {
WSContentSend_P(PSTR("<tr><td><b><font color='#%06x'>" D_GPIO "%d</font></b></td><td%s><select id='g%d' onchange='ot(%d,this.value)'></select></td>"), WSContentSend_P(PSTR("<tr><td><b><font color='#%06x'>" D_GPIO "%d</font></b></td><td%s><select id='g%d' onchange='ot(%d,this.value)'></select></td>"),
((9==i)||(10==i)) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:150px'") : "", i, i); ((9==i)||(10==i)) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:146px'") : "", i, i);
WSContentSend_P(PSTR("<td style='width:50px'><select id='h%d'></select></td></tr>"), i); WSContentSend_P(PSTR("<td style='width:54px'><select id='h%d'></select></td></tr>"), i);
} }
} }
WSContentSend_P(PSTR("</table>")); WSContentSend_P(PSTR("</table>"));
@ -1566,9 +1566,9 @@ void HandleModuleConfiguration(void)
for (uint32_t i = 0; i < ARRAY_SIZE(template_gp.io); i++) { for (uint32_t i = 0; i < ARRAY_SIZE(template_gp.io); i++) {
if (ValidGPIO(i, template_gp.io[i])) { if (ValidGPIO(i, template_gp.io[i])) {
snprintf_P(stemp, 3, PINS_WEMOS +i*2); snprintf_P(stemp, 3, PINS_WEMOS +i*2);
WSContentSend_P(PSTR("<tr><td style='width:116px'>%s <b>" D_GPIO "%d</b></td><td style='width:150px'><select id='g%d' onchange='ot(%d,this.value)'></select></td>"), WSContentSend_P(PSTR("<tr><td style='width:116px'>%s <b>" D_GPIO "%d</b></td><td style='width:146px'><select id='g%d' onchange='ot(%d,this.value)'></select></td>"),
(WEMOS==TasmotaGlobal.module_type)?stemp:"", i, i, i); (WEMOS==TasmotaGlobal.module_type)?stemp:"", i, i, i);
WSContentSend_P(PSTR("<td style='width:50px'><select id='h%d'></select></td></tr>"), i); WSContentSend_P(PSTR("<td style='width:54px'><select id='h%d'></select></td></tr>"), i);
} }
} }
WSContentSend_P(PSTR("</table>")); WSContentSend_P(PSTR("</table>"));

View File

@ -209,8 +209,8 @@ typedef struct HASS {
void HassDiscoveryRelays(struct HASS &Hass) void HassDiscoveryRelays(struct HASS &Hass)
{ {
Hass = {.Relay={0,0,0,0,0,0,0,0}, .RelLst={'\0'}}; Hass = {.Relay={0,0,0,0,0,0,0,0}, .RelLst={'\0'}};
uint16_t Shutter[8] = {0,0,0,0,0,0,0,0}; // Array to store a temp list for shutters uint16_t Shutter[MAX_RELAYS] = { 0 }; // Array to store a temp list for shutters
uint8_t lightidx = MAX_RELAYS + 1; // Will store the starting position of the lights uint8_t lightidx = MAX_RELAYS + 1; // Will store the starting position of the lights
bool iFan = false; bool iFan = false;
Hass.RelPst = TasmotaGlobal.devices_present > 0; Hass.RelPst = TasmotaGlobal.devices_present > 0;
@ -241,7 +241,7 @@ void HassDiscoveryRelays(struct HASS &Hass)
if (0 == Settings.shutter_startrelay[k]) { if (0 == Settings.shutter_startrelay[k]) {
break; break;
} else { } else {
if (Settings.shutter_startrelay[k] > 0 && Settings.shutter_startrelay[k] <= MAX_RELAYS) { if (Settings.shutter_startrelay[k] > 0 && Settings.shutter_startrelay[k] <= MAX_SHUTTER_RELAYS) {
Shutter[Settings.shutter_startrelay[k]-1] = Shutter[Settings.shutter_startrelay[k]] = 1; Shutter[Settings.shutter_startrelay[k]-1] = Shutter[Settings.shutter_startrelay[k]] = 1;
} }
} }
@ -429,7 +429,7 @@ void HAssAnnounceRelayLight(void)
#ifdef USE_SHUTTER #ifdef USE_SHUTTER
if (Settings.flag3.shutter_mode) { if (Settings.flag3.shutter_mode) {
for (uint32_t i = 0; i < MAX_SHUTTERS; i++) { for (uint32_t i = 0; i < MAX_SHUTTERS; i++) {
if (Settings.shutter_startrelay[i] > 0 && Settings.shutter_startrelay[i] <= MAX_RELAYS) { if (Settings.shutter_startrelay[i] > 0 && Settings.shutter_startrelay[i] <= MAX_SHUTTER_RELAYS) {
bitSet(shutter_mask, Settings.shutter_startrelay[i] -1); bitSet(shutter_mask, Settings.shutter_startrelay[i] -1);
bitSet(shutter_mask, Settings.shutter_startrelay[i]); bitSet(shutter_mask, Settings.shutter_startrelay[i]);
} }
@ -957,7 +957,7 @@ void HAssAnnounceShutters(void)
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_SHT_%d"), ESP_getChipId(), i + 1); snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_SHT_%d"), ESP_getChipId(), i + 1);
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/cover/%s/config"), unique_id); snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/cover/%s/config"), unique_id);
if (Settings.flag.hass_discovery && Settings.flag3.shutter_mode && Settings.shutter_startrelay[i] > 0 && Settings.shutter_startrelay[i] <= MAX_RELAYS) { if (Settings.flag.hass_discovery && Settings.flag3.shutter_mode && Settings.shutter_startrelay[i] > 0 && Settings.shutter_startrelay[i] <= MAX_SHUTTER_RELAYS) {
ShowTopic = 0; // Show the new generated topic ShowTopic = 0; // Show the new generated topic
if (i > MAX_FRIENDLYNAMES) { if (i > MAX_FRIENDLYNAMES) {
snprintf_P(stemp1, sizeof(stemp1), PSTR("%s Shutter %d"), SettingsText(SET_DEVICENAME), i + 1); snprintf_P(stemp1, sizeof(stemp1), PSTR("%s Shutter %d"), SettingsText(SET_DEVICENAME), i + 1);