Fix GpioRead (#19810)

This commit is contained in:
Theo Arends 2023-10-21 17:20:55 +02:00
parent 356de1a16a
commit 57860b692d
3 changed files with 13 additions and 7 deletions

View File

@ -13,7 +13,7 @@ All notable changes to this project will be documented in this file.
- I2C bus2 support to HYTxxx temperature and humidity sensor - I2C bus2 support to HYTxxx temperature and humidity sensor
- I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor - I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor
- I2C bus2 support to LM75AD temperature sensor - I2C bus2 support to LM75AD temperature sensor
- Add command ``GpioRead`` - Command ``GpioRead`` to show input state (#19810)
### Breaking Changed ### Breaking Changed

View File

@ -112,7 +112,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
## Changelog v13.2.0.1 ## Changelog v13.2.0.1
### Added ### Added
- Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3 - Command ``GpioRead`` to show input state [#19810](https://github.com/arendst/Tasmota/issues/19810)
- I2C bus2 support to iAQ core sensor [#19799](https://github.com/arendst/Tasmota/issues/19799) - I2C bus2 support to iAQ core sensor [#19799](https://github.com/arendst/Tasmota/issues/19799)
- I2C bus2 support to HTU temperature and humidity sensor - I2C bus2 support to HTU temperature and humidity sensor
- I2C bus2 support to BH1750 ambient light sensor - I2C bus2 support to BH1750 ambient light sensor
@ -121,6 +121,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- I2C bus2 support to HYTxxx temperature and humidity sensor - I2C bus2 support to HYTxxx temperature and humidity sensor
- I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor - I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor
- I2C bus2 support to LM75AD temperature sensor - I2C bus2 support to LM75AD temperature sensor
- Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3
### Breaking Changed ### Breaking Changed

View File

@ -1768,16 +1768,21 @@ void CmndGpio(void)
} }
} }
// Perform a digitalRead on each configured PGIO void CmndGpioRead(void) {
void CmndGpioRead(void) // Perform a digitalRead on each configured GPIO
{
myio template_gp; myio template_gp;
TemplateGpios(&template_gp); TemplateGpios(&template_gp);
bool jsflg = false; bool jsflg = false;
Response_P(PSTR("{\"" D_CMND_GPIOREAD "\":{")); Response_P(PSTR("{\"" D_CMND_GPIOREAD "\":{"));
for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) { for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) {
uint32_t sensor_type = template_gp.io[i]; bool sensor_active = false;
uint32_t sensor_type = template_gp.io[i]; // Template GPIO
if ((sensor_type != GPIO_NONE) && (AGPIO(GPIO_USER) != sensor_type)) { if ((sensor_type != GPIO_NONE) && (AGPIO(GPIO_USER) != sensor_type)) {
sensor_active = true;
} else if (Settings->my_gp.io[i] != GPIO_NONE) { // Module GPIO
sensor_active = true;
}
if (sensor_active) {
if (jsflg) { if (jsflg) {
ResponseAppend_P(PSTR(",")); ResponseAppend_P(PSTR(","));
} }