Skip to content
Snippets Groups Projects
Commit 4e3027d2 authored by moon2's avatar moon2 :speech_balloon:
Browse files

refactored payload adjusted to new api

parent 44edae10
Branches
No related tags found
No related merge requests found
File moved
from machine import Pin
from hardware import * from hardware import *
import utils import utils
import time import time
import cap_touch_demo import harmonic_demo
import melodic_demo import melodic_demo
MODULES = [ MODULES = [
cap_touch_demo, harmonic_demo,
melodic_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 CURRENT_APP_RUN = None
VOLUME = 0 VOLUME = 0
SELECT_TEXT = [ SELECT_TEXT = [
" ## #### # #### ## ##### #", " ## #### # #### ## ##### ",
"# # # # # # # # #", "# # # # # # # # ##" ,
"# # # # # # #", "# # # # # # # #",
" ## #### # #### # # #" , " ## #### # #### # # #" ,
" # # # # # # #",
" # # # # # # # #", " # # # # # # # #",
" ## #### #### #### ## # #", "# # # # # # # # ## ",
" ## #### #### #### ## # ",
] ]
BACKGROUND_COLOR = 0 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(): def run_menu():
global CURRENT_APP_RUN global CURRENT_APP_RUN
display_fill(BACKGROUND_COLOR) display_fill(BACKGROUND_COLOR)
...@@ -95,16 +84,16 @@ def main(): ...@@ -95,16 +84,16 @@ def main():
set_global_volume_dB(VOLUME) set_global_volume_dB(VOLUME)
while True: while True:
if(BOOTSEL_PIN.value() == 0): if(get_button(0) == 2):
if CURRENT_APP_RUN == run_menu: if CURRENT_APP_RUN == run_menu:
captouch_autocalib() captouch_autocalib()
else: else:
CURRENT_APP_RUN = run_menu CURRENT_APP_RUN = run_menu
foreground_menu() foreground_menu()
if(VOL_UP_PIN.value() == 0): if(get_button(0) == 1):
set_rel_volume(+3) set_rel_volume(+1)
if(VOL_DOWN_PIN.value() == 0): if(get_button(0) == -1):
set_rel_volume(-3) set_rel_volume(-1)
CURRENT_APP_RUN() CURRENT_APP_RUN()
main() main()
...@@ -11,8 +11,8 @@ def clear_all_leds(): ...@@ -11,8 +11,8 @@ def clear_all_leds():
update_leds() update_leds()
def draw_text_big(text, x, y): def draw_text_big(text, x, y):
ypos = 120+int(len(text)/2) + int(y) ypos = 120+int(len(text)) + int(y)
xpos = 120+int(len(text[0])/2) + int(x) xpos = 120+int(len(text[0])) + int(x)
for l, line in enumerate(text): for l, line in enumerate(text):
for p, pixel in enumerate(line): for p, pixel in enumerate(line):
if(pixel == '#'): if(pixel == '#'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment