Add command `Gpios 255`

Add command ``Gpios 255`` to show all possible GPIO configurations
This commit is contained in:
Theo Arends 2020-10-30 16:08:38 +01:00
parent 58dc18844b
commit 31e5617043
3 changed files with 19 additions and 11 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Support for EZO PRS sensors by Christopher Tremblay (#9659)
- Zigbee reduce battery drain (#9642)
- Zigbee added ``ZbMap`` command to describe Zigbee topology (#9651)
- Command ``Gpios 255`` to show all possible GPIO configurations
### Changed
- PlatformIO library structure redesigned for compilation speed by Jason2866

View File

@ -59,6 +59,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
## Changelog v9.0.0.3
### Added
- Command ``Gpios 255`` to show all possible GPIO configurations
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
- Command ``ShutterChange`` to increment change position (#9594)

View File

@ -1189,13 +1189,20 @@ void CmndGpio(void)
}
void ShowGpios(const uint16_t *NiceList, uint32_t size, uint32_t offset, uint32_t &lines) {
uint32_t ridx;
uint32_t midx;
myio cmodule;
ModuleGpios(&cmodule);
bool jsflg = false;
for (uint32_t i = offset; i < size; i++) { // Skip ADC_NONE
uint32_t ridx = pgm_read_word(NiceList + i) & 0xFFE0;
uint32_t midx = BGPIO(ridx);
if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; }
if (NiceList == nullptr) {
ridx = AGPIO(i);
midx = i;
} else {
ridx = pgm_read_word(NiceList + i) & 0xFFE0;
midx = BGPIO(ridx);
if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; }
}
if (!jsflg) {
Response_P(PSTR("{\"" D_CMND_GPIOS "%d\":{"), lines);
} else {
@ -1214,19 +1221,18 @@ void ShowGpios(const uint16_t *NiceList, uint32_t size, uint32_t offset, uint32_
void CmndGpios(void)
{
/*
if (XdrvMailbox.payload == 17) {
DumpConvertTable();
return;
}
*/
uint32_t lines = 1;
ShowGpios(kGpioNiceList, ARRAY_SIZE(kGpioNiceList), 0, lines);
if (XdrvMailbox.payload == 255) {
// DumpConvertTable();
ShowGpios(nullptr, GPIO_SENSOR_END, 0, lines);
} else {
ShowGpios(kGpioNiceList, ARRAY_SIZE(kGpioNiceList), 0, lines);
#ifdef ESP8266
#ifndef USE_ADC_VCC
ShowGpios(kAdcNiceList, ARRAY_SIZE(kAdcNiceList), 1, lines);
ShowGpios(kAdcNiceList, ARRAY_SIZE(kAdcNiceList), 1, lines);
#endif // USE_ADC_VCC
#endif // ESP8266
}
ResponseClear();
}