mirror of https://github.com/arendst/Tasmota.git
Reduce code size
This commit is contained in:
parent
ca82ed07c9
commit
bf26ba3427
|
@ -477,7 +477,7 @@ void CmndStatus(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((0 == payload) || (4 == payload)) {
|
if ((0 == payload) || (4 == payload)) {
|
||||||
float freeMem = ((float)ESP_getFreeHeap()) / 1024;
|
float freeMem = ESP_getFreeHeap1024();
|
||||||
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%1_f,\""
|
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%1_f,\""
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
D_JSON_PSRMAXMEMORY "\":%d,\"" D_JSON_PSRFREEMEMORY "\":%d,\""
|
D_JSON_PSRMAXMEMORY "\":%d,\"" D_JSON_PSRFREEMEMORY "\":%d,\""
|
||||||
|
|
|
@ -47,6 +47,10 @@ uint32_t ESP_getFreeHeap(void) {
|
||||||
return ESP.getFreeHeap();
|
return ESP.getFreeHeap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ESP_getFreeHeap1024(void) {
|
||||||
|
return ((float)ESP_getFreeHeap()) / 1024;
|
||||||
|
}
|
||||||
|
|
||||||
void ESP_Restart(void) {
|
void ESP_Restart(void) {
|
||||||
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
|
// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
|
@ -411,6 +415,10 @@ uint32_t ESP_getFreeHeap(void) {
|
||||||
return ESP.getFreeHeap();
|
return ESP.getFreeHeap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ESP_getFreeHeap1024(void) {
|
||||||
|
return ((float)ESP_getFreeHeap()) / 1024;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t ESP_getMaxAllocHeap(void) {
|
uint32_t ESP_getMaxAllocHeap(void) {
|
||||||
// largest block of heap that can be allocated at once
|
// largest block of heap that can be allocated at once
|
||||||
uint32_t free_block_size = ESP.getMaxAllocHeap();
|
uint32_t free_block_size = ESP.getMaxAllocHeap();
|
||||||
|
|
|
@ -658,7 +658,7 @@ void MqttShowPWMState(void)
|
||||||
void MqttShowState(void)
|
void MqttShowState(void)
|
||||||
{
|
{
|
||||||
char stemp1[TOPSZ];
|
char stemp1[TOPSZ];
|
||||||
float freeMem = ((float)ESP_getFreeHeap()) / 1024;
|
float freeMem = ESP_getFreeHeap1024();
|
||||||
|
|
||||||
ResponseAppendTime();
|
ResponseAppendTime();
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_UPTIME "\":\"%s\",\"UptimeSec\":%u"), GetUptime().c_str(), UpTime());
|
ResponseAppend_P(PSTR(",\"" D_JSON_UPTIME "\":\"%s\",\"UptimeSec\":%u"), GetUptime().c_str(), UpTime());
|
||||||
|
|
|
@ -2063,7 +2063,7 @@ void HandleInformation(void)
|
||||||
|
|
||||||
char stopic[TOPSZ];
|
char stopic[TOPSZ];
|
||||||
|
|
||||||
float freeMem = ((float)ESP_getFreeHeap()) / 1024;
|
float freeMem = ESP_getFreeHeap1024();
|
||||||
|
|
||||||
WSContentStart_P(PSTR(D_INFORMATION));
|
WSContentStart_P(PSTR(D_INFORMATION));
|
||||||
// Save 1k of code space replacing table html with javascript replace codes
|
// Save 1k of code space replacing table html with javascript replace codes
|
||||||
|
|
Loading…
Reference in New Issue