Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit dea657a

Browse files
authored
Merge pull request SHA2017-badge#40 from SHA2017-badge/reduceFlushes
Reduce flushes
2 parents 73b7d71 + 76f13b6 commit dea657a

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

esp32/modules/installer.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ def url_open(url):
8181

8282
return s
8383

84+
def show_description(active):
85+
if active:
86+
text.text(packages[options.selected_index()]["description"])
87+
ugfx.flush()
88+
8489
options = ugfx.List(0,0,int(ugfx.width()/2),ugfx.height())
8590

8691
f = url_open("https://badge.sha2017.org/eggs/list/json")
@@ -92,14 +97,6 @@ def url_open(url):
9297
for package in packages:
9398
options.add_item("%s rev. %s"% (package["name"], package["revision"]))
9499

95-
ugfx.set_lut(ugfx.LUT_FULL)
96-
ugfx.flush()
97-
98-
def show_description(active):
99-
if active:
100-
text.text(packages[options.selected_index()]["description"])
101-
ugfx.flush()
102-
103100
def woezel_it(active):
104101
if active:
105102
ugfx.clear(ugfx.BLACK)
@@ -124,11 +121,13 @@ def start_app(pushed):
124121

125122
ugfx.input_attach(ugfx.BTN_START, start_app)
126123

127-
ugfx.input_attach(ugfx.JOY_LEFT, lambda x: ugfx.flush())
128-
ugfx.input_attach(ugfx.JOY_RIGHT, lambda x: ugfx.flush())
124+
ugfx.input_attach(ugfx.JOY_LEFT, lambda pushed: ugfx.flush() if pushed else 0)
125+
ugfx.input_attach(ugfx.JOY_RIGHT, lambda pushed: ugfx.flush() if pushed else 0)
129126

130127
text = ugfx.Textbox(int(ugfx.width()/2),0, int(ugfx.width()/2), ugfx.height())
131128

129+
show_description(True)
130+
131+
ugfx.set_lut(ugfx.LUT_FULL)
132132
ugfx.flush()
133-
time.sleep(0.2)
134133
ugfx.set_lut(ugfx.LUT_FASTER)

esp32/modules/launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ def run_it(pushed):
4747
ugfx.input_attach(ugfx.JOY_UP, lambda pushed: ugfx.flush() if pushed else 0)
4848
ugfx.input_attach(ugfx.JOY_DOWN, lambda pushed: ugfx.flush() if pushed else 0)
4949

50+
ugfx.set_lut(ugfx.LUT_FULL)
5051
ugfx.flush()
51-
time.sleep(0.2)
5252
ugfx.set_lut(ugfx.LUT_FASTER)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy