summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavePutz <dwputz@gmail.com>2020-09-14 10:53:30 -0500
committerGitHub <noreply@github.com>2020-09-14 10:53:30 -0500
commit6b93f97de1e535b9b921b68c85360bfee5cc38c1 (patch)
tree5108c0742c5f049f5d688a45093660e040ffe60f
parent127346f7aeaddd724449c1c5beb71d5ad0c169a5 (diff)
Removing some prior changes
-rw-r--r--supervisor/shared/background_callback.c7
-rw-r--r--supervisor/shared/tick.c21
2 files changed, 7 insertions, 21 deletions
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c
index 154618297..8e12dd362 100644
--- a/supervisor/shared/background_callback.c
+++ b/supervisor/shared/background_callback.c
@@ -37,14 +37,7 @@ STATIC volatile background_callback_t *callback_head, *callback_tail;
#define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts())
#define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts())
-uint64_t last_background_tick = 0;
-
-uint64_t get_background_ticks(void) {
- return last_background_tick;
-}
-
void background_callback_add_core(background_callback_t *cb) {
- last_background_tick = port_get_raw_ticks(NULL);
CALLBACK_CRITICAL_BEGIN;
if (cb->prev || callback_head == cb) {
CALLBACK_CRITICAL_END;
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c
index eac5104a5..012f2c80e 100644
--- a/supervisor/shared/tick.c
+++ b/supervisor/shared/tick.c
@@ -27,6 +27,7 @@
#include "supervisor/shared/tick.h"
#include "py/mpstate.h"
+#include "py/runtime.h"
#include "supervisor/linker.h"
#include "supervisor/filesystem.h"
#include "supervisor/background_callback.h"
@@ -36,7 +37,7 @@
#if CIRCUITPY_BLEIO
#include "supervisor/shared/bluetooth.h"
-#include "common-hal/_bleio/bonding.h"
+#include "common-hal/_bleio/__init__.h"
#endif
#if CIRCUITPY_DISPLAYIO
@@ -68,6 +69,8 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks);
static background_callback_t tick_callback;
+volatile uint64_t last_finished_tick = 0;
+
void supervisor_background_tasks(void *unused) {
port_start_background_task();
@@ -84,7 +87,7 @@ void supervisor_background_tasks(void *unused) {
#if CIRCUITPY_BLEIO
supervisor_bluetooth_background();
- bonding_background();
+ bleio_background();
#endif
port_background_task();
@@ -95,7 +98,7 @@ void supervisor_background_tasks(void *unused) {
}
bool supervisor_background_tasks_ok(void) {
- return port_get_raw_ticks(NULL) - get_background_ticks() < 1024;
+ return port_get_raw_ticks(NULL) - last_finished_tick < 1024;
}
void supervisor_tick(void) {
@@ -145,17 +148,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
while (remaining > 0) {
RUN_BACKGROUND_TASKS;
// Check to see if we've been CTRL-Ced by autoreload or the user.
- if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)))
- {
- // clear exception and generate stacktrace
- MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
- nlr_raise(&MP_STATE_VM(mp_kbd_exception));
- }
- if( MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
- WATCHDOG_EXCEPTION_CHECK()) {
- // stop sleeping immediately
- break;
- }
+ mp_handle_pending();
remaining = end_tick - port_get_raw_ticks(NULL);
// We break a bit early so we don't risk setting the alarm before the time when we call
// sleep.