Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Commits
e9ffbf4d
Commit
e9ffbf4d
authored
1 year ago
by
moon2
Committed by
q3k
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
tiny bugfixes in demo application
parent
f4188a36
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python_payload/main.py
+2
-2
2 additions, 2 deletions
python_payload/main.py
python_payload/melodic_demo.py
+29
-29
29 additions, 29 deletions
python_payload/melodic_demo.py
with
31 additions
and
31 deletions
python_payload/main.py
+
2
−
2
View file @
e9ffbf4d
...
...
@@ -42,7 +42,7 @@ def draw_text_big(text, x, y):
def
highlight_bottom_petal
(
num
,
r
,
g
,
b
):
start
=
4
+
8
*
num
for
i
in
range
(
7
):
set_led_rgb
((
i
+
start
%
40
),
r
,
g
,
b
)
set_led_rgb
((
(
i
+
start
)
%
40
),
r
,
g
,
b
)
update_leds
()
def
long_bottom_petal_captouch_blocking
(
num
,
ms
):
...
...
@@ -96,7 +96,7 @@ def run_menu():
cap_touch_demo
.
foreground
()
if
long_bottom_petal_captouch_blocking
(
1
,
20
):
clear_all_leds
()
highlight_bottom_petal
(
0
,
255
,
0
,
0
)
highlight_bottom_petal
(
1
,
255
,
0
,
0
)
display_fill
(
background
)
display_update
()
foreground
=
melodic_demo
.
run
...
...
This diff is collapsed.
Click to expand it.
python_payload/melodic_demo.py
+
29
−
29
View file @
e9ffbf4d
from
synth
import
tinysynth
from
hardware
import
*
octave
=
0
synths
=
[]
scale
=
[
0
,
2
,
4
,
5
,
7
,
9
,
11
]
def
set_chord
(
i
):
global
chord_index
global
chord
if
(
i
!=
chord_index
):
chord_index
=
i
for
j
in
range
(
40
):
hue
=
int
(
72
*
(
i
+
0.5
))
%
360
set_led_hsv
(
j
,
hue
,
1
,
0.5
)
chord
=
chords
[
i
]
print
(
"
set chord
"
+
str
(
i
))
update_leds
()
def
highlight_bottom_petal
(
num
,
r
,
g
,
b
):
start
=
4
+
8
*
num
for
i
in
range
(
7
):
set_led_rgb
(((
i
+
start
)
%
40
),
r
,
g
,
b
)
def
change_playing_field_color
(
r
,
g
,
b
):
highlight_bottom_petal
(
0
,
r
,
g
,
b
)
highlight_bottom_petal
(
1
,
r
,
g
,
b
)
highlight_bottom_petal
(
3
,
r
,
g
,
b
)
highlight_bottom_petal
(
4
,
r
,
g
,
b
)
highlight_bottom_petal
(
2
,
255
,
0
,
255
)
set_led_rgb
(
18
,
255
,
0
,
255
)
set_led_rgb
(
19
,
255
,
0
,
255
)
set_led_rgb
(
27
,
255
,
0
,
255
)
set_led_rgb
(
28
,
255
,
0
,
255
)
update_leds
()
def
adjust_playing_field_to_octave
():
global
octave
if
(
octave
==
-
1
):
change_playing_field_color
(
0
,
0
,
255
)
elif
(
octave
==
0
):
change_playing_field_color
(
0
,
127
,
127
)
elif
(
octave
==
1
):
change_playing_field_color
(
0
,
255
,
0
)
def
run
():
global
scale
...
...
@@ -26,10 +39,13 @@ def run():
if
(
get_captouch
(
i
)):
if
(
i
==
4
):
octave
=
-
1
adjust_playing_field_to_octave
()
elif
(
i
==
5
):
octave
=
0
adjust_playing_field_to_octave
()
elif
(
i
==
6
):
octave
=
1
adjust_playing_field_to_octave
()
else
:
k
=
i
if
(
k
>
3
):
...
...
@@ -41,27 +57,11 @@ def run():
def
init
():
global
synths
for
i
in
range
(
1
):
synths
+=
[
tinysynth
(
440
,
1
)]
for
synth
in
synths
:
synth
.
decay
(
100
)
synth
.
waveform
(
1
)
def
highlight_bottom_petal
(
num
,
r
,
g
,
b
):
start
=
4
+
8
*
num
for
i
in
range
(
7
):
set_led_rgb
((
i
+
start
%
40
),
r
,
g
,
b
)
update_leds
()
def
foreground
():
highlight_bottom_petal
(
0
,
0
,
0
,
255
)
highlight_bottom_petal
(
1
,
0
,
0
,
255
)
highlight_bottom_petal
(
4
,
0
,
0
,
255
)
highlight_bottom_petal
(
3
,
0
,
0
,
255
)
set_led_rgb
(
18
,
255
,
0
,
255
)
set_led_rgb
(
19
,
255
,
0
,
255
)
set_led_rgb
(
27
,
255
,
0
,
255
)
set_led_rgb
(
28
,
255
,
0
,
255
)
highlight_bottom_petal
(
2
,
255
,
0
,
255
)
adjust_playing_field_to_octave
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment