Skip to content

Commit 6b93f97

Browse files
authored
Removing some prior changes
1 parent 127346f commit 6b93f97

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

supervisor/shared/background_callback.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ STATIC volatile background_callback_t *callback_head, *callback_tail;
3737
#define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts())
3838
#define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts())
3939

40-
uint64_t last_background_tick = 0;
41-
42-
uint64_t get_background_ticks(void) {
43-
return last_background_tick;
44-
}
45-
4640
void background_callback_add_core(background_callback_t *cb) {
47-
last_background_tick = port_get_raw_ticks(NULL);
4841
CALLBACK_CRITICAL_BEGIN;
4942
if (cb->prev || callback_head == cb) {
5043
CALLBACK_CRITICAL_END;

supervisor/shared/tick.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "supervisor/shared/tick.h"
2828

2929
#include "py/mpstate.h"
30+
#include "py/runtime.h"
3031
#include "supervisor/linker.h"
3132
#include "supervisor/filesystem.h"
3233
#include "supervisor/background_callback.h"
@@ -36,7 +37,7 @@
3637

3738
#if CIRCUITPY_BLEIO
3839
#include "supervisor/shared/bluetooth.h"
39-
#include "common-hal/_bleio/bonding.h"
40+
#include "common-hal/_bleio/__init__.h"
4041
#endif
4142

4243
#if CIRCUITPY_DISPLAYIO
@@ -68,6 +69,8 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks);
6869

6970
static background_callback_t tick_callback;
7071

72+
volatile uint64_t last_finished_tick = 0;
73+
7174
void supervisor_background_tasks(void *unused) {
7275
port_start_background_task();
7376

@@ -84,7 +87,7 @@ void supervisor_background_tasks(void *unused) {
8487

8588
#if CIRCUITPY_BLEIO
8689
supervisor_bluetooth_background();
87-
bonding_background();
90+
bleio_background();
8891
#endif
8992

9093
port_background_task();
@@ -95,7 +98,7 @@ void supervisor_background_tasks(void *unused) {
9598
}
9699

97100
bool supervisor_background_tasks_ok(void) {
98-
return port_get_raw_ticks(NULL) - get_background_ticks() < 1024;
101+
return port_get_raw_ticks(NULL) - last_finished_tick < 1024;
99102
}
100103

101104
void supervisor_tick(void) {
@@ -145,17 +148,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
145148
while (remaining > 0) {
146149
RUN_BACKGROUND_TASKS;
147150
// Check to see if we've been CTRL-Ced by autoreload or the user.
148-
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)))
149-
{
150-
// clear exception and generate stacktrace
151-
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
152-
nlr_raise(&MP_STATE_VM(mp_kbd_exception));
153-
}
154-
if( MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
155-
WATCHDOG_EXCEPTION_CHECK()) {
156-
// stop sleeping immediately
157-
break;
158-
}
151+
mp_handle_pending();
159152
remaining = end_tick - port_get_raw_ticks(NULL);
160153
// We break a bit early so we don't risk setting the alarm before the time when we call
161154
// sleep.

0 commit comments

Comments
 (0)