diff --git a/python_payload/cap_touch_demo.py b/python_payload/harmonic_demo.py similarity index 100% rename from python_payload/cap_touch_demo.py rename to python_payload/harmonic_demo.py diff --git a/python_payload/main.py b/python_payload/main.py index 92aa3c6cadf4049df6b86f06dae0174c866c64bb..1bbeed1cfff9bb45b2aa9908ae2252b7b762fe0a 100644 --- a/python_payload/main.py +++ b/python_payload/main.py @@ -1,40 +1,29 @@ -from machine import Pin from hardware import * import utils import time -import cap_touch_demo +import harmonic_demo import melodic_demo MODULES = [ - cap_touch_demo, + harmonic_demo, melodic_demo, ] -BOOTSEL_PIN = Pin(0, Pin.IN) -VOL_UP_PIN = Pin(35, Pin.IN, Pin.PULL_UP) -VOL_DOWN_PIN = Pin(37, Pin.IN, Pin.PULL_UP) - CURRENT_APP_RUN = None VOLUME = 0 SELECT_TEXT = [ - " ## #### # #### ## ##### #", - "# # # # # # # # #", - "# # # # # # #", - " ## #### # #### # # #", - " # # # # # # #", - "# # # # # # # # ", - " ## #### #### #### ## # #", + " ## #### # #### ## ##### ", + "# # # # # # # # ##" , + "# # # # # # # #", + " ## #### # #### # # #" , + " # # # # # # # #", + "# # # # # # # # ## ", + " ## #### #### #### ## # ", ] BACKGROUND_COLOR = 0 -# pin numbers -# right side: left 37, down 0, right 35 -# left side: left 7, down 6, right 5 -# NOTE: All except for 0 should be initialized with Pin.PULL_UP -# 0 (bootsel) probably not but idk? never tried - def run_menu(): global CURRENT_APP_RUN display_fill(BACKGROUND_COLOR) @@ -95,16 +84,16 @@ def main(): set_global_volume_dB(VOLUME) while True: - if(BOOTSEL_PIN.value() == 0): + if(get_button(0) == 2): if CURRENT_APP_RUN == run_menu: captouch_autocalib() else: CURRENT_APP_RUN = run_menu foreground_menu() - if(VOL_UP_PIN.value() == 0): - set_rel_volume(+3) - if(VOL_DOWN_PIN.value() == 0): - set_rel_volume(-3) + if(get_button(0) == 1): + set_rel_volume(+1) + if(get_button(0) == -1): + set_rel_volume(-1) CURRENT_APP_RUN() main() diff --git a/python_payload/utils.py b/python_payload/utils.py index 52b2b00f509c8a66ab0328fe396598dd63d2ef6c..88ca4d3ba33ff0c8f5f66d5182b3f4dc97871ba9 100644 --- a/python_payload/utils.py +++ b/python_payload/utils.py @@ -11,8 +11,8 @@ def clear_all_leds(): update_leds() def draw_text_big(text, x, y): - ypos = 120+int(len(text)/2) + int(y) - xpos = 120+int(len(text[0])/2) + int(x) + ypos = 120+int(len(text)) + int(y) + xpos = 120+int(len(text[0])) + int(x) for l, line in enumerate(text): for p, pixel in enumerate(line): if(pixel == '#'):