Skip to content

Commit

Permalink
ESP32 increase number of relay GPIOs from 8 to 28
Browse files Browse the repository at this point in the history
  • Loading branch information
arendst committed Feb 4, 2021
1 parent bfde36e commit d5542b1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file.

## [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
- 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``
Expand Down
3 changes: 2 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

## Changelog v9.2.0.4
## Changelog v9.2.0.5
### Added
- 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)
Expand Down Expand Up @@ -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)
- PubSubClient MQTT_SOCKET_TIMEOUT from 15 to 4 seconds
- Domoticz fixed 2 decimals resolution by user selectable ``TempRes``, ``HumRes`` and ``PressRes`` resolutions
- ESP32 increase number of relay GPIOs from 8 to 28

### Fixed
- Redesign syslog and mqttlog using log buffer [#10164](https://github.com/arendst/Tasmota/issues/10164)
Expand Down
9 changes: 8 additions & 1 deletion tasmota/tasmota.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ const uint32_t POWER_MASK = 0xffffffffUL; // Power (Relay) full mask
* 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
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_LEDS = 4; // Max number of leds
const uint8_t MAX_KEYS = 4; // Max number of keys or buttons
Expand Down
2 changes: 1 addition & 1 deletion tasmota/tasmota_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
#ifndef _TASMOTA_VERSION_H_
#define _TASMOTA_VERSION_H_

const uint32_t VERSION = 0x09020004;
const uint32_t VERSION = 0x09020005;

#endif // _TASMOTA_VERSION_H_
8 changes: 4 additions & 4 deletions tasmota/xdrv_01_webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1447,8 +1447,8 @@ void HandleTemplateConfiguration(void)
for (uint32_t i = 0; i < MAX_GPIO_PIN; 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>"),
((9==i)||(10==i)) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:150px'") : "", i, i);
WSContentSend_P(PSTR("<td style='width:50px'><select id='h%d'></select></td></tr>"), 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:54px'><select id='h%d'></select></td></tr>"), i);
}
}
WSContentSend_P(PSTR("</table>"));
Expand Down Expand Up @@ -1566,9 +1566,9 @@ void HandleModuleConfiguration(void)
for (uint32_t i = 0; i < ARRAY_SIZE(template_gp.io); i++) {
if (ValidGPIO(i, template_gp.io[i])) {
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);
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>"));
Expand Down
10 changes: 5 additions & 5 deletions tasmota/xdrv_12_home_assistant.ino
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ typedef struct HASS {
void HassDiscoveryRelays(struct HASS &Hass)
{
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
uint8_t lightidx = MAX_RELAYS + 1; // Will store the starting position of the lights
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
bool iFan = false;

Hass.RelPst = TasmotaGlobal.devices_present > 0;
Expand Down Expand Up @@ -241,7 +241,7 @@ void HassDiscoveryRelays(struct HASS &Hass)
if (0 == Settings.shutter_startrelay[k]) {
break;
} 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;
}
}
Expand Down Expand Up @@ -429,7 +429,7 @@ void HAssAnnounceRelayLight(void)
#ifdef USE_SHUTTER
if (Settings.flag3.shutter_mode) {
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]);
}
Expand Down Expand Up @@ -957,7 +957,7 @@ void HAssAnnounceShutters(void)
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);

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
if (i > MAX_FRIENDLYNAMES) {
snprintf_P(stemp1, sizeof(stemp1), PSTR("%s Shutter %d"), SettingsText(SET_DEVICENAME), i + 1);
Expand Down

0 comments on commit d5542b1

Please sign in to comment.