Fix ESP8266 relay power on spikes

Fix ESP8266 set GPIO's to input on power on fixing relay spikes (#17531)
This commit is contained in:
Theo Arends 2022-12-29 14:46:34 +01:00
parent ff3d90c36d
commit 4ee6aee35e
4 changed files with 50 additions and 63 deletions

View File

@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file.
- Shutter default motorstop set to 0 (#17403)
- Shutter default tilt configuration (#17484)
- Modbus transmit enable GPIO enabled once during write buffer
- ESP8266 set GPIO's to input on power on fixing relay spikes (#17531)
### Removed

View File

@ -127,6 +127,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
### Fixed
- Modbus transmit enable GPIO enabled once during write buffer
- ESP8266 set GPIO's to input on power on fixing relay spikes [#17531](https://github.com/arendst/Tasmota/issues/17531)
- Shutter default motorstop set to 0 [#17403](https://github.com/arendst/Tasmota/issues/17403)
- Shutter default tilt configuration [#17484](https://github.com/arendst/Tasmota/issues/17484)

View File

@ -1,63 +0,0 @@
/*
support_cores.ino - Arduino core support for Tasmota
Copyright (C) 2021 Theo Arends
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*********************************************************************************************\
* Core overrides
\*********************************************************************************************/
// Add below line to tasmota_globals.h
// extern "C" void resetPins();
void resetPins()
{
/*
for (int i = 0; i <= 5; ++i) {
pinMode(i, INPUT);
}
// pins 6-11 are used for the SPI flash interface
for (int i = 12; i <= 16; ++i) {
pinMode(i, INPUT);
}
*/
}
/*********************************************************************************************\
* Hardware related
\*********************************************************************************************/
#ifdef ESP8266
void HwWdtDisable(void) {
*((volatile uint32_t*) 0x60000900) &= ~(1); // Hardware WDT OFF
}
void HwWdtEnable(void) {
*((volatile uint32_t*) 0x60000900) |= 1; // Hardware WDT ON
}
void WdtDisable(void) {
ESP.wdtDisable();
HwWdtDisable();
}
void WdtEnable(void) {
HwWdtEnable();
ESP.wdtEnable(0);
}
#endif // ESP8266

View File

@ -33,6 +33,54 @@ extern "C" {
extern struct rst_info resetInfo;
}
/*********************************************************************************************\
* Core overrides executed directly by core
\*********************************************************************************************/
// Add below line to tasmota_globals.h
// extern "C" void resetPins();
// This function is executed by core init() (as initPins()) in core_esp8266_wiring.cpp
// 20221229 - Re-enabled with additional check to execute on power on only fixing short relay power on/off
// 20?????? - Disabled for unknown reason
void resetPins() {
if ((resetInfo.reason == REASON_DEFAULT_RST) || (resetInfo.reason == REASON_EXT_SYS_RST)) {
// Only perform at power on
for (int i = 0; i <= 5; ++i) {
pinMode(i, INPUT);
}
// pins 6-11 are used for the SPI flash interface
for (int i = 12; i <= 16; ++i) {
pinMode(i, INPUT);
}
}
}
/*********************************************************************************************\
* Hardware related
\*********************************************************************************************/
void HwWdtDisable(void) {
*((volatile uint32_t*) 0x60000900) &= ~(1); // Hardware WDT OFF
}
void HwWdtEnable(void) {
*((volatile uint32_t*) 0x60000900) |= 1; // Hardware WDT ON
}
void WdtDisable(void) {
ESP.wdtDisable();
HwWdtDisable();
}
void WdtEnable(void) {
HwWdtEnable();
ESP.wdtEnable(0);
}
/*********************************************************************************************\
* ESP8266 specifics
\*********************************************************************************************/
uint32_t ESP_ResetInfoReason(void) {
return resetInfo.reason;
}