From 9c0b2ed1d074fb428d79fd873d91d6bcc15cbceb Mon Sep 17 00:00:00 2001 From: Bailey Steinfadt Date: Fri, 1 Nov 2024 16:49:51 -0500 Subject: [PATCH 1/4] Added comment for which location pins refer to as they are set up --- software/software/boot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/software/software/boot.py b/software/software/boot.py index c62c08b..74c1468 100644 --- a/software/software/boot.py +++ b/software/software/boot.py @@ -16,21 +16,27 @@ buttonC = Pin(28, Pin.IN, Pin.PULL_UP) ## GPIOs +# Position 1 gpio11 = Pin(7, Pin.OUT) gpio12 = Pin(6, Pin.OUT) +# Position 2 gpio21 = Pin(5, Pin.OUT) gpio22 = Pin(4, Pin.OUT) +# Position 3 gpio31 = Pin(3, Pin.OUT) gpio32 = Pin(2, Pin.OUT) +# Position 4 gpio41 = Pin(22, Pin.OUT) gpio42 = Pin(21, Pin.OUT) +# Position 5 gpio51 = Pin(20, Pin.OUT) gpio52 = Pin(19, Pin.OUT) +# Position 6 gpio61 = Pin(18, Pin.OUT) gpio62 = Pin(17, Pin.OUT) From 2814d13128805b52bfa7ab907e797db7347a090d Mon Sep 17 00:00:00 2001 From: Bailey Steinfadt Date: Fri, 1 Nov 2024 16:50:12 -0500 Subject: [PATCH 2/4] Made pink wait light yellow to match comment --- software/software/boot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/software/boot.py b/software/software/boot.py index 74c1468..60fb70a 100644 --- a/software/software/boot.py +++ b/software/software/boot.py @@ -103,7 +103,7 @@ def petal_init(bus): ## waiting for wheel with a yellow light if petal_bus: petal_bus.writeto_mem(PETAL_ADDRESS, 3, bytes([0x80])) - petal_bus.writeto_mem(PETAL_ADDRESS, 2, bytes([0x80])) + petal_bus.writeto_mem(PETAL_ADDRESS, 4, bytes([0x80])) ## touchwheel last, with a wait loop, b/c it doesn't init until animation is over ## probably need to implement a timeout here? From 3afccbd6d213461541567c929aee704e8f79855f Mon Sep 17 00:00:00 2001 From: Bailey Steinfadt Date: Fri, 1 Nov 2024 16:50:46 -0500 Subject: [PATCH 3/4] Replaced "magic" address with TOUCHWHEEL_ADDRESS --- software/software/boot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/software/software/boot.py b/software/software/boot.py index 60fb70a..dbc365b 100644 --- a/software/software/boot.py +++ b/software/software/boot.py @@ -124,13 +124,13 @@ def petal_init(bus): def touchwheel_read(bus): """Returns 0 for no touch, 1-255 clockwise around the circle from the south""" - return(touchwheel_bus.readfrom_mem(84, 0, 1)[0]) + return(touchwheel_bus.readfrom_mem(TOUCHWHEEL_ADDRESS, 0, 1)[0]) def touchwheel_rgb(bus, r, g, b): """RGB color on the central display. Each 0-255""" - touchwheel_bus.writeto_mem(84, 15, bytes([r])) - touchwheel_bus.writeto_mem(84, 16, bytes([g])) - touchwheel_bus.writeto_mem(84, 17, bytes([b])) + touchwheel_bus.writeto_mem(TOUCHWHEEL_ADDRESS, 15, bytes([r])) + touchwheel_bus.writeto_mem(TOUCHWHEEL_ADDRESS, 16, bytes([g])) + touchwheel_bus.writeto_mem(TOUCHWHEEL_ADDRESS, 17, bytes([b])) ## goes green if wheel configured From c4e2cdf4d41a6f1b486e23997d3189f99f89cf6e Mon Sep 17 00:00:00 2001 From: Bailey Steinfadt Date: Fri, 1 Nov 2024 16:51:30 -0500 Subject: [PATCH 4/4] Fixed end of boot to go green if touchwheel is configured and red if it isn't found --- software/software/boot.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/software/software/boot.py b/software/software/boot.py index dbc365b..0b05922 100644 --- a/software/software/boot.py +++ b/software/software/boot.py @@ -134,11 +134,14 @@ def touchwheel_rgb(bus, r, g, b): ## goes green if wheel configured +## goes red if wheel is not found if touchwheel_bus and petal_bus: - petal_bus.writeto_mem(PETAL_ADDRESS, 3, bytes([0x00])) -if petal_bus: - petal_bus.writeto_mem(PETAL_ADDRESS, 2, bytes([0x80])) + petal_bus.writeto_mem(PETAL_ADDRESS, 4, bytes([0x80])) time.sleep_ms(200) - petal_bus.writeto_mem(PETAL_ADDRESS, 2, bytes([0x00])) + petal_bus.writeto_mem(PETAL_ADDRESS, 4, bytes([0x00])) +if petal_bus and not touchwheel_bus: + petal_bus.writeto_mem(PETAL_ADDRESS, 3, bytes([0x80])) + time.sleep_ms(200) + petal_bus.writeto_mem(PETAL_ADDRESS, 3, bytes([0x00]))