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
f4a570cc
Commit
f4a570cc
authored
1 year ago
by
rahix
Committed by
dx
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
sim: Add configurable OLED scale
parent
d0f63ff6
No related branches found
No related tags found
1 merge request
!189
BIG flow3r
Pipeline
#12776
passed
11 months ago
Stage: check
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sim/fakes/_sim.py
+6
-5
6 additions, 5 deletions
sim/fakes/_sim.py
sim/run.py
+2
-0
2 additions, 0 deletions
sim/run.py
with
8 additions
and
5 deletions
sim/fakes/_sim.py
+
6
−
5
View file @
f4a570cc
...
...
@@ -30,6 +30,7 @@ background = pygame.image.load(bgpath)
OLED_SIZE
=
int
(
os
.
environ
[
"
SIM_OLED_SIZE
"
])
OLED_ASPECT
=
float
(
os
.
environ
[
"
SIM_OLED_ASPECT
"
])
OLED_SCALE
=
float
(
os
.
environ
[
"
SIM_OLED_SCALE
"
])
def
path_replace
(
p
):
...
...
@@ -518,11 +519,11 @@ class Simulation:
center_x
=
screen_w
//
2
center_y
=
screen_h
//
2
if
FULL_SCREEN
:
off_x
=
center_x
-
(
screen_h
*
OLED_ASPECT
//
2
)
off_y
=
center_y
-
(
screen_h
//
2
)
new
=
pygame
.
transform
.
scale
(
self
.
_oled_surface
,
(
screen_h
*
OLED_ASPECT
,
screen_h
)
)
size_x
=
screen_h
*
OLED_ASPECT
*
OLED_SCALE
size_y
=
screen_h
*
OLED_SCALE
off_x
=
center_x
-
(
size_x
//
2
)
off_y
=
center_y
-
(
size_y
//
2
)
new
=
pygame
.
transform
.
scale
(
self
.
_oled_surface
,
(
size_x
,
size_y
)
)
full
.
blit
(
new
,
(
off_x
,
off_y
))
else
:
off_x
=
center_x
-
(
OLED_SIZE
//
2
)
...
...
This diff is collapsed.
Click to expand it.
sim/run.py
+
2
−
0
View file @
f4a570cc
...
...
@@ -164,6 +164,7 @@ def sim_main():
)
parser
.
add_argument
(
"
--oled-size
"
,
dest
=
"
oled_size
"
,
default
=
240
)
parser
.
add_argument
(
"
--oled-aspect
"
,
dest
=
"
oled_aspect
"
,
default
=
1
)
parser
.
add_argument
(
"
--oled-scale
"
,
dest
=
"
oled_scale
"
,
default
=
1
)
parser
.
add_argument
(
"
override_app
"
,
nargs
=
"
?
"
,
...
...
@@ -175,6 +176,7 @@ def sim_main():
os
.
environ
[
"
SIM_FULL_SCREEN
"
]
=
"
1
"
if
args
.
full_screen
else
"
0
"
os
.
environ
[
"
SIM_OLED_SIZE
"
]
=
str
(
args
.
oled_size
)
os
.
environ
[
"
SIM_OLED_ASPECT
"
]
=
str
(
args
.
oled_aspect
)
os
.
environ
[
"
SIM_OLED_SCALE
"
]
=
str
(
args
.
oled_scale
)
import
_sim
_sim
.
SCREENSHOT
=
args
.
screenshot
...
...
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