Fix compiling error with ESPlib 2.3.0
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
//#include <SPI.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_SERIALDEVICE Serial
|
#define MY_SERIALDEVICE Serial
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
#define hwDigitalWrite(__pin, __value) (digitalWrite(__pin, __value))
|
#define hwDigitalWrite(__pin, __value) (digitalWrite(__pin, __value))
|
||||||
#define hwInit() MY_SERIALDEVICE.begin(MY_BAUD_RATE); MY_SERIALDEVICE.setDebugOutput(true)
|
#define hwInit() MY_SERIALDEVICE.begin(MY_BAUD_RATE); MY_SERIALDEVICE.setDebugOutput(true)
|
||||||
#define hwWatchdogReset() wdt_reset()
|
#define hwWatchdogReset() wdt_reset()
|
||||||
#define hwReboot() wdt_enable(WDTO_15MS); while (1)
|
#define hwReboot() ESP.restart();
|
||||||
#define hwMillis() millis()
|
#define hwMillis() millis()
|
||||||
|
|
||||||
void hwReadConfigBlock(void* buf, void* adr, size_t length);
|
void hwReadConfigBlock(void* buf, void* adr, size_t length);
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
//This may be used to change user task stack size:
|
||||||
|
//#define CONT_STACKSIZE 4096
|
||||||
|
#include "Schedule.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "ets_sys.h"
|
#include "ets_sys.h"
|
||||||
#include "os_type.h"
|
#include "os_type.h"
|
||||||
@@ -7,14 +10,25 @@ extern "C" {
|
|||||||
#include "user_interface.h"
|
#include "user_interface.h"
|
||||||
#include "cont.h"
|
#include "cont.h"
|
||||||
}
|
}
|
||||||
|
#include <core_version.h>
|
||||||
|
|
||||||
#define LOOP_TASK_PRIORITY 0
|
#define LOOP_TASK_PRIORITY 1
|
||||||
#define LOOP_QUEUE_SIZE 1
|
#define LOOP_QUEUE_SIZE 1
|
||||||
|
|
||||||
#define OPTIMISTIC_YIELD_TIME_US 16000
|
#define OPTIMISTIC_YIELD_TIME_US 16000
|
||||||
|
|
||||||
struct rst_info resetInfo;
|
struct rst_info resetInfo;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern const uint32_t __attribute__((section(".ver_number"))) core_version = ARDUINO_ESP8266_GIT_VER;
|
||||||
|
const char* core_release =
|
||||||
|
#ifdef ARDUINO_ESP8266_RELEASE
|
||||||
|
ARDUINO_ESP8266_RELEASE;
|
||||||
|
#else
|
||||||
|
NULL;
|
||||||
|
#endif
|
||||||
|
} // extern "C"
|
||||||
|
|
||||||
int atexit(void(*func)()) {
|
int atexit(void(*func)()) {
|
||||||
(void)func;
|
(void)func;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -25,8 +39,6 @@ void initVariant() __attribute__((weak));
|
|||||||
void initVariant() {
|
void initVariant() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void preloop_update_frequency() __attribute__((weak));
|
void preloop_update_frequency() __attribute__((weak));
|
||||||
void preloop_update_frequency() {
|
void preloop_update_frequency() {
|
||||||
#if defined(F_CPU) && (F_CPU == 160000000L)
|
#if defined(F_CPU) && (F_CPU == 160000000L)
|
||||||
@@ -43,13 +55,6 @@ static os_event_t g_loop_queue[LOOP_QUEUE_SIZE];
|
|||||||
|
|
||||||
static uint32_t g_micros_at_task_start;
|
static uint32_t g_micros_at_task_start;
|
||||||
|
|
||||||
/*
|
|
||||||
extern "C" void abort() {
|
|
||||||
do {
|
|
||||||
*((int*)0) = 0;
|
|
||||||
} while(true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
extern "C" void esp_yield() {
|
extern "C" void esp_yield() {
|
||||||
if (cont_can_yield(&g_cont)) {
|
if (cont_can_yield(&g_cont)) {
|
||||||
cont_yield(&g_cont);
|
cont_yield(&g_cont);
|
||||||
@@ -57,7 +62,7 @@ extern "C" void esp_yield() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void esp_schedule() {
|
extern "C" void esp_schedule() {
|
||||||
system_os_post(LOOP_TASK_PRIORITY, 0, 0);
|
ets_post(LOOP_TASK_PRIORITY, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void __yield() {
|
extern "C" void __yield() {
|
||||||
@@ -66,7 +71,7 @@ extern "C" void __yield() {
|
|||||||
esp_yield();
|
esp_yield();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
abort();
|
panic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,13 +87,13 @@ extern "C" void optimistic_yield(uint32_t interval_us) {
|
|||||||
|
|
||||||
static void loop_wrapper() {
|
static void loop_wrapper() {
|
||||||
static bool setup_done = false;
|
static bool setup_done = false;
|
||||||
|
preloop_update_frequency();
|
||||||
if (!setup_done) {
|
if (!setup_done) {
|
||||||
_begin(); // Startup MySensors library
|
_begin(); // Startup MySensors library
|
||||||
setup_done = true;
|
setup_done = true;
|
||||||
}
|
}
|
||||||
preloop_update_frequency();
|
|
||||||
_process(); // Process incoming data
|
_process(); // Process incoming data
|
||||||
loop();
|
run_scheduled_functions();
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,19 +102,25 @@ static void loop_task(os_event_t *events) {
|
|||||||
g_micros_at_task_start = system_get_time();
|
g_micros_at_task_start = system_get_time();
|
||||||
cont_run(&g_cont, &loop_wrapper);
|
cont_run(&g_cont, &loop_wrapper);
|
||||||
if (cont_check(&g_cont) != 0) {
|
if (cont_check(&g_cont) != 0) {
|
||||||
ets_printf("\r\nsketch stack overflow detected\r\n");
|
panic();
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_global_ctors(void) {
|
static void do_global_ctors(void) {
|
||||||
void (**p)(void);
|
void(**p)(void) = &__init_array_end;
|
||||||
for(p = &__init_array_start; p != &__init_array_end; ++p)
|
while (p != &__init_array_start)
|
||||||
(*p)();
|
(*--p)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void __gdb_init() {}
|
||||||
|
extern "C" void gdb_init(void) __attribute__((weak, alias("__gdb_init")));
|
||||||
|
|
||||||
|
extern "C" void __gdb_do_break() {}
|
||||||
|
extern "C" void gdb_do_break(void) __attribute__((weak, alias("__gdb_do_break")));
|
||||||
|
|
||||||
void init_done() {
|
void init_done() {
|
||||||
system_set_os_print(1);
|
system_set_os_print(1);
|
||||||
|
gdb_init();
|
||||||
do_global_ctors();
|
do_global_ctors();
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
}
|
}
|
||||||
@@ -127,7 +138,7 @@ extern "C" void user_init(void) {
|
|||||||
|
|
||||||
cont_init(&g_cont);
|
cont_init(&g_cont);
|
||||||
|
|
||||||
system_os_task(loop_task,
|
ets_task(loop_task,
|
||||||
LOOP_TASK_PRIORITY, g_loop_queue,
|
LOOP_TASK_PRIORITY, g_loop_queue,
|
||||||
LOOP_QUEUE_SIZE);
|
LOOP_QUEUE_SIZE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user