mirror of https://github.com/arendst/Tasmota.git
Support for GPIO option selection
- Support for GPIO option selection - Gpio ``Option_a1`` enabling PWM1 high impedance if powered off and no fading as used by Wyze bulbs (#10196)
This commit is contained in:
parent
12439dc866
commit
dcfb74f457
|
@ -7,10 +7,13 @@ All notable changes to this project will be documented in this file.
|
|||
### Added
|
||||
- Milliseconds to console output (#10152)
|
||||
- Support for P9813 RGB Led MOSFET controller (#10104)
|
||||
- Support for GPIO option selection
|
||||
- Gpio ``Option_a1`` enabling PWM1 high impedance if powered off and no fading as used by Wyze bulbs (#10196)
|
||||
|
||||
### Fixed
|
||||
- Redesign syslog and mqttlog using log buffer (#10164)
|
||||
- Shelly Dimmer power on state (#10154, #10182)
|
||||
- Wemo emulation for single devices (#10165, #10194)
|
||||
|
||||
## [Released]
|
||||
|
||||
|
|
|
@ -60,7 +60,10 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||
### Added
|
||||
- Milliseconds to console output (#10152)
|
||||
- Support for P9813 RGB Led MOSFET controller (#10104)
|
||||
- Support for GPIO option selection
|
||||
- Gpio ``Option_a1`` enabling PWM1 high impedance if powered off and no fading as used by Wyze bulbs (#10196)
|
||||
|
||||
### Fixed
|
||||
- Redesign syslog and mqttlog using log buffer (#10164)
|
||||
- Shelly Dimmer power on state (#10154, #10182)
|
||||
- Wemo emulation for single devices (#10165, #10194)
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Няма"
|
||||
#define D_SENSOR_USER "Потребит."
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Není"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "None"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Κανένα"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "None"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Ninguno"
|
||||
#define D_SENSOR_USER "Por Usuario"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -557,6 +557,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Aucun"
|
||||
#define D_SENSOR_USER "Utilisateur"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "None"
|
||||
#define D_SENSOR_USER "משתמש"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Nincs"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Nessuno"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "없음"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Geen"
|
||||
#define D_SENSOR_USER "Gebruiker"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Brak"
|
||||
#define D_SENSOR_USER "Użytkownik"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Nenhum"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Nenhum"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Fără"
|
||||
#define D_SENSOR_USER "Utilizator"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "-нет-"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Žiaden"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Ingen"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "None"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Немає"
|
||||
#define D_SENSOR_USER "Користувач"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "Không dùng"
|
||||
#define D_SENSOR_USER "Người Dùng"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "无"
|
||||
#define D_SENSOR_USER "User"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
// tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box
|
||||
#define D_SENSOR_NONE "無"
|
||||
#define D_SENSOR_USER "使用者"
|
||||
#define D_SENSOR_OPTION "Option"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
|
|
|
@ -1534,7 +1534,11 @@ void GpioInit(void)
|
|||
XdrvMailbox.index = mpin;
|
||||
XdrvMailbox.payload = i;
|
||||
|
||||
if ((mpin >= AGPIO(GPIO_SWT1_NP)) && (mpin < (AGPIO(GPIO_SWT1_NP) + MAX_SWITCHES))) {
|
||||
if ((mpin >= AGPIO(GPIO_OPTION_A)) && (mpin < (AGPIO(GPIO_OPTION_A) + MAX_OPTIONS_A))) {
|
||||
bitSet(TasmotaGlobal.gpio_optiona.data, mpin - AGPIO(GPIO_OPTION_A));
|
||||
mpin = GPIO_NONE;
|
||||
}
|
||||
else if ((mpin >= AGPIO(GPIO_SWT1_NP)) && (mpin < (AGPIO(GPIO_SWT1_NP) + MAX_SWITCHES))) {
|
||||
SwitchPullupFlag(mpin - AGPIO(GPIO_SWT1_NP));
|
||||
mpin -= (AGPIO(GPIO_SWT1_NP) - AGPIO(GPIO_SWT1));
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ struct {
|
|||
uint32_t loop_load_avg; // Indicative loop load average
|
||||
uint32_t log_buffer_pointer; // Index in log buffer
|
||||
uint32_t uptime; // Counting every second until 4294967295 = 130 year
|
||||
GpioOptionABits gpio_optiona; // GPIO Option_A flags
|
||||
|
||||
power_t power; // Current copy of Settings.power
|
||||
power_t rel_inverted; // Relay inverted flag (1 = (0 = On, 1 = Off))
|
||||
|
@ -196,6 +197,7 @@ void setup(void) {
|
|||
memset(&TasmotaGlobal, 0, sizeof(TasmotaGlobal));
|
||||
TasmotaGlobal.baudrate = APP_BAUDRATE;
|
||||
TasmotaGlobal.seriallog_timer = SERIALLOG_TIMER;
|
||||
TasmotaGlobal.gpio_optiona.data = 0;
|
||||
TasmotaGlobal.temperature_celsius = NAN;
|
||||
TasmotaGlobal.blinks = 201;
|
||||
TasmotaGlobal.wifi_state_flag = WIFI_RESTART;
|
||||
|
|
|
@ -130,6 +130,7 @@ enum UserSelectablePins {
|
|||
GPIO_SHELLY_DIMMER_BOOT0, GPIO_SHELLY_DIMMER_RST_INV,
|
||||
GPIO_RC522_RST, // RC522 reset
|
||||
GPIO_P9813_CLK, GPIO_P9813_DAT, // P9813 Clock and Data
|
||||
GPIO_OPTION_A, // Specific device options to be served in code
|
||||
GPIO_SENSOR_END };
|
||||
|
||||
enum ProgramSelectablePins {
|
||||
|
@ -137,6 +138,46 @@ enum ProgramSelectablePins {
|
|||
GPIO_USER, // User configurable needs to be 2047
|
||||
GPIO_MAX };
|
||||
|
||||
#define MAX_OPTIONS_A 2 // Increase if more bits are used from GpioOptionABits
|
||||
|
||||
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
|
||||
uint32_t data; // Allow bit manipulation using SetOption
|
||||
struct { // GPIO Option_A1 .. Option_A32
|
||||
uint32_t pwm1_input : 1; // bit 0 (v9.2.0.1) - Option_A1 - (Light) Change PWM1 to input on power off and no fade running (1)
|
||||
uint32_t spare01 : 1; // bit 1
|
||||
uint32_t spare02 : 1; // bit 2
|
||||
uint32_t spare03 : 1; // bit 3
|
||||
uint32_t spare04 : 1; // bit 4
|
||||
uint32_t spare05 : 1; // bit 5
|
||||
uint32_t spare06 : 1; // bit 6
|
||||
uint32_t spare07 : 1; // bit 7
|
||||
uint32_t spare08 : 1; // bit 8
|
||||
uint32_t spare09 : 1; // bit 9
|
||||
uint32_t spare10 : 1; // bit 10
|
||||
uint32_t spare11 : 1; // bit 11
|
||||
uint32_t spare12 : 1; // bit 12
|
||||
uint32_t spare13 : 1; // bit 13
|
||||
uint32_t spare14 : 1; // bit 14
|
||||
uint32_t spare15 : 1; // bit 15
|
||||
uint32_t spare16 : 1; // bit 16
|
||||
uint32_t spare17 : 1; // bit 17
|
||||
uint32_t spare18 : 1; // bit 18
|
||||
uint32_t spare19 : 1; // bit 19
|
||||
uint32_t spare20 : 1; // bit 20
|
||||
uint32_t spare21 : 1; // bit 21
|
||||
uint32_t spare22 : 1; // bit 22
|
||||
uint32_t spare23 : 1; // bit 23
|
||||
uint32_t spare24 : 1; // bit 24
|
||||
uint32_t spare25 : 1; // bit 25
|
||||
uint32_t spare26 : 1; // bit 26
|
||||
uint32_t spare27 : 1; // bit 27
|
||||
uint32_t spare28 : 1; // bit 28
|
||||
uint32_t spare29 : 1; // bit 29
|
||||
uint32_t spare30 : 1; // bit 30
|
||||
uint32_t spare31 : 1; // bit 31
|
||||
};
|
||||
} GpioOptionABits;
|
||||
|
||||
// Text in webpage Module Parameters and commands GPIOS and GPIO
|
||||
const char kSensorNames[] PROGMEM =
|
||||
D_SENSOR_NONE "|"
|
||||
|
@ -239,7 +280,8 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_AS608_TX "|" D_SENSOR_AS608_RX "|"
|
||||
D_SENSOR_SHELLY_DIMMER_BOOT0 "|" D_SENSOR_SHELLY_DIMMER_RST_INV "|"
|
||||
D_SENSOR_RC522_RST "|"
|
||||
D_SENSOR_P9813_CLK "|" D_SENSOR_P9813_DAT
|
||||
D_SENSOR_P9813_CLK "|" D_SENSOR_P9813_DAT "|"
|
||||
D_SENSOR_OPTION "_a|"
|
||||
;
|
||||
|
||||
const char kSensorNamesFixed[] PROGMEM =
|
||||
|
@ -253,6 +295,7 @@ const char kSensorNamesFixed[] PROGMEM =
|
|||
|
||||
const uint16_t kGpioNiceList[] PROGMEM = {
|
||||
GPIO_NONE, // Not used
|
||||
AGPIO(GPIO_OPTION_A) + MAX_OPTIONS_A, // Device specific options
|
||||
AGPIO(GPIO_KEY1) + MAX_KEYS, // Buttons
|
||||
AGPIO(GPIO_KEY1_NP) + MAX_KEYS,
|
||||
AGPIO(GPIO_KEY1_INV) + MAX_KEYS,
|
||||
|
|
|
@ -2072,6 +2072,10 @@ void LightAnimate(void)
|
|||
// If the power is off and the fade is done, turn the relay off.
|
||||
if (PWM_DIMMER == TasmotaGlobal.module_type && !Light.power && !Light.fade_running) PWMDimmerSetPower();
|
||||
#endif // USE_PWM_DIMMER
|
||||
// For WYZE bulbs we must set the CT pin to INPUT to fully turn it off
|
||||
if (TasmotaGlobal.gpio_optiona.pwm1_input && !Light.power && !Light.fade_running) { // GPIO Option_A1
|
||||
if (PinUsed(GPIO_PWM1)) { pinMode(Pin(GPIO_PWM1), INPUT); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue