Skip to content

Commit

Permalink
Fix GpioRead (#19810)
Browse files Browse the repository at this point in the history
  • Loading branch information
arendst committed Oct 21, 2023
1 parent 356de1a commit 57860b6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 SI1145/6/7 Ultra violet index and light sensor
- I2C bus2 support to LM75AD temperature sensor
- Add command ``GpioRead``
- Command ``GpioRead`` to show input state (#19810)

### Breaking Changed

Expand Down
3 changes: 2 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm

## Changelog v13.2.0.1
### 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 HTU temperature and humidity sensor
- I2C bus2 support to BH1750 ambient light sensor
Expand All @@ -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 SI1145/6/7 Ultra violet index and light sensor
- I2C bus2 support to LM75AD temperature sensor
- Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3

### Breaking Changed

Expand Down
15 changes: 10 additions & 5 deletions tasmota/tasmota_support/support_command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
TemplateGpios(&template_gp);
bool jsflg = false;
Response_P(PSTR("{\"" D_CMND_GPIOREAD "\":{"));
for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) {
uint32_t sensor_type = template_gp.io[i];
if ((sensor_type != GPIO_NONE) && (AGPIO(GPIO_USER) != sensor_type)) {
bool sensor_active = false;
uint32_t sensor_type = template_gp.io[i]; // Template GPIO
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) {
ResponseAppend_P(PSTR(","));
}
Expand Down

0 comments on commit 57860b6

Please sign in to comment.