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
70443571
Commit
70443571
authored
1 year ago
by
q3k
Browse files
Options
Downloads
Patches
Plain Diff
py: add Captouch debug overlay, add System menu
parent
bbc95701
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
python_payload/main.py
+25
-1
25 additions, 1 deletion
python_payload/main.py
python_payload/st3m/settings.py
+2
-0
2 additions, 0 deletions
python_payload/st3m/settings.py
python_payload/st3m/ui/elements/overlays.py
+47
-0
47 additions, 0 deletions
python_payload/st3m/ui/elements/overlays.py
with
74 additions
and
1 deletion
python_payload/main.py
+
25
−
1
View file @
70443571
...
@@ -94,12 +94,24 @@ menu_badge = SimpleMenu(
...
@@ -94,12 +94,24 @@ menu_badge = SimpleMenu(
],
],
vm
,
vm
,
)
)
menu_system
=
SimpleMenu
(
[
MenuItemBack
(),
MenuItemForeground
(
"
Settings
"
,
menu_settings
),
MenuItemNoop
(
"
Disk Mode
"
),
MenuItemNoop
(
"
About
"
),
MenuItemNoop
(
"
Reboot
"
),
],
vm
,
)
menu_main
=
SunMenu
(
menu_main
=
SunMenu
(
[
[
MenuItemForeground
(
"
Badge
"
,
menu_badge
),
MenuItemForeground
(
"
Badge
"
,
menu_badge
),
MenuItemForeground
(
"
Music
"
,
menu_music
),
MenuItemForeground
(
"
Music
"
,
menu_music
),
MenuItemForeground
(
"
Apps
"
,
menu_apps
),
MenuItemForeground
(
"
Apps
"
,
menu_apps
),
MenuItemForeground
(
"
S
ettings
"
,
menu_s
ettings
),
MenuItemForeground
(
"
S
ystem
"
,
menu_s
ystem
),
],
],
vm
,
vm
,
)
)
...
@@ -126,5 +138,17 @@ debug = overlays.OverlayDebug()
...
@@ -126,5 +138,17 @@ debug = overlays.OverlayDebug()
debug
.
add_fragment
(
overlays
.
DebugReactorStats
(
reactor
))
debug
.
add_fragment
(
overlays
.
DebugReactorStats
(
reactor
))
compositor
.
add_overlay
(
debug
)
compositor
.
add_overlay
(
debug
)
debug_touch
=
overlays
.
OverlayCaptouch
()
# Tie compositor's debug touch overlay to setting.
def
_onoff_debug_touch_update
()
->
None
:
compositor
.
enabled
[
overlays
.
OverlayKind
.
Touch
]
=
settings
.
onoff_debug_touch
.
value
_onoff_debug_touch_update
()
settings
.
onoff_debug_touch
.
subscribe
(
_onoff_debug_touch_update
)
compositor
.
add_overlay
(
debug_touch
)
reactor
.
set_top
(
compositor
)
reactor
.
set_top
(
compositor
)
reactor
.
run
()
reactor
.
run
()
This diff is collapsed.
Click to expand it.
python_payload/st3m/settings.py
+
2
−
0
View file @
70443571
...
@@ -293,8 +293,10 @@ class SettingsMenu(SimpleMenu):
...
@@ -293,8 +293,10 @@ class SettingsMenu(SimpleMenu):
# Actual tunables / settings.
# Actual tunables / settings.
onoff_debug
=
OnOffTunable
(
"
Debug Overlay
"
,
"
system.debug
"
,
False
)
onoff_debug
=
OnOffTunable
(
"
Debug Overlay
"
,
"
system.debug
"
,
False
)
onoff_debug_touch
=
OnOffTunable
(
"
Touch Overlay
"
,
"
system.debug_touch
"
,
False
)
all_settings
:
List
[
UnaryTunable
]
=
[
all_settings
:
List
[
UnaryTunable
]
=
[
onoff_debug
,
onoff_debug
,
onoff_debug_touch
,
]
]
...
...
This diff is collapsed.
Click to expand it.
python_payload/st3m/ui/elements/overlays.py
+
47
−
0
View file @
70443571
...
@@ -8,6 +8,7 @@ etc.
...
@@ -8,6 +8,7 @@ etc.
from
st3m
import
Responder
,
Ctx
,
InputState
,
Reactor
from
st3m
import
Responder
,
Ctx
,
InputState
,
Reactor
from
st3m.goose
import
Dict
,
Enum
,
List
,
ABCBase
,
abstractmethod
from
st3m.goose
import
Dict
,
Enum
,
List
,
ABCBase
,
abstractmethod
from
st3m.utils
import
tau
class
OverlayKind
(
Enum
):
class
OverlayKind
(
Enum
):
...
@@ -15,11 +16,13 @@ class OverlayKind(Enum):
...
@@ -15,11 +16,13 @@ class OverlayKind(Enum):
Indicators
=
0
Indicators
=
0
# Naughty debug developers for naughty developers and debuggers.
# Naughty debug developers for naughty developers and debuggers.
Debug
=
1
Debug
=
1
Touch
=
2
_all_kinds
=
[
_all_kinds
=
[
OverlayKind
.
Indicators
,
OverlayKind
.
Indicators
,
OverlayKind
.
Debug
,
OverlayKind
.
Debug
,
OverlayKind
.
Touch
,
]
]
...
@@ -138,3 +141,47 @@ class OverlayDebug(Overlay):
...
@@ -138,3 +141,47 @@ class OverlayDebug(Overlay):
ctx
.
gray
(
0
).
rectangle
(
-
120
,
80
,
240
,
12
).
fill
()
ctx
.
gray
(
0
).
rectangle
(
-
120
,
80
,
240
,
12
).
fill
()
ctx
.
gray
(
1
).
move_to
(
0
,
86
).
text
(
self
.
text
())
ctx
.
gray
(
1
).
move_to
(
0
,
86
).
text
(
self
.
text
())
ctx
.
restore
()
ctx
.
restore
()
class
OverlayCaptouch
(
Overlay
):
kind
=
OverlayKind
.
Touch
class
Dot
(
Responder
):
def
__init__
(
self
,
ix
:
int
)
->
None
:
self
.
ix
=
ix
self
.
phi
=
0.0
self
.
rad
=
0.0
self
.
pressed
=
False
def
think
(
self
,
s
:
InputState
,
delta_ms
:
int
)
->
None
:
self
.
pressed
=
s
.
petal_pressed
[
self
.
ix
]
(
rad
,
phi
)
=
s
.
petal_pos
[
self
.
ix
]
self
.
phi
=
phi
self
.
rad
=
rad
def
draw
(
self
,
ctx
:
Ctx
)
->
None
:
if
not
self
.
pressed
:
return
a
=
(
tau
/
10
)
*
self
.
ix
ctx
.
rotate
(
-
a
)
ctx
.
translate
(
0
,
-
80
)
offs_x
=
-
self
.
phi
/
1000
offs_y
=
-
self
.
rad
/
1000
ctx
.
rectangle
(
-
5
+
offs_x
,
-
5
+
offs_y
,
10
,
10
)
ctx
.
rgb
(
1
,
0
,
1
)
ctx
.
fill
()
def
__init__
(
self
)
->
None
:
self
.
dots
=
[
self
.
Dot
(
i
)
for
i
in
range
(
10
)]
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
for
dot
in
self
.
dots
:
dot
.
think
(
ins
,
delta_ms
)
def
draw
(
self
,
ctx
:
Ctx
)
->
None
:
for
dot
in
self
.
dots
:
ctx
.
save
()
dot
.
draw
(
ctx
)
ctx
.
restore
()
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