Skip to content

Commit 71df60c

Browse files
robert-hhdpgeorge
authored andcommitted
esp8266/ets_alt_task.c: Prevent spurious large increment of ticks_ms()
This happened when the overflow counter for ticks_ms() was interrupted by an external hard interrupt (issue micropython#3076).
1 parent ec53460 commit 71df60c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

esp8266/ets_alt_task.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ bool ets_loop_iter(void) {
120120
}
121121

122122
// handle overflow of system microsecond counter
123+
ets_intr_lock();
123124
uint32_t system_time_cur = system_get_time();
124125
if (system_time_cur < system_time_prev) {
125126
system_time_high_word += 1; // record overflow of low 32-bits
126127
}
127128
system_time_prev = system_time_cur;
129+
ets_intr_unlock();
128130

129131
//static unsigned cnt;
130132
bool progress = false;

0 commit comments

Comments
 (0)