Merge pull request #10274 from s-hadinger/minimal_without_json

Reduce tasmota-minmal by 4kb
This commit is contained in:
Theo Arends 2020-12-27 14:26:32 +01:00 committed by GitHub
commit 31fedcb000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -1284,12 +1284,14 @@ void CmndTemplate(void)
} }
} }
else { else {
if (JsonTemplate(XdrvMailbox.data)) { // Free 336 bytes StaticJsonBuffer stack space by moving code to function #ifndef FIRMWARE_MINIMAL // if tasmota-minimal, `Template` is read-only
if (JsonTemplate(XdrvMailbox.data)) {
if (USER_MODULE == Settings.module) { TasmotaGlobal.restart_flag = 2; } if (USER_MODULE == Settings.module) { TasmotaGlobal.restart_flag = 2; }
} else { } else {
ResponseCmndChar_P(PSTR(D_JSON_INVALID_JSON)); ResponseCmndChar_P(PSTR(D_JSON_INVALID_JSON));
error = true; error = true;
} }
#endif // FIRMWARE_MINIMAL
} }
if (!error) { TemplateJson(); } if (!error) { TemplateJson(); }
} }

View File

@ -3401,7 +3401,9 @@ void CmndWebColor(void)
} }
} }
else { else {
#ifndef FIRMWARE_MINIMAL // if tasmota-minimal, read only and don't parse JSON
JsonWebColor(XdrvMailbox.data); JsonWebColor(XdrvMailbox.data);
#endif // FIRMWARE_MINIMAL
} }
} }
Response_P(PSTR("{\"" D_CMND_WEBCOLOR "\":[")); Response_P(PSTR("{\"" D_CMND_WEBCOLOR "\":["));