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
1c96a636
Commit
1c96a636
authored
1 year ago
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
clean exit: q3k app
parent
c232f747
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!221
clean exit: q3k app
Pipeline
#7360
passed
1 year ago
Stage: check
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/apps/otamatone/__init__.py
+16
-5
16 additions, 5 deletions
python_payload/apps/otamatone/__init__.py
with
16 additions
and
5 deletions
python_payload/apps/otamatone/__init__.py
+
16
−
5
View file @
1c96a636
...
...
@@ -81,8 +81,13 @@ class Otamatone(Application):
super
().
__init__
(
app_ctx
)
self
.
_ts
=
0
self
.
_blob
=
Blob
()
self
.
_blm
=
None
self
.
_intensity
=
0.0
self
.
input
.
captouch
.
petals
[
self
.
PETAL_NO
].
whole
.
repeat_disable
()
self
.
_blm
=
bl00mbox
.
Channel
(
"
Otamatone
"
)
def
_build_synth
(
self
):
if
self
.
_blm
is
None
:
self
.
_blm
=
bl00mbox
.
Channel
(
"
Otamatone
"
)
# Sawtooth oscillator
self
.
_osc
=
self
.
_blm
.
new
(
bl00mbox
.
patches
.
tinysynth
)
...
...
@@ -105,20 +110,24 @@ class Otamatone(Application):
# Built custom square wave (low duty cycle)
table_len
=
129
self
.
_dist
.
table
=
[
32767
if
i
>
(
0.1
*
table_len
)
else
-
3276
8
for
i
in
range
(
table_len
)
32767
if
i
>
(
0.1
*
table_len
)
else
-
3276
7
for
i
in
range
(
table_len
)
]
self
.
_lp
.
signals
.
freq
=
4000
self
.
_intensity
=
0.0
self
.
input
.
captouch
.
petals
[
self
.
PETAL_NO
].
whole
.
repeat_disable
()
def
on_exit
(
self
):
if
self
.
_blm
is
not
None
:
self
.
_blm
.
free
=
True
self
.
_blm
=
None
def
on_enter
(
self
,
vm
:
Optional
[
ViewManager
])
->
None
:
super
().
on_enter
(
vm
)
for
i
in
range
(
26
,
30
+
1
):
leds
.
set_rgb
(
i
,
62
,
159
,
229
)
leds
.
update
()
if
self
.
_blm
is
None
:
self
.
_build_synth
()
self
.
_blm
.
foreground
=
True
def
draw
(
self
,
ctx
:
Context
)
->
None
:
ctx
.
save
()
...
...
@@ -133,6 +142,8 @@ class Otamatone(Application):
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
super
().
think
(
ins
,
delta_ms
)
if
self
.
_blm
is
None
:
return
# weird bug, for some reason think gets called after on_exit?
self
.
_ts
+=
delta_ms
self
.
_blob
.
think
(
ins
,
delta_ms
)
...
...
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