Skip to content

Commit afe4021

Browse files
committed
Corrections after review remarks; thanks @earlephilhower
1 parent 50fab51 commit afe4021

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cores/esp8266/core_esp8266_main.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ cont_t* g_pcont __attribute__((section(".noinit")));
5656
/* Event queue used by the main (arduino) task */
5757
static os_event_t s_loop_queue[LOOP_QUEUE_SIZE];
5858

59-
/* Used to implement __optimistic_yield */
60-
static uint32_t s_cycles_since_yield_start;
59+
/* Used to implement optimistic_yield */
60+
static uint32_t s_cycles_at_yield_start;
6161

6262
/* For ets_intr_lock_nest / ets_intr_unlock_nest
6363
* Max nesting seen by SDK so far is 2.
@@ -96,7 +96,7 @@ extern "C" bool can_yield() {
9696
static inline void esp_yield_within_cont() __attribute__((always_inline));
9797
static void esp_yield_within_cont() {
9898
cont_yield(g_pcont);
99-
s_cycles_since_yield_start = ESP.getCycleCount();
99+
s_cycles_at_yield_start = ESP.getCycleCount();
100100
run_scheduled_recurrent_functions();
101101
}
102102

@@ -129,9 +129,9 @@ extern "C" void optimistic_yield(uint32_t interval_us) {
129129
#if defined(F_CPU)
130130
clockCyclesPerMicrosecond();
131131
#else
132-
getCpuFreqMHz();
132+
ESP.getCpuFreqMHz();
133133
#endif
134-
if ((ESP.getCycleCount() - s_cycles_since_yield_start) > intvl_cycles &&
134+
if ((ESP.getCycleCount() - s_cycles_at_yield_start) > intvl_cycles &&
135135
can_yield())
136136
{
137137
yield();
@@ -188,7 +188,7 @@ static void loop_wrapper() {
188188

189189
static void loop_task(os_event_t *events) {
190190
(void) events;
191-
s_cycles_since_yield_start = ESP.getCycleCount();
191+
s_cycles_at_yield_start = ESP.getCycleCount();
192192
cont_run(g_pcont, &loop_wrapper);
193193
if (cont_check(g_pcont) != 0) {
194194
panic();

0 commit comments

Comments
 (0)