mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 03:06:33 +00:00
Fix command `gpio
`
Fix command ``gpio`` using non-indexed functions regression from v9.1.0 (#9962)
This commit is contained in:
parent
0e41e0b9fe
commit
547e5d9c5d
@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
|
||||
## [9.1.0.2]
|
||||
### Added
|
||||
- KNX read reply for Power (#9236, #9891)
|
||||
- Zigbee persistence of device/sensir data in EEPROM (only ZBBridge)
|
||||
- Zigbee persistence of device/sensor data in EEPROM (only ZBBridge)
|
||||
|
||||
### Breaking Changed
|
||||
- KNX DPT9 (16-bit float) to DPT14 (32-bit float) by Adrian Scillato (#9811, #9888)
|
||||
@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Fixed
|
||||
- KNX ESP32 UDP mulicastpackage (#9811)
|
||||
- Command ``gpio`` using non-indexed functions regression from v9.1.0 (#9962)
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -65,6 +65,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
||||
- Zigbee command ``ZbLeave`` to unpair a device
|
||||
- Zigbee support for Mi Door and Contact (#9759)
|
||||
- Zigbee alarm persistence (#9785)
|
||||
- Zigbee persistence of device/sensor data in EEPROM (only ZBBridge)
|
||||
- Support for additional EZO sensors by Christopher Tremblay
|
||||
- Support for AS608 optical and R503 capacitive fingerprint sensor
|
||||
- Support for Shelly Dimmer 1 and 2 by James Turton (#9854)
|
||||
@ -80,6 +81,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
||||
- MQTT Wifi connection timeout from 5000 to 200 mSec (#9886)
|
||||
|
||||
### Fixed
|
||||
- Command ``gpio`` using non-indexed functions regression from v9.1.0 (#9962)
|
||||
- NTP fallback server functionality (#9739)
|
||||
- Telegram group chatid not supported (#9831)
|
||||
- KNX buttons, switches and sensors detection regression from v9.1.0 (#9811)
|
||||
|
@ -1380,7 +1380,7 @@ void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) {
|
||||
}
|
||||
#endif // ESP8266
|
||||
|
||||
void ModuleGpios(myio *gp)
|
||||
void TemplateGpios(myio *gp)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *)gp;
|
||||
uint16_t src[ARRAY_SIZE(Settings.user_template.gp.io)];
|
||||
|
@ -1132,20 +1132,21 @@ void CmndModules(void)
|
||||
void CmndGpio(void)
|
||||
{
|
||||
if (XdrvMailbox.index < ARRAY_SIZE(Settings.my_gp.io)) {
|
||||
myio cmodule;
|
||||
ModuleGpios(&cmodule);
|
||||
if (ValidGPIO(XdrvMailbox.index, cmodule.io[XdrvMailbox.index]) && (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < AGPIO(GPIO_SENSOR_END))) {
|
||||
myio template_gp;
|
||||
TemplateGpios(&template_gp);
|
||||
if (ValidGPIO(XdrvMailbox.index, template_gp.io[XdrvMailbox.index]) && (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < AGPIO(GPIO_SENSOR_END))) {
|
||||
bool present = false;
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(kGpioNiceList); i++) {
|
||||
uint32_t midx = pgm_read_word(kGpioNiceList + i);
|
||||
if ((XdrvMailbox.payload >= (midx & 0xFFE0)) && (XdrvMailbox.payload < midx)) {
|
||||
uint32_t max_midx = ((midx & 0x001F) > 0) ? midx : midx +1;
|
||||
if ((XdrvMailbox.payload >= (midx & 0xFFE0)) && (XdrvMailbox.payload < max_midx)) {
|
||||
present = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (present) {
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(Settings.my_gp.io); i++) {
|
||||
if (ValidGPIO(i, cmodule.io[i]) && (Settings.my_gp.io[i] == XdrvMailbox.payload)) {
|
||||
if (ValidGPIO(i, template_gp.io[i]) && (Settings.my_gp.io[i] == XdrvMailbox.payload)) {
|
||||
Settings.my_gp.io[i] = GPIO_NONE;
|
||||
}
|
||||
}
|
||||
@ -1156,12 +1157,12 @@ void CmndGpio(void)
|
||||
Response_P(PSTR("{"));
|
||||
bool jsflg = false;
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(Settings.my_gp.io); i++) {
|
||||
if (ValidGPIO(i, cmodule.io[i]) || ((255 == XdrvMailbox.payload) && !FlashPin(i))) {
|
||||
if (ValidGPIO(i, template_gp.io[i]) || ((255 == XdrvMailbox.payload) && !FlashPin(i))) {
|
||||
if (jsflg) { ResponseAppend_P(PSTR(",")); }
|
||||
jsflg = true;
|
||||
uint32_t sensor_type = Settings.my_gp.io[i];
|
||||
if (!ValidGPIO(i, cmodule.io[i])) {
|
||||
sensor_type = cmodule.io[i];
|
||||
if (!ValidGPIO(i, template_gp.io[i])) {
|
||||
sensor_type = template_gp.io[i];
|
||||
if (AGPIO(GPIO_USER) == sensor_type) { // A user GPIO equals a not connected (=GPIO_NONE) GPIO here
|
||||
sensor_type = GPIO_NONE;
|
||||
}
|
||||
|
@ -1513,8 +1513,8 @@ void GpioInit(void)
|
||||
}
|
||||
}
|
||||
|
||||
myio def_gp;
|
||||
ModuleGpios(&def_gp);
|
||||
myio template_gp;
|
||||
TemplateGpios(&template_gp);
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(Settings.my_gp.io); i++) {
|
||||
if ((Settings.my_gp.io[i] >= AGPIO(GPIO_SENSOR_END)) && (Settings.my_gp.io[i] < AGPIO(GPIO_USER))) {
|
||||
Settings.my_gp.io[i] = GPIO_NONE; // Fix not supported sensor ids in module
|
||||
@ -1522,8 +1522,8 @@ void GpioInit(void)
|
||||
else if (Settings.my_gp.io[i] > GPIO_NONE) {
|
||||
TasmotaGlobal.my_module.io[i] = Settings.my_gp.io[i]; // Set User selected Module sensors
|
||||
}
|
||||
if ((def_gp.io[i] > GPIO_NONE) && (def_gp.io[i] < AGPIO(GPIO_USER))) {
|
||||
TasmotaGlobal.my_module.io[i] = def_gp.io[i]; // Force Template override
|
||||
if ((template_gp.io[i] > GPIO_NONE) && (template_gp.io[i] < AGPIO(GPIO_USER))) {
|
||||
TasmotaGlobal.my_module.io[i] = template_gp.io[i]; // Force Template override
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1806,16 +1806,16 @@ void HandleTemplateConfiguration(void)
|
||||
uint32_t module = atoi(stemp);
|
||||
uint32_t module_save = Settings.module;
|
||||
Settings.module = module;
|
||||
myio cmodule;
|
||||
ModuleGpios(&cmodule);
|
||||
myio template_gp;
|
||||
TemplateGpios(&template_gp);
|
||||
gpio_flag flag = ModuleFlag();
|
||||
Settings.module = module_save;
|
||||
|
||||
WSContentBegin(200, CT_PLAIN);
|
||||
WSContentSend_P(PSTR("%s}1"), AnyModuleName(module).c_str()); // NAME: Generic
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(cmodule.io); i++) { // 17,148,29,149,7,255,255,255,138,255,139,255,255
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(template_gp.io); i++) { // 17,148,29,149,7,255,255,255,138,255,139,255,255
|
||||
if (!FlashPin(i)) {
|
||||
WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", cmodule.io[i]);
|
||||
WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]);
|
||||
}
|
||||
}
|
||||
WSContentSend_P(PSTR("}1%d}1%d"), flag, Settings.user_template_base); // FLAG: 1 BASE: 17
|
||||
@ -1936,8 +1936,8 @@ void HandleModuleConfiguration(void)
|
||||
|
||||
char stemp[30]; // Sensor name
|
||||
uint32_t midx;
|
||||
myio cmodule;
|
||||
ModuleGpios(&cmodule);
|
||||
myio template_gp;
|
||||
TemplateGpios(&template_gp);
|
||||
|
||||
WSContentStart_P(PSTR(D_CONFIGURE_MODULE));
|
||||
WSContentSend_P(HTTP_SCRIPT_MODULE_TEMPLATE);
|
||||
@ -1958,8 +1958,8 @@ void HandleModuleConfiguration(void)
|
||||
|
||||
WSContentSendNiceLists(0);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(cmodule.io); i++) {
|
||||
if (ValidGPIO(i, cmodule.io[i])) {
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(template_gp.io); i++) {
|
||||
if (ValidGPIO(i, template_gp.io[i])) {
|
||||
WSContentSend_P(PSTR("sk(%d,%d);"), TasmotaGlobal.my_module.io[i], i); // g0 - g17
|
||||
}
|
||||
}
|
||||
@ -1975,8 +1975,8 @@ void HandleModuleConfiguration(void)
|
||||
|
||||
WSContentSendStyle();
|
||||
WSContentSend_P(HTTP_FORM_MODULE, AnyModuleName(MODULE).c_str());
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(cmodule.io); i++) {
|
||||
if (ValidGPIO(i, cmodule.io[i])) {
|
||||
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>"),
|
||||
(WEMOS==TasmotaGlobal.module_type)?stemp:"", i, i, i);
|
||||
@ -1998,14 +1998,14 @@ void ModuleSaveSettings(void)
|
||||
Settings.last_module = Settings.module;
|
||||
Settings.module = new_module;
|
||||
SetModuleType();
|
||||
myio cmodule;
|
||||
ModuleGpios(&cmodule);
|
||||
myio template_gp;
|
||||
TemplateGpios(&template_gp);
|
||||
String gpios = "";
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(cmodule.io); i++) {
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(template_gp.io); i++) {
|
||||
if (Settings.last_module != new_module) {
|
||||
Settings.my_gp.io[i] = GPIO_NONE;
|
||||
} else {
|
||||
if (ValidGPIO(i, cmodule.io[i])) {
|
||||
if (ValidGPIO(i, template_gp.io[i])) {
|
||||
Settings.my_gp.io[i] = WebGetGpioArg(i);
|
||||
gpios += F(", " D_GPIO ); gpios += String(i); gpios += F(" "); gpios += String(Settings.my_gp.io[i]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user