Skip to content

Commit

Permalink
Merge pull request xoseperez#1195 from mcspr/rename-cont_t
Browse files Browse the repository at this point in the history
Rename cont_t for Core 2.4.2 and higher
  • Loading branch information
xoseperez committed Sep 16, 2018
2 parents 75757bb + d463d7c commit e7845ac
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
4 changes: 0 additions & 4 deletions code/espurna/config/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@
#include "sensors.h"
#include "webui.h"
#include "progmem.h"

#ifdef USE_CORE_VERSION_H
#include "core_version.h"
#endif
1 change: 1 addition & 0 deletions code/espurna/config/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <ArduinoJson.h>
#include <functional>
#include <pgmspace.h>
#include <core_version.h>

extern "C" {
#include "user_interface.h"
Expand Down
24 changes: 20 additions & 4 deletions code/espurna/utils.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,31 @@ Copyright (C) 2017-2018 by Xose Pérez <xose dot perez at gmail dot com>
*/

// Core version 2.4.2 and higher changed the cont_t structure to a pointer:
// https://github.com/esp8266/Arduino/commit/5d5ea92a4d004ab009d5f642629946a0cb8893dd#diff-3fa12668b289ccb95b7ab334833a4ba8L35
#if defined(ARDUINO_ESP8266_RELEASE_2_3_0) \
|| defined(ARDUINO_ESP8266_RELEASE_2_4_0) \
|| defined(ARDUINO_ESP8266_RELEASE_2_4_1)
extern "C" {
#include <cont.h>
extern cont_t g_cont;

}

unsigned int getFreeStack() {
return cont_get_free_stack(&g_cont);
}
#else
extern "C" {
#include <cont.h>
extern cont_t* g_pcont;
}

unsigned int getFreeStack() {
return cont_get_free_stack(g_pcont);
}
#endif // defined(ARDUINO_ESP8266_RELEASE_2_3_0/2_4_0/2_4_1)

#include <Ticker.h>
Ticker _defer_reset;

Expand Down Expand Up @@ -81,10 +101,6 @@ unsigned int getUsedHeap() {
return getInitialFreeHeap() - getFreeHeap();
}

unsigned int getFreeStack() {
return cont_get_free_stack(&g_cont);
}

String getEspurnaModules() {
return FPSTR(espurna_modules);
}
Expand Down
5 changes: 3 additions & 2 deletions code/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ platform_150 = espressif8266@1.5.0
platform_160 = espressif8266@1.6.0
platform_173 = espressif8266@1.7.3
platform_180 = espressif8266@1.8.0
platform_latest = ${common.platform_180}
platform = ${common.platform_150}

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -193,7 +194,7 @@ monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:travis02]
platform = ${common.platform_173}
platform = ${common.platform_latest}
framework = ${common.framework}
board = ${common.board_4m}
board_build.flash_mode = ${common.flash_mode}
Expand All @@ -204,7 +205,7 @@ monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:travis03]
platform = ${common.platform_173}
platform = ${common.platform_latest}
framework = ${common.framework}
board = ${common.board_4m}
board_build.flash_mode = ${common.flash_mode}
Expand Down

0 comments on commit e7845ac

Please sign in to comment.