mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-31 14:37:49 +00:00
Add command Gpios 255/All to show all available GPIO components
Add command Gpios 255/All to show all available GPIO components (#6407)
This commit is contained in:
parent
d9877e8086
commit
3a0fce2503
@ -3,6 +3,7 @@
|
|||||||
* Redesign command Tariff to now default to 0 (=disabled) and allowing to set both Standard Time (ST) and Daylight Savings Time (DST) start hour
|
* Redesign command Tariff to now default to 0 (=disabled) and allowing to set both Standard Time (ST) and Daylight Savings Time (DST) start hour
|
||||||
* Commands Tariff1 22,23 = Tariff1 (Off-Peak) ST,DST Tariff2 (Standard) 6,7 = Tariff2 ST,DST Tariff9 0/1 = Weekend toggle (1 = Off-Peak during weekend)
|
* Commands Tariff1 22,23 = Tariff1 (Off-Peak) ST,DST Tariff2 (Standard) 6,7 = Tariff2 ST,DST Tariff9 0/1 = Weekend toggle (1 = Off-Peak during weekend)
|
||||||
* Change rename "Data" to "Hash" and limit to 32 bits when receiving UNKNOWN IR protocol (see DECODE_HASH from IRremoteESP8266)
|
* Change rename "Data" to "Hash" and limit to 32 bits when receiving UNKNOWN IR protocol (see DECODE_HASH from IRremoteESP8266)
|
||||||
|
* Add command Gpios 255/All to show all available GPIO components (#6407)
|
||||||
*
|
*
|
||||||
* 6.6.0.11 20190907
|
* 6.6.0.11 20190907
|
||||||
* Change Settings crc calculation allowing short term backward compatibility
|
* Change Settings crc calculation allowing short term backward compatibility
|
||||||
|
@ -604,12 +604,6 @@ const char kCodeImage[] PROGMEM = "sonoff|minimal|classic|sensors|knx|basic|disp
|
|||||||
// support.ino
|
// support.ino
|
||||||
static const char kMonthNames[] = D_MONTH3LIST;
|
static const char kMonthNames[] = D_MONTH3LIST;
|
||||||
|
|
||||||
const char kOptionOff[] PROGMEM = "OFF|" D_OFF "|" D_FALSE "|" D_STOP "|" D_CELSIUS ;
|
|
||||||
const char kOptionOn[] PROGMEM = "ON|" D_ON "|" D_TRUE "|" D_START "|" D_FAHRENHEIT "|" D_USER ;
|
|
||||||
const char kOptionToggle[] PROGMEM = "TOGGLE|" D_TOGGLE "|" D_ADMIN ;
|
|
||||||
const char kOptionBlink[] PROGMEM = "BLINK|" D_BLINK ;
|
|
||||||
const char kOptionBlinkOff[] PROGMEM = "BLINKOFF|" D_BLINKOFF ;
|
|
||||||
|
|
||||||
// xdrv_02_webserver.ino
|
// xdrv_02_webserver.ino
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
const char HTTP_SNS_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%s°%c{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
const char HTTP_SNS_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%s°%c{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||||
|
@ -761,25 +761,26 @@ bool DecodeCommand(const char* haystack, void (* const MyCommand[])(void))
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char kOptions[] PROGMEM = "OFF|" D_OFF "|" D_FALSE "|" D_STOP "|" D_CELSIUS "|" // 0
|
||||||
|
"ON|" D_ON "|" D_TRUE "|" D_START "|" D_FAHRENHEIT "|" D_USER "|" // 1
|
||||||
|
"TOGGLE|" D_TOGGLE "|" D_ADMIN "|" // 2
|
||||||
|
"BLINK|" D_BLINK "|" // 3
|
||||||
|
"BLINKOFF|" D_BLINKOFF "|" // 4
|
||||||
|
"ALL" ; // 255
|
||||||
|
|
||||||
|
const uint8_t sNumbers[] PROGMEM = { 0,0,0,0,0,
|
||||||
|
1,1,1,1,1,1,
|
||||||
|
2,2,2,
|
||||||
|
3,3,
|
||||||
|
4,4,
|
||||||
|
255 };
|
||||||
|
|
||||||
int GetStateNumber(char *state_text)
|
int GetStateNumber(char *state_text)
|
||||||
{
|
{
|
||||||
char command[CMDSZ];
|
char command[CMDSZ];
|
||||||
int state_number = -1;
|
int state_number = GetCommandCode(command, sizeof(command), state_text, kOptions);
|
||||||
|
if (state_number >= 0) {
|
||||||
if (GetCommandCode(command, sizeof(command), state_text, kOptionOff) >= 0) {
|
state_number = pgm_read_byte(sNumbers + state_number);
|
||||||
state_number = 0;
|
|
||||||
}
|
|
||||||
else if (GetCommandCode(command, sizeof(command), state_text, kOptionOn) >= 0) {
|
|
||||||
state_number = 1;
|
|
||||||
}
|
|
||||||
else if (GetCommandCode(command, sizeof(command), state_text, kOptionToggle) >= 0) {
|
|
||||||
state_number = 2;
|
|
||||||
}
|
|
||||||
else if (GetCommandCode(command, sizeof(command), state_text, kOptionBlink) >= 0) {
|
|
||||||
state_number = 3;
|
|
||||||
}
|
|
||||||
else if (GetCommandCode(command, sizeof(command), state_text, kOptionBlinkOff) >= 0) {
|
|
||||||
state_number = 4;
|
|
||||||
}
|
}
|
||||||
return state_number;
|
return state_number;
|
||||||
}
|
}
|
||||||
|
@ -859,20 +859,19 @@ void CmndGpios(void)
|
|||||||
bool jsflg = false;
|
bool jsflg = false;
|
||||||
for (uint32_t i = 0; i < sizeof(kGpioNiceList); i++) {
|
for (uint32_t i = 0; i < sizeof(kGpioNiceList); i++) {
|
||||||
midx = pgm_read_byte(kGpioNiceList + i);
|
midx = pgm_read_byte(kGpioNiceList + i);
|
||||||
if (!GetUsedInModule(midx, cmodule.io)) {
|
if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; }
|
||||||
if (!jsflg) {
|
if (!jsflg) {
|
||||||
Response_P(PSTR("{\"" D_CMND_GPIOS "%d\":["), lines);
|
Response_P(PSTR("{\"" D_CMND_GPIOS "%d\":["), lines);
|
||||||
} else {
|
} else {
|
||||||
ResponseAppend_P(PSTR(","));
|
ResponseAppend_P(PSTR(","));
|
||||||
}
|
}
|
||||||
jsflg = true;
|
jsflg = true;
|
||||||
char stemp1[TOPSZ];
|
char stemp1[TOPSZ];
|
||||||
if ((ResponseAppend_P(PSTR("\"%d (%s)\""), midx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)) > (LOGSZ - TOPSZ)) || (i == sizeof(kGpioNiceList) -1)) {
|
if ((ResponseAppend_P(PSTR("\"%d (%s)\""), midx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)) > (LOGSZ - TOPSZ)) || (i == sizeof(kGpioNiceList) -1)) {
|
||||||
ResponseAppend_P(PSTR("]}"));
|
ResponseAppend_P(PSTR("]}"));
|
||||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, UpperCase(XdrvMailbox.command, XdrvMailbox.command));
|
MqttPublishPrefixTopic_P(RESULT_OR_STAT, UpperCase(XdrvMailbox.command, XdrvMailbox.command));
|
||||||
jsflg = false;
|
jsflg = false;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mqtt_data[0] = '\0';
|
mqtt_data[0] = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user