mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
Add webquery message when empty response
This commit is contained in:
parent
07031d5ebf
commit
62afe918f0
@ -3362,14 +3362,15 @@ int WebQuery(char *buffer) {
|
|||||||
// uint32_t len = response.length() + 1;
|
// uint32_t len = response.length() + 1;
|
||||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Response '%*_H' = %s"), len, (uint8_t*)read, read);
|
// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Response '%*_H' = %s"), len, (uint8_t*)read, read);
|
||||||
|
|
||||||
Response_P(PSTR("{\"" D_CMND_WEBQUERY "\":"));
|
|
||||||
char text[3] = { 0 }; // Make room foor double %
|
char text[3] = { 0 }; // Make room foor double %
|
||||||
text[0] = *read++;
|
text[0] = *read++;
|
||||||
|
if (text[0] != '\0') {
|
||||||
|
Response_P(PSTR("{\"" D_CMND_WEBQUERY "\":"));
|
||||||
bool assume_json = (text[0] == '{') || (text[0] == '[');
|
bool assume_json = (text[0] == '{') || (text[0] == '[');
|
||||||
if (!assume_json) { ResponseAppend_P(PSTR("\"")); }
|
if (!assume_json) { ResponseAppend_P(PSTR("\"")); }
|
||||||
while (text[0] != '\0') {
|
while (text[0] != '\0') {
|
||||||
if (text[0] > 31) { // Remove control characters like linefeed
|
if (text[0] > 31) { // Remove control characters like linefeed
|
||||||
if ('%' == text[0]) { // Fix char string expansion for %
|
if ('%' == text[0]) { // Fix char string formatting for %
|
||||||
text[1] = '%';
|
text[1] = '%';
|
||||||
}
|
}
|
||||||
if (assume_json) {
|
if (assume_json) {
|
||||||
@ -3389,6 +3390,9 @@ int WebQuery(char *buffer) {
|
|||||||
tasm_cmd_activ = 0;
|
tasm_cmd_activ = 0;
|
||||||
#endif // USE_SCRIPT
|
#endif // USE_SCRIPT
|
||||||
status = WEBCMND_VALID_RESPONSE;
|
status = WEBCMND_VALID_RESPONSE;
|
||||||
|
} else {
|
||||||
|
status = WEBCMND_DONE;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
#endif // USE_WEBSEND_RESPONSE
|
#endif // USE_WEBSEND_RESPONSE
|
||||||
status = WEBCMND_DONE;
|
status = WEBCMND_DONE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user