Skip to content

Commit 652dc0a

Browse files
committed
Fix a big bug and a little bit of cleaning
1 parent 1735a97 commit 652dc0a

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

esp32/modules/easydraw.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def nickname(y = 25, font = "PermanentMarker36", color = ugfx.BLACK):
3131
ugfx.string_box(0,y,296,38, nick, font, color, ugfx.justifyCenter)
3232

3333
def battery(vUsb, vBatt, charging):
34+
vMin = badge.nvs_get_u16('batt', 'vmin', 3700) # mV
35+
vMax = badge.nvs_get_u16('batt', 'vmax', 4200) # mV
3436
if charging and vUsb>4000:
3537
try:
3638
badge.eink_png(0,0,'/lib/resources/chrg.png')

esp32/modules/launcher.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ugfx, badge, sys, uos as os, appglue, version
1+
import ugfx, badge, sys, uos as os, appglue, version, easydraw
22

33
def populate_it():
44
global options
@@ -15,6 +15,8 @@ def populate_it():
1515
for app in apps:
1616
if not app=="resources":
1717
options.add_item(app)
18+
19+
options.add_item('setup')
1820

1921
def run_it(pushed):
2022
if (pushed):
@@ -51,10 +53,8 @@ def uninstall_it(pushed):
5153

5254
def perform_uninstall(ok):
5355
if ok:
54-
ugfx.clear(ugfx.BLACK)
55-
ugfx.string_box(0, 25, 296, 25,"Uninstalling:","Roboto_BlackItalic24",ugfx.WHITE, ugfx.justifyCenter)
56-
ugfx.string_box(0, 51, 296, 23, selected, "PermanentMarker22", ugfx.WHITE, ugfx.justifyCenter)
57-
ugfx.flush()
56+
easydraw.msg("Uninstalling:",True)
57+
easydraw.msg(selected)
5858
install_path = get_install_path()
5959
for rm_file in os.listdir("%s/%s" % (install_path, selected)):
6060
os.remove("%s/%s/%s" % (install_path, selected, rm_file))
@@ -107,7 +107,7 @@ def perform_uninstall(ok):
107107
ugfx.input_attach(ugfx.JOY_UP, lambda pushed: ugfx.flush() if pushed else 0)
108108
ugfx.input_attach(ugfx.JOY_DOWN, lambda pushed: ugfx.flush() if pushed else 0)
109109

110-
ugfx.input_attach(ugfx.BTN_B, lambda pushed: appglue.start_app("") if pushed else 0)
111-
ugfx.input_attach(ugfx.BTN_START, lambda pushed: appglue.start_app("") if pushed else 0)
110+
ugfx.input_attach(ugfx.BTN_B, lambda pushed: appglue.home() if pushed else 0)
111+
#ugfx.input_attach(ugfx.BTN_START, lambda pushed: appglue.home() if pushed else 0)
112112

113113
ugfx.flush(ugfx.LUT_FULL)

esp32/modules/setup.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# SETUP APPLICATION
2-
# v2 by Thomas Roos
3-
# v1 by Renze Nicolai
1+
# File: setup.py
2+
# Version: 3
3+
# Description: Setup for SHA2017 badge
4+
# License: MIT
5+
# Authors: Renze Nicolai <renze@rnplus.nl>
6+
# Thomas Roos <?>
47

5-
import ugfx, badge, appglue, dialogs
8+
import ugfx, badge, appglue, dialogs, easydraw, time
69

710
def asked_nickname(value):
811
if value:
@@ -13,16 +16,22 @@ def asked_nickname(value):
1316
badge.nvs_set_u8('badge', 'setup.state', newState)
1417

1518
# Show the user that we are done
16-
ugfx.clear(ugfx.WHITE)
17-
ugfx.string(0, 0, "Hi, " + value, "PermanentMarker22", ugfx.BLACK)
18-
ugfx.string(0, 25, "Your nick is stored to flash!", "Roboto_Regular12", ugfx.BLACK)
19-
ugfx.flush(ugfx.LUT_FASTER)
19+
easydraw.msg("Hi "+value+"!",True)
20+
easydraw.msg("Your nick has been stored to flash!")
21+
time.sleep(0.5)
2022
else:
2123
badge.nvs_set_u8('badge', 'setup.state', 2) # Skip the sponsors
24+
badge.nvs_set_u8('sponsors', 'shown', 1)
25+
easydraw.msg("Hi developer!",True)
26+
time.sleep(0.5)
2227

2328
badge.eink_busy_wait()
24-
appglue.start_app("")
29+
appglue.home()
2530

2631
ugfx.init()
2732
nickname = badge.nvs_get_str("owner", "name", "")
33+
34+
easydraw.msg("Welcome to SHA2017!",True)
35+
time.sleep(1)
36+
2837
dialogs.prompt_text("Nickname", nickname, cb=asked_nickname)

esp32/modules/splash.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ def splash_timer_callback(tmr):
300300
### PROGRAM
301301

302302
# Load settings from NVS
303-
vMin = badge.nvs_get_u16('splash', 'bat.volt.min', 3700) # mV
304-
vMax = badge.nvs_get_u16('splash', 'bat.volt.max', 4200) # mV
305303
otaAvailable = badge.nvs_get_u8('badge','OTA.ready',0)
306304

307305
# Calibrate battery voltage drop

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