Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 026244e

Browse files
committed
debug update state for backend
1 parent 1de20b9 commit 026244e

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/base_circuitpython/neopixel_write.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import sys
99
import os
1010

11-
from common import utils
12-
from common import debugger_communication_client
11+
import common
1312
from adafruit_circuitplayground import cp
1413
import base_cp_constants as CONSTANTS
1514

@@ -31,12 +30,12 @@ def neopixel_write(gpio, buf):
3130

3231
def send_clue(buf):
3332
sendable_json = {CONSTANTS.PIXELS: tuple(buf)}
34-
if utils.debug_mode:
35-
debugger_communication_client.debug_send_to_simulator(
33+
if common.utils.debug_mode:
34+
common.debugger_communication_client.debug_send_to_simulator(
3635
sendable_json, CONSTANTS.CLUE
3736
)
3837
else:
39-
utils.send_to_simulator(sendable_json, CONSTANTS.CLUE)
38+
common.utils.send_to_simulator(sendable_json, CONSTANTS.CLUE)
4039

4140

4241
def send_cpx(buf):

src/common/debugger_communication_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
from microbit.__model.microbit_model import __mb as mb
1818
from microbit.__model.constants import MICROBIT
1919

20+
from base_circuitpython.base_cp_constants import CLUE
21+
from adafruit_clue import clue
2022

21-
device_dict = {CPX: cpx, MICROBIT: mb}
23+
device_dict = {CPX: cpx, MICROBIT: mb, CLUE: clue}
2224
processing_state_event = threading.Event()
2325
previous_state = {}
2426

@@ -27,7 +29,6 @@
2729
def debug_send_to_simulator(state, active_device):
2830
global previous_state
2931
if state != previous_state:
30-
print("here!")
3132
previous_state = copy.deepcopy(state)
3233

3334
updated_state = utils.update_state_with_device_name(state, active_device)

src/debug_user_code.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@
2626
)
2727
sys.path.insert(0, abs_path_to_micropython_lib)
2828

29+
# Insert absolute path to library for CLUE into sys.path
30+
sys.path.insert(0, os.path.join(abs_path_to_parent_dir, CONSTANTS.CLUE))
31+
32+
# Insert absolute path to Circuitpython libraries for CLUE into sys.path
33+
sys.path.insert(0, os.path.join(abs_path_to_parent_dir, CONSTANTS.CIRCUITPYTHON))
34+
2935
# This import must happen after the sys.path is modified
30-
from adafruit_circuitplayground.express import cpx
31-
from microbit.__model.microbit_model import __mb as mb
3236
from common import debugger_communication_client
3337

34-
3538
## Execute User Code ##
3639

37-
3840
# Get user's code path
3941
abs_path_to_code_file = ""
4042
if len(sys.argv) > 1 and sys.argv[1]:

0 commit comments

Comments
 (0)