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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Commits
a78a9e63
Commit
a78a9e63
authored
Aug 22, 2023
by
pippin
Browse files
Options
Downloads
Patches
Plain Diff
clouds: move to Badge menu, use IMU and bundle_path
parent
e0b6bd75
No related branches found
No related tags found
1 merge request
!213
clouds: move to Badge menu, use IMU and bundle_path
Pipeline
#7281
passed
Aug 22, 2023
Stage: check
Stage: build
Stage: deploy
Changes
2
Pipelines
2
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 @
a78a9e63
...
@@ -6,7 +6,8 @@ from ctx import Context
...
@@ -6,7 +6,8 @@ from ctx import Context
class
Cloud
:
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
.
x
=
x
self
.
y
=
y
self
.
y
=
y
self
.
z
=
z
self
.
z
=
z
...
@@ -14,10 +15,10 @@ class Cloud:
...
@@ -14,10 +15,10 @@ class Cloud:
def
draw
(
self
,
ctx
:
Context
)
->
None
:
def
draw
(
self
,
ctx
:
Context
)
->
None
:
x
=
self
.
x
/
self
.
z
*
120
x
=
self
.
x
/
self
.
z
*
120
y
=
self
.
y
/
self
.
z
*
120
y
=
self
.
y
/
self
.
z
*
120
width
=
200.0
/
self
.
z
*
1
2
0
width
=
200.0
/
self
.
z
*
1
6
0
height
=
100.0
/
self
.
z
*
1
2
0
height
=
100.0
/
self
.
z
*
1
6
0
ctx
.
image
(
ctx
.
image
(
"
/flash/sys/apps/clouds/cloud.png
"
,
self
.
path
,
x
-
width
/
2
,
x
-
width
/
2
,
y
-
height
/
2
,
y
-
height
/
2
,
width
,
width
,
...
@@ -29,11 +30,15 @@ class Clouds(Application):
...
@@ -29,11 +30,15 @@ class Clouds(Application):
def
__init__
(
self
,
app_ctx
:
ApplicationContext
)
->
None
:
def
__init__
(
self
,
app_ctx
:
ApplicationContext
)
->
None
:
super
().
__init__
(
app_ctx
)
super
().
__init__
(
app_ctx
)
self
.
clouds
=
[]
self
.
clouds
=
[]
bundle_path
=
app_ctx
.
bundle_path
if
bundle_path
==
""
:
bundle_path
=
"
/flash/sys/apps/clouds
"
for
i
in
range
(
10
):
for
i
in
range
(
10
):
self
.
clouds
.
append
(
self
.
clouds
.
append
(
Cloud
(
Cloud
(
bundle_path
+
"
/cloud.png
"
,
((
random
.
getrandbits
(
16
)
-
32767
)
/
32767.0
)
*
200
,
((
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
,
((
random
.
getrandbits
(
16
))
/
65535.0
)
*
200
+
5
,
)
)
)
)
...
@@ -41,9 +46,18 @@ class Clouds(Application):
...
@@ -41,9 +46,18 @@ class Clouds(Application):
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
super
().
think
(
ins
,
delta_ms
)
super
().
think
(
ins
,
delta_ms
)
for
c
in
self
.
clouds
:
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
:
if
c
.
z
<
10
:
c
.
z
=
300
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
)
self
.
clouds
=
sorted
(
self
.
clouds
,
key
=
lambda
c
:
-
c
.
z
)
def
draw
(
self
,
ctx
:
Context
)
->
None
:
def
draw
(
self
,
ctx
:
Context
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
python_payload/apps/clouds/flow3r.toml
+
1
−
1
View file @
a78a9e63
[app]
[app]
name
=
"Clouds"
name
=
"Clouds"
menu
=
"
Apps
"
menu
=
"
Badge
"
[entry]
[entry]
class
=
"Clouds"
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