From 971b06ccdd7343703eeacdda5cbb6d5444074d20 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 15 Sep 2022 17:17:16 +0200 Subject: [PATCH] Add command ``SetOption46 0..255`` Add command ``SetOption46 0..255`` to add 0..255 * 10 milliseconds power on delay before initializing I/O (#15438) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/include/tasmota.h | 2 +- tasmota/tasmota_support/support_tasmota.ino | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dfa2e7ba..d32d63e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Berry has persistent MQTT subscriptions: auto-subscribe at (re)connection - Berry automated solidification of code - Support of optional file calib.dat on ADE7953 based energy monitors like Shelly EM (#16486) +- Command ``SetOption46 0..255`` to add 0..255 * 10 milliseconds power on delay before initializing I/O (#15438) ### Changed - ESP32 Increase number of button GPIOs from 8 to 28 (#16518) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 395d1de51..1794ff603 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -109,6 +109,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo ## Changelog v12.1.1.2 ### Added +- Command ``SetOption46 0..255`` to add 0..255 * 10 milliseconds power on delay before initializing I/O [#15438](https://github.com/arendst/Tasmota/issues/15438) - Command ``SetOption146 1`` to enable display of ESP32 internal temperature - Command ``StatusRetain`` [#11109](https://github.com/arendst/Tasmota/issues/11109) - Command ``DspSpeed 2..127`` to control message rotation speed on display of POWR3xxD and THR3xxD diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index d1992444f..02949ce9e 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -358,7 +358,7 @@ enum SO32_49Index { P_HOLD_TIME, // SetOption32 - (Button/Switch) K P_ROTARY_MAX_STEP, // SetOption43 - (Rotary) Rotary step boundary (default 10) P_IR_TOLERANCE, // SetOption44 - (IR) Base tolerance percentage for matching incoming IR messages (default 25, max 100) P_BISTABLE_PULSE, // SetOption45 - (Bistable) Pulse time for two coil bistable latching relays (default 40) - P_SO46_FREE, // SetOption46 + P_POWER_ON_DELAY, // SetOption46 - (PowerOn) Add delay of 10 x value milliseconds at power on P_SO47_FREE, // SetOption47 P_SO48_FREE, // SetOption48 P_SO49_FREE // SetOption49 diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 5ae999266..97e9af40d 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -416,6 +416,8 @@ void SetPowerOnState(void) } } +// AddLog(LOG_LEVEL_DEBUG, PSTR("PWR: PowerOnState %d restored"), Settings->poweronstate); + // Issue #526 and #909 uint32_t port = 0; for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) { @@ -2160,6 +2162,8 @@ void GpioInit(void) } } + delay(Settings->param[P_POWER_ON_DELAY] * 10); // SetOption46 - Allow Wemos D1 power to stabilize before starting I2C polling for devices powered locally + #ifdef USE_I2C TasmotaGlobal.i2c_enabled = (PinUsed(GPIO_I2C_SCL) && PinUsed(GPIO_I2C_SDA)); if (TasmotaGlobal.i2c_enabled) {