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
36d14db5
Commit
36d14db5
authored
1 year ago
by
q3k
Committed by
q3k
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
py: use InputController in simple_drums
parent
f06d3bd0
No related branches found
No related tags found
1 merge request
!58
py: use InputController in simple_drums
Pipeline
#6345
passed
1 year ago
Stage: check
Stage: build
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/apps/simple_drums/__init__.py
+20
-12
20 additions, 12 deletions
python_payload/apps/simple_drums/__init__.py
with
20 additions
and
12 deletions
python_payload/apps/simple_drums/__init__.py
+
20
−
12
View file @
36d14db5
...
...
@@ -52,7 +52,6 @@ class SimpleDrums(Application):
self
.
hat
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
1
].
signals
.
output
self
.
snare
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
2
].
signals
.
output
self
.
track_names
=
[
"
kick
"
,
"
hihat
"
,
"
snare
"
]
self
.
ct_prev
=
captouch
.
read
()
self
.
track
=
0
self
.
seq
.
bpm
=
80
self
.
blm
.
background_mute_override
=
True
...
...
@@ -61,6 +60,14 @@ class SimpleDrums(Application):
self
.
stopped
=
False
self
.
bpm
=
self
.
seq
.
bpm
# True if a given group should be highlighted, when a corresponding
# petal is pressed.
self
.
_group_highlight
=
[
False
for
_
in
range
(
4
)]
# Disable repeat functionality as we want to detect long holds.
for
i
in
range
(
10
):
self
.
input
.
captouch
.
petals
[
i
].
whole
.
repeat_disable
()
def
_highlight_petal
(
self
,
num
:
int
,
r
:
int
,
g
:
int
,
b
:
int
)
->
None
:
for
i
in
range
(
5
):
leds
.
set_rgb
((
4
*
num
-
i
+
2
)
%
40
,
r
,
g
,
b
)
...
...
@@ -79,7 +86,7 @@ class SimpleDrums(Application):
dots
=
[]
groupgap
=
4
for
i
in
range
(
4
):
if
self
.
ct_prev
.
petals
[
4
-
i
].
pressed
:
if
self
.
_group_highlight
[
i
]
:
dots
.
append
(
Dot
(
48
+
groupgap
,
...
...
@@ -162,17 +169,19 @@ class SimpleDrums(Application):
self
.
_highlight_petal
(
4
-
(
st
//
4
),
*
rgb
)
self
.
_highlight_petal
(
6
+
(
st
%
4
),
*
rgb
)
leds
.
update
()
ct
=
captouch
.
read
()
petals
=
self
.
input
.
captouch
.
petals
self
.
_group_highlight
=
[
False
for
_
in
range
(
4
)]
for
i
in
range
(
4
):
if
ct
.
petals
[
4
-
i
].
pressed
:
if
petals
[
4
-
i
].
whole
.
down
:
self
.
_group_highlight
[
i
]
=
True
for
j
in
range
(
4
):
if
ct
.
petals
[
6
+
j
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
6
+
j
].
pressed
):
if
petals
[
6
+
j
].
whole
.
pressed
:
self
.
seq
.
trigger_toggle
(
self
.
track
,
i
*
4
+
j
)
if
ct
.
petals
[
5
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
5
]
.
pressed
)
:
self
.
track
=
(
self
.
track
+
1
)
%
3
if
ct
.
petals
[
0
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
0
]
.
pressed
)
:
if
petals
[
5
].
whole
.
pressed
:
self
.
track
=
(
self
.
track
-
1
)
%
3
if
petals
[
0
].
whole
.
pressed
:
if
self
.
stopped
:
self
.
seq
.
bpm
=
self
.
bpm
self
.
stopped
=
False
...
...
@@ -183,7 +192,7 @@ class SimpleDrums(Application):
self
.
bpm
=
bpm
self
.
delta_acc
=
0
if
ct
.
petals
[
0
].
pressed
:
if
petals
[
0
].
whole
.
down
:
if
self
.
tap_tempo_press_counter
>
500
:
self
.
seq
.
bpm
=
0
self
.
stopped
=
True
...
...
@@ -194,4 +203,3 @@ class SimpleDrums(Application):
if
self
.
delta_acc
<
3000
:
self
.
delta_acc
+=
delta_ms
self
.
ct_prev
=
ct
This diff is collapsed.
Click to expand it.
dx
@dx
mentioned in commit
31e47146
·
1 year ago
mentioned in commit
31e47146
mentioned in commit 31e471462d5d76ed399d348a9d991c7e96783228
Toggle commit list
dx
@dx
mentioned in commit
42d3d34d
·
1 year ago
mentioned in commit
42d3d34d
mentioned in commit 42d3d34d3aa708a83e4557f78d46dbb35b85a9e5
Toggle commit list
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