mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Change GPIO initialization solving possible Relay toggle on (OTA) restart
Change GPIO initialization solving possible Relay toggle on (OTA) restart
This commit is contained in:
parent
dc531110bd
commit
5471de6f1c
@ -55,3 +55,5 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||||||
### Version 8.2.0.1
|
### Version 8.2.0.1
|
||||||
|
|
||||||
- Change HM-10 sensor type detection and add features (#7962)
|
- Change HM-10 sensor type detection and add features (#7962)
|
||||||
|
- Change GPIO initialization solving possible Relay toggle on (OTA) restart
|
||||||
|
- Add command ``ZbRestore`` to restore device configuration dumped with ``ZbStatus 2``
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
### 8.2.0.1 20200321
|
### 8.2.0.1 20200321
|
||||||
|
|
||||||
- Change HM-10 sensor type detection and add features (#7962)
|
- Change HM-10 sensor type detection and add features (#7962)
|
||||||
|
- Change GPIO initialization solving possible Relay toggle on (OTA) restart
|
||||||
- Add command ``ZbRestore`` to restore device configuration dumped with ``ZbStatus 2``
|
- Add command ``ZbRestore`` to restore device configuration dumped with ``ZbStatus 2``
|
||||||
|
|
||||||
## Released
|
## Released
|
||||||
|
@ -1297,6 +1297,18 @@ void SerialInput(void)
|
|||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
|
void ResetPwm(void)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only
|
||||||
|
if (pin[GPIO_PWM1 +i] < 99) {
|
||||||
|
analogWrite(pin[GPIO_PWM1 +i], bitRead(pwm_inverted, i) ? Settings.pwm_range : 0);
|
||||||
|
// analogWrite(pin[GPIO_PWM1 +i], bitRead(pwm_inverted, i) ? Settings.pwm_range - Settings.pwm_value[i] : Settings.pwm_value[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************************************/
|
||||||
|
|
||||||
void GpioInit(void)
|
void GpioInit(void)
|
||||||
{
|
{
|
||||||
uint32_t mpin;
|
uint32_t mpin;
|
||||||
@ -1506,6 +1518,17 @@ void GpioInit(void)
|
|||||||
RotaryInit();
|
RotaryInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Set any non-used GPIO to INPUT
|
||||||
|
for (uint32_t i = 0; i < sizeof(my_module.io); i++) {
|
||||||
|
mpin = ValidPin(i, my_module.io[i]);
|
||||||
|
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("INI: gpio pin %d, mpin %d"), i, mpin);
|
||||||
|
if (((i < 6) || (i > 11)) && (0 == mpin)) { // Skip SPI flash interface
|
||||||
|
if (!((1 == i) || (3 == i))) { // Skip serial
|
||||||
|
pinMode(i, INPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetLedPower(Settings.ledstate &8);
|
SetLedPower(Settings.ledstate &8);
|
||||||
SetLedLink(Settings.ledstate &8);
|
SetLedLink(Settings.ledstate &8);
|
||||||
|
|
||||||
|
@ -694,6 +694,7 @@ void WifiShutdown(bool option = false)
|
|||||||
|
|
||||||
void EspRestart(void)
|
void EspRestart(void)
|
||||||
{
|
{
|
||||||
|
ResetPwm();
|
||||||
WifiShutdown(true);
|
WifiShutdown(true);
|
||||||
CrashDumpClear(); // Clear the stack dump in RTC
|
CrashDumpClear(); // Clear the stack dump in RTC
|
||||||
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
|
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user