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
dfc13b2d
Commit
dfc13b2d
authored
1 year ago
by
pippin
Browse files
Options
Downloads
Patches
Plain Diff
clouds: move to Badge menu, use IMU and bundle_path
parent
c5df5c07
No related branches found
No related tags found
No related merge requests found
Pipeline
#7252
passed
1 year ago
Stage: check
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python_payload/apps/clouds/__init__.py
+20
-6
20 additions, 6 deletions
python_payload/apps/clouds/__init__.py
python_payload/apps/clouds/flow3r.toml
+1
-1
1 addition, 1 deletion
python_payload/apps/clouds/flow3r.toml
with
21 additions
and
7 deletions
python_payload/apps/clouds/__init__.py
+
20
−
6
View file @
dfc13b2d
...
...
@@ -6,7 +6,8 @@ from ctx import Context
class
Cloud
:
def
__init__
(
self
,
x
:
float
,
y
:
float
,
z
:
float
)
->
None
:
def
__init__
(
self
,
path
:
str
,
x
:
float
,
y
:
float
,
z
:
float
)
->
None
:
self
.
path
=
path
self
.
x
=
x
self
.
y
=
y
self
.
z
=
z
...
...
@@ -14,10 +15,10 @@ class Cloud:
def
draw
(
self
,
ctx
:
Context
)
->
None
:
x
=
self
.
x
/
self
.
z
*
120
y
=
self
.
y
/
self
.
z
*
120
width
=
200.0
/
self
.
z
*
1
2
0
height
=
100.0
/
self
.
z
*
1
2
0
width
=
200.0
/
self
.
z
*
1
6
0
height
=
100.0
/
self
.
z
*
1
6
0
ctx
.
image
(
"
/flash/sys/apps/clouds/cloud.png
"
,
self
.
path
,
x
-
width
/
2
,
y
-
height
/
2
,
width
,
...
...
@@ -29,11 +30,15 @@ class Clouds(Application):
def
__init__
(
self
,
app_ctx
:
ApplicationContext
)
->
None
:
super
().
__init__
(
app_ctx
)
self
.
clouds
=
[]
bundle_path
=
getattr
(
app_ctx
,
"
bundle_path
"
)
if
bundle_path
==
""
:
bundle_path
=
"
/flash/sys/apps/clouds
"
for
i
in
range
(
10
):
self
.
clouds
.
append
(
Cloud
(
bundle_path
+
"
/cloud.png
"
,
((
random
.
getrandbits
(
16
)
-
32767
)
/
32767.0
)
*
200
,
((
random
.
getrandbits
(
16
))
/
65535.0
)
*
5
0
-
5
,
((
random
.
getrandbits
(
16
))
/
65535.0
)
*
6
0
-
10
,
((
random
.
getrandbits
(
16
))
/
65535.0
)
*
200
+
5
,
)
)
...
...
@@ -41,9 +46,18 @@ class Clouds(Application):
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
super
().
think
(
ins
,
delta_ms
)
for
c
in
self
.
clouds
:
c
.
z
-=
40
*
delta_ms
/
1000.0
c
.
x
-=
(
delta_ms
/
1000.0
)
*
ins
.
imu
.
acc
[
1
]
*
10
c
.
z
-=
(
delta_ms
/
1000.0
)
*
(
ins
.
imu
.
acc
[
2
]
-
5
)
*
20
# wrap x and z coordinates around
if
c
.
z
<
10
:
c
.
z
=
300
elif
c
.
z
>
300
:
c
.
z
=
10
if
c
.
x
<
-
200
:
c
.
x
=
200
elif
c
.
x
>
200
:
c
.
x
=
-
200
self
.
clouds
=
sorted
(
self
.
clouds
,
key
=
lambda
c
:
-
c
.
z
)
def
draw
(
self
,
ctx
:
Context
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
python_payload/apps/clouds/flow3r.toml
+
1
−
1
View file @
dfc13b2d
[app]
name
=
"Clouds"
menu
=
"
Apps
"
menu
=
"
Badge
"
[entry]
class
=
"Clouds"
...
...
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