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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
38ebb704
Commit
38ebb704
authored
Apr 25, 2023
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
tiny bugfixes in demo application
parent
21be39e5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show 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 @
38ebb704
...
@@ -42,7 +42,7 @@ def draw_text_big(text, x, y):
...
@@ -42,7 +42,7 @@ def draw_text_big(text, x, y):
def
highlight_bottom_petal
(
num
,
r
,
g
,
b
):
def
highlight_bottom_petal
(
num
,
r
,
g
,
b
):
start
=
4
+
8
*
num
start
=
4
+
8
*
num
for
i
in
range
(
7
):
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
()
update_leds
()
def
long_bottom_petal_captouch_blocking
(
num
,
ms
):
def
long_bottom_petal_captouch_blocking
(
num
,
ms
):
...
@@ -96,7 +96,7 @@ def run_menu():
...
@@ -96,7 +96,7 @@ def run_menu():
cap_touch_demo
.
foreground
()
cap_touch_demo
.
foreground
()
if
long_bottom_petal_captouch_blocking
(
1
,
20
):
if
long_bottom_petal_captouch_blocking
(
1
,
20
):
clear_all_leds
()
clear_all_leds
()
highlight_bottom_petal
(
0
,
255
,
0
,
0
)
highlight_bottom_petal
(
1
,
255
,
0
,
0
)
display_fill
(
background
)
display_fill
(
background
)
display_update
()
display_update
()
foreground
=
melodic_demo
.
run
foreground
=
melodic_demo
.
run
...
...
This diff is collapsed.
Click to expand it.
python_payload/melodic_demo.py
+
29
−
29
View file @
38ebb704
from
synth
import
tinysynth
from
synth
import
tinysynth
from
hardware
import
*
from
hardware
import
*
octave
=
0
octave
=
0
synths
=
[]
synths
=
[]
scale
=
[
0
,
2
,
4
,
5
,
7
,
9
,
11
]
scale
=
[
0
,
2
,
4
,
5
,
7
,
9
,
11
]
def
set_chord
(
i
):
def
highlight_bottom_petal
(
num
,
r
,
g
,
b
):
global
chord_index
start
=
4
+
8
*
num
global
chord
for
i
in
range
(
7
):
if
(
i
!=
chord_index
):
set_led_rgb
(((
i
+
start
)
%
40
),
r
,
g
,
b
)
chord_index
=
i
for
j
in
range
(
40
):
def
change_playing_field_color
(
r
,
g
,
b
):
hue
=
int
(
72
*
(
i
+
0.5
))
%
360
highlight_bottom_petal
(
0
,
r
,
g
,
b
)
set_led_hsv
(
j
,
hue
,
1
,
0.5
)
highlight_bottom_petal
(
1
,
r
,
g
,
b
)
chord
=
chords
[
i
]
highlight_bottom_petal
(
3
,
r
,
g
,
b
)
print
(
"
set chord
"
+
str
(
i
))
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
()
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
():
def
run
():
global
scale
global
scale
global
octave
global
octave
...
@@ -26,10 +39,13 @@ def run():
...
@@ -26,10 +39,13 @@ def run():
if
(
get_captouch
(
i
)):
if
(
get_captouch
(
i
)):
if
(
i
==
4
):
if
(
i
==
4
):
octave
=
-
1
octave
=
-
1
adjust_playing_field_to_octave
()
elif
(
i
==
5
):
elif
(
i
==
5
):
octave
=
0
octave
=
0
adjust_playing_field_to_octave
()
elif
(
i
==
6
):
elif
(
i
==
6
):
octave
=
1
octave
=
1
adjust_playing_field_to_octave
()
else
:
else
:
k
=
i
k
=
i
if
(
k
>
3
):
if
(
k
>
3
):
...
@@ -41,27 +57,11 @@ def run():
...
@@ -41,27 +57,11 @@ def run():
def
init
():
def
init
():
global
synths
global
synths
for
i
in
range
(
1
):
for
i
in
range
(
1
):
synths
+=
[
tinysynth
(
440
,
1
)]
synths
+=
[
tinysynth
(
440
,
1
)]
for
synth
in
synths
:
for
synth
in
synths
:
synth
.
decay
(
100
)
synth
.
decay
(
100
)
synth
.
waveform
(
1
)
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
():
def
foreground
():
highlight_bottom_petal
(
0
,
0
,
0
,
255
)
adjust_playing_field_to_octave
()
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
)
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