From e6daa245619407842b5f388be5bead1aa7485f84 Mon Sep 17 00:00:00 2001 From: Tassilo Schweyer Date: Mon, 29 Dec 2025 01:15:51 +0100 Subject: [PATCH 1/2] disable neopixel for now --- shittyrobot.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shittyrobot.py b/shittyrobot.py index 3262b6f..aa81c3a 100644 --- a/shittyrobot.py +++ b/shittyrobot.py @@ -117,19 +117,19 @@ def mainloop(l): last_pixel_update = 0 - for i in range(6): - LED_NP[i] = (255,255,255, 255) - LED_NP.write() - time.sleep(1) + #for i in range(6): + # LED_NP[i] = (255,255,255, 255) + #LED_NP.write() + #time.sleep(1) while True: ctr += 1 # run one iteration of control loop last_action_start = controlloop(last_action_start, next_action) - if time.time() > last_pixel_update + 0.5: - #LED_NP[ctr % 6] = (ctr*3 % 255, ctr*2 % 255, (ctr+1)*3 % 255) - last_pixel_update = time.time() - LED_NP.write() + #if time.time() > last_pixel_update + 0.5: + # #LED_NP[ctr % 6] = (ctr*3 % 255, ctr*2 % 255, (ctr+1)*3 % 255) + # last_pixel_update = time.time() + # LED_NP.write() a = None try: From a7c3d5f84d45f682dcddcb9609885f25b5500e2d Mon Sep 17 00:00:00 2001 From: Tassilo Schweyer Date: Mon, 29 Dec 2025 01:20:21 +0100 Subject: [PATCH 2/2] debug print statements optional --- shittyrobot.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/shittyrobot.py b/shittyrobot.py index aa81c3a..07d2dc7 100644 --- a/shittyrobot.py +++ b/shittyrobot.py @@ -61,21 +61,28 @@ do_ap() s = setup_listener() c = [] +debug = False + def controlloop(last_start, next_action): now = time.ticks_us() + + if debug: + print('CTRL: ', last_start, next_action) - print('CTRL: ', last_start, next_action) if time.ticks_diff(now, time.ticks_add(last_start, 100000)) < 0: - print(' DEADTIME -> ignore') - return last_start + if debug: + print(' DEADTIME -> ignore') + return last_start if next_action is None and time.ticks_diff(time.ticks_add(last_start, 601000), now) > 0: - print(' ACTION TIMED OUT -> stopping') - next_action = (0,0) + if debug: + print(' ACTION TIMED OUT -> stopping') + next_action = (0,0) elif next_action is None: - return last_start - - print('Starting action: ', next_action) + return last_start + + if debug: + print('Starting action: ', next_action) if next_action[0] == 1: MOTOR_A0.on() @@ -134,7 +141,8 @@ def mainloop(l): a = None try: a = y.read(1) - print('RCV: ', a) + if debug: + print('RCV: ', a) y.write(a) except OSError: # timeout