Skip to content

Commit 4d8df2d

Browse files
committed
More efficient loop extension
1 parent 1006766 commit 4d8df2d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

cores/esp8266/core_esp8266_main.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ extern "C" {
3939
#define OPTIMISTIC_YIELD_TIME_US 16000
4040

4141
extern "C" void call_user_start();
42-
extern void loop();
4342
extern void setup();
4443
extern void (*__init_array_start)(void);
4544
extern void (*__init_array_end)(void);
@@ -155,21 +154,19 @@ extern "C" bool IRAM_ATTR ets_post(uint8 prio, ETSSignal sig, ETSParam par) {
155154
return rc;
156155
}
157156

158-
extern "C" void __loop_end (void)
159-
{
157+
extern "C" void esp_loop(void) __attribute__((weak));
158+
extern "C" void esp_loop(void) {
159+
loop();
160160
}
161161

162-
extern "C" void loop_end (void) __attribute__ ((weak, alias("__loop_end")));
163-
164162
static void loop_wrapper() {
165163
static bool setup_done = false;
166164
preloop_update_frequency();
167165
if(!setup_done) {
168166
setup();
169167
setup_done = true;
170168
}
171-
loop();
172-
loop_end();
169+
esp_loop();
173170
esp_schedule();
174171
}
175172

libraries/Schedule/src/Schedule.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
#include <interrupts.h>
77
#include <coredecls.h>
88

9-
extern "C" void loop_end()
9+
extern "C" void esp_loop()
1010
{
11+
loop();
1112
run_scheduled_functions();
1213
run_scheduled_recurrent_functions();}
1314

0 commit comments

Comments
 (0)