Fix xdrv_99_debug.ino compilation

Fix xdrv_99_debug.ino compilation error on core 2.4.2 (#3566)
This commit is contained in:
Theo Arends 2018-08-24 11:30:16 +02:00
parent 2c949bac7e
commit 5977bd37e1
1 changed files with 25 additions and 0 deletions

View File

@ -180,6 +180,9 @@ void CpuLoadLoop()
/*******************************************************************************************/ /*******************************************************************************************/
#if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_1)
// All version before core 2.4.2
extern "C" { extern "C" {
#include <cont.h> #include <cont.h>
extern cont_t g_cont; extern cont_t g_cont;
@ -198,6 +201,28 @@ void DebugFreeMem()
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
} }
#else
// All version from core 2.4.2
// https://github.com/esp8266/Arduino/pull/5018
// https://github.com/esp8266/Arduino/pull/4553
extern "C" {
#include <cont.h>
extern cont_t* g_pcont;
}
void DebugFreeMem()
{
// https://github.com/esp8266/Arduino/issues/2557
register uint32_t *sp asm("a1");
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"),
ESP.getFreeHeap(), 4 * (sp - g_pcont->stack), XdrvMailbox.data);
AddLog(LOG_LEVEL_DEBUG);
}
#endif // ARDUINO_ESP8266_RELEASE_2_x_x
/*******************************************************************************************/ /*******************************************************************************************/
void DebugCfgDump(char* parms) void DebugCfgDump(char* parms)